Status

Job status is exposed in two ways:

  • by reading job and task state through the API (see Jobs and Tasks);

  • by configuring an automated notification on the job, which is delivered when the job reaches a terminal state.

This section covers the automated notifications. Requests in this section target https://api.vtk.castlabs.com.

Status codes

The status field on a job (and on each task) is an integer:

Code

Meaning

0

Submitted

1

In progress

2

Completed

3

Failed

4

Aborted

5

Waiting for resources

6

Resource terminated

Each job/task also carries a human-readable status_text.

Job completion notification

Notify humans or systems about completed jobs automatically. Notifications are configured via the notify field on the job submission body and can be sent as an email or HTTP POST request.

E-mail notifications

To receive an e-mail on job completion, set notify to:

"notify": "mailto:<email_address>"

For example:

{
    "tasks": [],
    "notify": "mailto:user@example.com"
}

The e-mail contains the job completion status, job ID and a link to the job in the UI.

Custom e-mail notifications

Customizable notification e-mails can be sent to multiple recipients using the utils:notify_email tool inside the job’s task list.

HTTP POST request notification

By specifying a valid HTTP(S) URL, you receive a POST request containing the following JSON body when the job reaches a terminal state:

{
    "job_id": "<job_id>",
    "job_url": "<job_url>",
    "status": "<status>"
}

For example:

{
    "tasks": [],
    "notify": "https://example.com/api/job_callback"
}

HTTP POST with Digest Authentication

To use HTTP Digest Authentication for the callback, prefix the URL with digest: and embed credentials:

{
    "tasks": [],
    "notify": "digest:https://user:password@example.com/api/job_callback"
}

The POST body is the same as above.

Previous topic: Tasks