Skip to content

Sequence Resource: Job

Raúl Naveiras edited this page Oct 22, 2013 · 20 revisions

Sequence Resource: Job

Introduction

A Job represents a work order in the system, and it is essentially a set of tasks that need to be accomplished before a specific due date. This is how it looks like:

<?xml version='1.0' encoding='utf-8' ?>
<job>
  <name>Ironman 2</name>
  <due-date type='date'>2010-05-05T00:00:00+02:00</due-date>
  <licensor-name>Warner</licensor-name>
  <status>pending</status>
  <tasks-status>pending</tasks-status>
  <assets-status>not_received</assets-status>
  <link href="http://sequence.local/api/work_areas/52/jobs/12875" rel="self"></link>
  <link href="http://sequence.local/api/work_areas/52" rel="work_area"></link>
  <link href="http://sequence.local/api/work_areas/52/jobs/12875/assets" rel="assets"></link>
  <link href="http://sequence.local/api/work_areas/52/jobs/12875/tasks" rel="tasks"></link>
  <link href="http://sequence.local/api/work_areas/52/jobs/12875/notes" rel="notes"></link>
  <link href="http://sequence.local/api/work_areas/52/jobs/12875/problems" rel="problems"></link>
</job>

Available attributes:

Name (name)

Read/Write String

The Job Name. Normally a Movie or an episode

Due Date (due-date)

Read/Write [ISO-8601](http://www.w3.org/TR/NOTE-datetime Date)

This is the date by which the Job should be completed.

Ends At (ends-at)

String: Optional for Job Creation

This is the end date for a given Job. Normally corresponds with the end date of a Video On Demand availability/license window.

Template (template)

String: Required for Job Creation

This identifies the name of the workflow template that needs to be used when creating the job. The tasks and assets defined on that template would be the ones that would get associated to the new Job. A template with that name must exist in the account of the Job creation will fail

Licensor Name (licensor-name)

Read/Write String: Required for Job Creation

This is the name of the Licensor or Production Company associated to this Job. It is used to request Materials and for filtering purposes.

Tags List (tag-list)

Optional for Job Creation

This is a comma separated list of tags that can be used to describe the job. They can be then used in Sequence for filtering.

Status (status)

Read Only String

This is a summary of the possible statuses of a Job, which is derived from the statuses of its tasks and assets. The status cannot be changed directly in the Job, it will change according to the status of its tasks and assets. The possible values are the following:

  • late: A Job will be "late" if at least one asset or task is pending and the Due Date is in the past
  • pending: A Job will be "pending" if at least one asset or task is pending and the Due Date is in the future
  • done: A Job will be "done" when all tasks and assets have been completed.
  • live: A Job will be "live" when all tasks and assets have been completed and the current date is inside the Scheduling window.

Assets Status (assets-status)

Read Only String

This is a summary of the statuses of the Assets of a given Job. As it is derived from the status of its Assets, it cannot be updated directly. The possible values are the following:

  • not_received: When none of the Assets of the Job have been completed.
  • partly_received: When at least one Asset has been marked as received and there is at least one asset still to be received for that given Job.
  • received: When all Assets of the Job have been marked as received.

Tasks Status (tasks-status)

Read Only String

This is a summary of the statuses of the Tasks of a given Job, and it is derived from the status of its tasks. It will only change as the status of its tasks change, so it cannot be changed directly. The possible values are the following:

  • pending: When none of the tasks of the Job have been completed.
  • in_progress: When at least one task has been completed and there is at least one task still pending for that given Job.
  • completed: When all tasks of the Job have been completed.

Resources of a Job

A Job can expect many Assets. More at Sequence Resource: Asset A Job can have many Tasks. More at Sequence Resource: Task A Job can have many Problems. More at Sequence Resource: Problem A Job can have many Notes. More at Sequence Resource: Note

External links in a Job

If you're using BeBanjo's Movida or Metadata, your jobs in Sequence will link to the following resources there:

Please note that there can be a small delay before the Job resource is updated with its corresponding Title link after the Job is created via the Send to Sequence process in Movida; the Title link is also available in the linked Scheduling resource.

Creating a Job

In order to create a Job, it is necessary to POST a Job XML to the Jobs URL of a given "Work Area". Let's say we want to create a JOB in a Work Area with id 10, we would post to a URL like the following:

https://sequence.example.com/api/work_areas/10/jobs

The required attributes to create a Job are the following (see above for descriptions):

  • name
  • due-date
  • licensor-name
  • template

The optional attributes are:

  • ends-at (If not specified, the job will by default have and end date of 2 months after its due date)
  • tag-list

Here is an example with curl:

curl --digest -u robot_user -H "Content-Type: application/xml" -d @job.xml https://sequence.example/api/work_areas/10/jobs

This line would issue a POST request to the URL specified at the end using digest authentication. It is also setting the HTTP header "Content-Type: application/xml" (required) and is sending the contents of the file "job.xml" as the body of the request. This is what the body of the POST request should look like:

<job>
  <name>Mulholland Drive</name>
  <due-date>2010-12-31</due-date>
  <ends-at>2011-01-31</ends-at>
  <template>Ingest</template>
  <licensor-name>Miramax</licensor-name>
  <tag-list>Drama, Surreal</tag-list>
</job>

If successfully created, the response will be the complete XML of the new job with an HTTP status code of 200:

<job>
  <name>Mulholland Drive</name>
  <due-date type='date'>2010-12-31T00:00:00+00:00</due-date>
  <licensor-name>Miramax</licensor-name>
  <status>pending</status>
  <tasks-status>pending</tasks-status>
  <assets-status>not_received</assets-status>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187" rel="self"></link>
  <link href="https://sequence.example/api/work_areas/10" rel="work_area"></link>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187/assets" rel="assets"></link>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187/tasks" rel="tasks"></link>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187/notes" rel="notes"></link>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187/problems" rel="problems"></link>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187/hooks" rel="hooks"></link>
</job>

Updating a Job

To update a Job, it is necessary to issue a PUT request to the URL of a given Job. The body of the request should contain the XML of the Job with the changed attributes. Note that not all attributes must be included - it would be enough to include the attributes that we wish to update.

The following example updates the name and due-date of the previous job. Note how the URL used now is the one that uniquely identifies the Job:

curl --digest -u robot_user -H "Content-Type: application/xml" -X PUT -d @job_update.xml https://sequence.example/api/work_areas/10/jobs/27187

This is what the body of the request would contain:

<job>
  <name>Mulholland Dr.</name>
  <due-date>2011-01-01</due-date>
</job>

If the request is successful, it should return the updated Job XML and a status code of 200:

<job>
  <name>Mulholland Dr.</name>
  <due-date type='date'>2011-01-01T00:00:00+00:00</due-date>
  <licensor-name>Miramax</licensor-name>
  <status>pending</status>
  <tasks-status>pending</tasks-status>
  <assets-status>not_received</assets-status>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187" rel="self"></link>
  <link href="https://sequence.example/api/work_areas/10" rel="work_area"></link>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187/assets" rel="assets"></link>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187/tasks" rel="tasks"></link>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187/notes" rel="notes"></link>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187/problems" rel="problems"></link>
  <link href="https://sequence.example/api/work_areas/10/jobs/27187/hooks" rel="hooks"></link>
</job>

Deleting a Job

In order to Delete a Job, it is only necessary to issue a DELETE request to the Job URL, like so:

curl --digest -u robot_user -H "Content-Type: application/xml" -X DELETE https://sequence.example/api/work_areas/10/jobs/27187

The response should be a 204 (No content) HTTP Status code, with no body.

Clone this wiki locally