Jobs/{jobID}: GET

Gets details about an asynchronous job.

Availability

Available on all IBM Spectrum Scale™ editions.

Description

The GET jobs/jobID request gets information about the asynchronous job that is specified in the request.

Request URL

https://<IP address or host name of API server>:<port>/scalemgmt/v2/jobs/jobID
where
jobs
Specifies running jobs as the resource of this GET call. Required.
jobs/jobID
Specifies the job about which you need to get information. Required.

Request headers

Content-Type: application/json
Accept: application/json

Request parameters

The following parameters can be used in the request URL to customize the request:
Table 1. List of request parameters
Parameter name Description and applicable keywords Required/optional
jobId Unique identifier of the asynchronous job. Required.
fields Comma separated list of fields to be included in response. ':all:' selects all available fields. Optional.

Request data

No request data.

Response data

{
    "status": {
      "code":ReturnCode",
      "message":"ReturnMessage"
   },
   "paging": 
    {
    "next": "URL"
    },
   jobs: [
      {
         "result":"", 
           { 
             "commands":"String",
             "progress":"String,
             "exitCode":"Exit code",
             "stderr":"Error",
             "stdout":"String",
           },
         "request":" ",
           {
             "type":"{GET | POST | PUT | DELETE}",
             "url":"URL",
             "data":""",
           }
         "jobId":"ID",
         "submitted":"Time",
         "completed":Time",
         "status":"Job status",
         }   
        ],
   }
For more information about the fields in the following data structures, see the links at the end of this topic.
"status":
Return status.
"message": "ReturnMessage",
The return message.
"code": ReturnCode
The return code.
"paging"
The URL to retrieve the next page. Paging is enabled when more than 1000 objects are returned by the query.
"jobs":
An array of elements that describe jobs. Each element describes one job.
"result"
"commands":"String'
Array of commands that are run in this job.
"progress":"String'
Progress information for the request.
"exitCode":"Exit code"
Exit code of command. Zero is success, nonzero denotes failure.
"stderr":"Error"
CLI messages from stderr.
"stdout":"String"
CLI messages from stdout.
"request"
"type":"{GET | POST | PUT | DELETE}"
HTTP request type.
"url":"URL"
The URL through which the job is submitted.
"data":" "
Optional.
"jobId":"ID",
The unique ID of the job.
"submitted":"Time"
The time at which the job was submitted.
"completed":Time"
The time at which the job was completed.
"status":"RUNNING | COMPLETED | FAILED"
Status of the job.

Known limitation

If there are more than one GUI nodes in a cluster, you need to use the filter parameter to get the details of the particular job. For example, if a job is submitted on GUI2 and it returns a jobId=2000000000003. If you query GUI1 for that job ID using /jobs/2000000000003, it returns "Invalid request" because it cannot find the job since it was submitted to the other GUI. A workaround is to use "/jobs?filter=jobId=2000000000003" instead of "/jobs/2000000000003" in the request URL to retrieve the job correctly from the other GUI.

Examples

The following example gets information about the job 12345.

Request URL:
curl -k -u admin:admin001 -X GET --header 'accept:application/json' 
'https://198.51.100.1:443/scalemgmt/v2/jobs/12345'
Note: If there are more than one GUI nodes in the cluster, use the following request URL to retrieve the details of the job:
curl -k -u admin:admin001 -X GET --header 'accept:application/json' 
'https://198.51.100.1:443/scalemgmt/v2/jobs?filter=jobId=12345'
Response data:
Note: In the JSON data that is returned, the return code indicates whether the command is successful. The response code 200 indicates that the command successfully retrieved the information. Error code 400 represents an invalid request and 500 represents internal server error.
{
  "status": {
    "code": "200",
    "message": "..."
  },
  "paging": {
    "next": "https://localhost:443/scalemgmt/v2/filesystems/gpfs0/filesets?lastId=1001"
  },
  "jobs": [
    {
      "result": {
        "commands": "[''mmcrfileset gpfs0 restfs1001'', ...]",
        "progress": "[''(2/3) Linking fileset'']",
        "exitCode": "0",
        "stderr": "[''EFSSG0740C There are not enough resources available to create 
                   a new independent file set.'',  ...]",
        "stdout": "[''EFSSG4172I The file set {0} must be independent.'', ...]"
      },
      "request": {
        "type": "GET",
        "url": "/scalemgmt/v2/filesystems/gpfs0/filesets",
        "data": "{\"config\":{\"filesetName\":\"restfs1001\",\"owner\":\"root\",\"path\":
                 \"/mnt/gpfs0/rest1001\",\"permissions\":\"555\"}"
      },
      "jobId": "12345",
      "submitted": "2016-11-14 10.35.56",
      "completed": "2016-11-14 10.35.56",
      "status": "COMPLETED"
    }
  ]
}