Listing jobs
Use the monitor
REST endpoint to list all jobs and their statuses. Jobs
that were stopped manually cease to exist and are not listed.
You can use this endpoint to identify jobs that are stalled and therefore candidates for termination.
The information returned for each job includes the following attributes:
- jobID
- The ID to use to query the status of or retrieve the result for a job.
- jobStatus
- The current job status:
- 0
- The attempt to run the job failed.
- 1
- The job is queued.
- 2
- The job is running.
- 3
- Data is available.
- 4
- The job completed.
- 5
- The job is stopping.
- serviceExecutor
- The executor of the service.
- serviceName
- The name of the service.
- startTime
- The date and time when the job started running.
- version
- The version of the service.
Example
def monitor_jobs():
url = "https://%s:50050/v1/services/monitor" % (restHostname)
headers = {
"content-type": "application/json",
"authorization": token
}
response = requests.get(url, verify = False, headers = headers, proxies = None)
if response.status_code == 200:
jobs = response.json()["MonitorServices"]
pprint(jobs)
The
output for each job looks similar to
this:{'MonitorServices': [{'jobID': '3b125fed-de4d-4789-b9f2-7d6d8eaec817',
'jobStatus': 3,
'jobStatusDescription': 'Job has data available',
'serviceExecuter': 'bluadmin',
'serviceName': 'DEMO1',
'startTime': '2020-02-20T08:34:47.073092-05:00',
'version': '1.0'}]}