locked
Cannot figure out HPC Task dependences using Hpc Pack REST API RRS feed

  • Question

  • I'm using HPC pack REST API, I was able to create a job, added one task(task1) to the job, and now I want to add another task(task2) to the job, and the task2 depends on task1, but don't know how to construct the xml.

    Below is my xml:

    <ArrayOfProperty xmlns="http://schemas.microsoft.com/HPCS2008R2/common">
        <Property>
            <Name>Name</Name>
            <Value>task2</Value>
        </Property>
        <Property>
            <Name>CommandLine</Name>
            <Value>echo Hello World!</Value>
        </Property>
        <Property>
            <Name>DependsOn</Name>
            <Value>
               ???
            </Value>
        </Property>
    </ArrayOfProperty>

    The API documents is located in this website: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/hh560262(v%3dvs.85)

    In the bottom of the documents, I could found DependsOn, and the link says it a Microsoft.Hpc.Scheduler.IStringCollection, so my question is,
    How to construct the string-collection in the xml?

    Wednesday, January 30, 2019 3:08 AM

Answers

  • Hi HuangMike,

    You may just set it a string value by comma delimited task names, e.g. <task1>,<task2>,<task3>...

    Regards,

    Yutong Sun

    • Marked as answer by HuangMike Wednesday, January 30, 2019 9:47 AM
    Wednesday, January 30, 2019 8:29 AM

All replies

  • Hi HuangMike,

    You may just set it a string value by comma delimited task names, e.g. <task1>,<task2>,<task3>...

    Regards,

    Yutong Sun

    • Marked as answer by HuangMike Wednesday, January 30, 2019 9:47 AM
    Wednesday, January 30, 2019 8:29 AM
  • I've already set it using this way, but I got the response:

    The remote server returned an error: (400) Request is inappropriate

     BTW, the xml is as below:

    <ArrayOfProperty xmlns="http://schemas.microsoft.com/HPCS2008R2/common">
        <Property>
            <Name>Name</Name>
            <Value>task1</Value>
        </Property>
        <Property>
            <Name>CommandLine</Name>
            <Value>notepad.exe</Value>
        </Property>
        <Property>
            <Name>DependsOn</Name>
            <Value>hhf_task6</Value>
        </Property>
    </ArrayOfProperty>

    • Edited by HuangMike Wednesday, January 30, 2019 9:36 AM
    Wednesday, January 30, 2019 9:35 AM
  • Sorry, It's my bad. You are right. The problem is that I set the request' contentType to "application/json; charset=utf-8", actually it should be "application/xml; charset=utf-8", after I changed the contentType, it correct set the task's depends.
    Wednesday, January 30, 2019 9:47 AM