Get basic job information (GET)

Description

URL

scheme://domain:port/platform/ws/jobs

Description

By default, gets basic information for all jobs in all states submitted by the logged in user. Includes jobs with the status DONE and EXIT that have finished recently within the interval specified by CLEAN_PERIOD in the LSF configuration file lsb.params.

The logged on user must be have the cluster administrator role to retrieve information about jobs submitted by other users.

HTTP Method

GET

Parameters

Name Description
 

jobname

Optional.

Gets basic information about jobs that have the specified job name.

The job name can be up to 4094 characters long. Job names are not unique.

You can use the wildcard character (*) anywhere within a job name. For example, job* returns jobA, jobB, jobC, and so on.

 

username

Optional.

If user name is not specified, gets information about jobs submitted by the logged in user.

OS user name or LSF user group name. You must be logged on as a cluster administrator or group administrator to use this parameter.

Gets basic information about jobs submitted by the specified user, or jobs submitted by users belonging to the specified LSF user group.

Use the keyword all to return jobs and basic job information for jobs submitted by all users.

To specify a windows user name, use the format DOMAIN_NAME\\user_name. For example: mydomain\\user1.

To get a list of users, use the API /platform/ws/users.

To get a list of user groups, use the API /platform/ws/usergroups.

 

queuename

Optional.

Returns information about jobs in the specified queue.

To get a list of queues, use the API /platform/ws/queues.

 

hostname

Optional. Gets basic information about jobs that have been dispatched to the specified host, jobs that have been dispatched to all hosts in the specified host group, or jobs that have been dispatched to all hosts in the specified cluster.

To get a list of hosts, use the API /platform/ws/hosts.

To get a list of host groups, use the API /platform/ws/hostgroups.

To get the local cluster name, use the API /platform/ws/clusters/local.

 

status

Optional. Gets basic information about jobs with the specified job status.

If status is not specified, gets information about jobs in all states.

Valid values:

  • ACTIVE: Gets basic information about jobs that have the LSF status PEND, RUN, PSUSP, USUSP, SSUSP.
  • PENDING: Gets basic information about jobs that have the LSF status PEND.
  • SUSPENDED: Get basic information about jobs that have the LSF status PSUSP, USUSP, SSUSP.
  • RUNNING: Gets basic information about jobs that have the LSF status RUN.
  • DONE: Gets basic information about jobs that have the LSF status DONE.
  • EXIT: Gets basic information about jobs that have the LSF status EXIT.
  • COMPLETE: Gets basic information about jobs with the LSF status DONE and EXIT that have finished recently(within the interval specified by CLEAN_PERIOD in the LSF configuration file lsb.params. The default is 1 hour).
 

start

Optional.  The start index for job paging. Must be a positive integer.

If this parameter is not set, the default start number is 1.

For example, if there are 1024 jobs to return from LSF, and you set start to 20 and pagesize to 50, the API returns 50 jobs, and the first job of these 50 jobs is the twentieth job of all 50 jobs:

/platform/jobs?start=20&pagesize=50

 

pagesize

Optional. Maximum number of jobs that are returned. Must be a positive integer.

If this parameter is not set, the default is to return all jobs.

Request

Request-Method

GET

Request-URI

/platform/ws/jobs?jobname=%s&username=%s&queuename=%s&hostname=%s&status=%s&start=%d&pagesize=%d

Request-Header

Name Value

Accept

application/xml or application/json

Message-body

empty

Response

Response-Code

  • 200 Successful: Request was successful.
  • 403 Forbidden: Access restricted by role-based access control permissions.
  • 404 Not Found: No jobs that match the specified criteria found.
  • 500 Internal Server Error: Exception occurred

Response-Header

Name Value

Content-Type

application/xml or application/json

Message-body

Success Message

If successful, returns basic information about jobs.

For additional information, refer to the schema file ./schemas/jobs/pseudojob.xsd.

<jobs total="%s">
  <atom:link href="%s" rel="self"/>
  <pseudoJob>
   <command>%s</command>
   <exHosts>%s</exHosts>
   <fromHost>%s</fromHost>
   <jobId>%s</jobId>
   <jobName>%s</jobName>
   <jobStatus>%s</jobStatus>
   <queue>%s</queue>
   <submitTimeGMT>%s</submitTimeGMT>
   <user>%s</user>
  </pseudoJob>
  <pseudoJob>
   ...
  </pseudoJob>
</jobs>
Failure Message

If not successful, returns an error message.

For additional information, refer to the schema file ./schemas/jobs/error.xsd.

<error>
  <message>
     %s
  </message>
</error>

Example: Get basic information about all jobs submitted by the logged on user that have a job name starting with job

# Request
GET /platform/ws/jobs?jobname=job* HTTP/1.1
Host: www.example.org
# Response
200 Successful
Content-Type: application/xml;
<jobs total="2">
 <atom:link href="http://hostA:8080/platform/ws/jobs" rel="self"/>
 <pseudoJob>
  <command>sleep 20000</command>
  <exHosts>hostA</exHosts>
  <fromHost>hostA</fromHost>
  <jobId>528</jobId>
  <jobName>job_myjob</jobName>
  <jobStatus>DONE</jobStatus>
  <queue>normal</queue>
  <submitTimeGMT>1366132354000</submitTimeGMT>
  <user>ENG\lsfadmin</user>
 </pseudoJob>
 <pseudoJob>
  <command>sleep 10000</command>
  <exHosts>hostB</exHosts>
  <fromHost>hostA</fromHost>
  <jobId>529</jobId>
  <jobName>jobX34578</jobName>
  <jobStatus>DONE</jobStatus>
  <queue>normal</queue>
  <submitTimeGMT>1366132359000</submitTimeGMT>
  <user>ENG\lsfadmin</user>
 </pseudoJob>
</jobs>

Example: Get basic information about all jobs submitted by the logged on user but display only 20 jobs at a time. Start at 20, then start at 70

# Request
GET /platform/ws/jobs?start=20 HTTP/1.1
Host: www.example.org
# Response
200 Successful
Content-Type: application/xml;
<jobs total=”1024”>
	<atom:link rel="self" href="http://www.example.org/platfom/ws/jobs?start=20"/>
	<atom:link rel="prev" 
		href="http://www.example.org/platfom/ws/jobs?start=1&pageSize =20"/>
	<atom:link rel="next" 
		href="http://www.example.org/platfom/ws/jobs?start=70"/>
	<pseudoJob>…</pseudoJob>
	…
</jobs>

Related APIs

  • Get a list of users: /platform/ws/users
  • Get a list of user groups: /platform/ws/usergroups
  • Get a list of queues: /platform/ws/queues
  • Get a list of hosts: /platform/ws/hosts
  • Get a list of host groups: /platform/ws/hostgroups