Uwin A.
Uwin A.

Reputation: 1

Listing all tasks using REST API Microsoft HPC

Hi I have an issue and I did not find help on web that would solve. The thing is I want to list all tasks (running) in a given job using Rest API. The problem is that only 10 first tasks are fetched. And there are 50 tasks.

I tried to use the field RowsPerRead and setting it 100 for instance as discribed below with no succes. https://msdn.microsoft.com/en-us/library/windows/desktop/hh529658(v=vs.85).aspx

Any help will be highly appreciated

Upvotes: 0

Views: 590

Answers (1)

To get all the tasks of a job, you have to use the value of x-ms-continuation-queryId returned by your requests as described in the official documentation:

https://msdn.microsoft.com/en-us/library/windows/desktop/hh529658(v=vs.85).aspx

QueryId

Specifies internal data from the x-ms-continuation-QueryId header from the response in the previous Get Task List operation in a continuation sequence of Get Task List operations. For more information, see the Response Headers section later in this topic.

To illustrate a bit, let's say you make a request to get all existing jobs. The answer to your request will have a x-ms-continuation-queryId value queryId1. You will have to use this value in your next request to get the following RowsPerRead jobs. The answer to the second request will contain a x-ms-continuation-queryId value queryId2 and so forth until the value returned is the same as the previous one. At this point you'll know you have retrieved all jobs.

https://127.0.0.1:443/WindowsHPC/{0}/Jobs?api-version=2012-11-01.4.0 https://127.0.0.1:443/WindowsHPC/{0}/Jobs?api-version=2012-11-01.4.0&QueryId={queryId1} https://127.0.0.1:443/WindowsHPC/{0}/Jobs?api-version=2012-11-01.4.0&QueryId={queryId2}

Regarding the field RowsPerRead, it is only effective starting HPC Pack 2012 Release 3. In earlier versions RowsPerRead is fixed to 10.

Upvotes: 1

Related Questions