API Reference
Log In

Jobs

Overview

The Jobs service provides the APIs needed to run and manage inference jobs that process data through a model. Modzy is able to access data from different sources, such as text, embedded, and data stored in AWS S3 buckets.

Also, this service monitors active jobs and accesses the job history. To see job details, call the API using the same key that submitted the job. The job history route supports pagination.

A job can process multiple items containing data. To run a job, declare a reference input item name and then include the input name the model requires. The reference name is useful to identify the item’s results. Add the data under the model’s input name.

7384

Job inputs and outputs

Once submitted, the API returns the job identifier and additional job metadata. Jobs are processed asynchronously according to priority and resource requirements. To check the status call the job details route. Jobs start off as “Submitted” and move to “In Progress” when they begin to run. Once finished, the status is set as “Completed” or “Error”. If a user cancels the job before it finishes, the status is set as “Canceled”.

To retrieve results call the get results route with the job identifier. Results are keyed on the user’s input item names provided upon job submittal. Each model has its own result MIME type, found in the model’s details.

The jobs object

{
    "jobIdentifier": "...",
    "submittedBy": "...",
    "accountIdentifier": "...",
    "model": {},
    "status": "...",
    "createdAt": "...",
    "updatedAt": "...",
    "submittedAt": "...",
    "total": 1,
    "pending": 1,
    "completed": 0,
    "failed": 0,
    "elapsedTime": 12345,
    "queueTime": 12345,
    "timeout": 99999,
    "user": {},
    "jobInputs": [],
    "inputByteAmount": 12345,
    "imageClassificationModel": true
}
ParameterTypeDescription
jobIdentifierstringThe job’s identifier.
submittedBystringThe API key that submitted the job.
accountIdentifierstringIdentifier linked to the account that requested the job.
modelobjectAn object that contains the model’s parameters. It can be used as a filter.
statusstringStatus of the jobs to be fetched. Defaults to all. It accepts all, timedout, pending, or terminated.
createdAtstringTime that the job was created in ISO8601 (YYYY-MM-DDThh:mm:ss.sTZD) format.
updatedAtstringTime that the job status was updated in ISO8601 (YYYY-MM-DDThh:mm:ss.sTZD) format.
submittedAtstringTime that the job was submitted in ISO8601 (YYYY-MM-DDThh:mm:ss.sTZD) format.
totalnumberAmount of items submitted to the job.
pendingnumberAmount of items in the item queue, not yet processed by the job.
completednumberAmount of items processed by the job.
failednumberAmount of items that the job couldn’t process.
queueTimenumberTime between the job is first submitted and it starts to run the first input in milliseconds.
elapsedTimenumberTime between the job starts to run until it is completed in milliseconds.
timeoutnumberContains a timeout in milliseconds for the job’s status to transition to TIMEDOUT. If it’s not set, jobs don’t timeout.
explainbooleanSets the explainability feature when a model offers the option.
userobjectAn object that contains the user’s parameters.
jobInputsarrayAn array that contains the input objects.
inputByteAmountnumberThe job’s total input weight in bytes.
imageClassificationModelbooleanA flag for image classification models. If true, it creates lightweight samples for the images.

Inputs

The input object holds the input items sent to the model to be processed. Most models only require one input to run successfully but some require more. Input object parameters change based on how the data is stored.

Text inputs

The inputs object - text

{
  "input": {
    "type": "text",
    "sources": {
      "my-input-reference-name-1": {
        "model-x-input-name": "A string to run."
      },
      "my-input-reference-name-2": {
        "model-x-input-name": "Another string to run."
      }
    }
  }
}
ParameterTypeDescription
typestringThe input type to be processed. Use text.
sourcesobjectContains all the input item objects to be processed.

The sources object

{
  "my-input-reference-name-1": {}
}
ParameterTypeDescription
input_item_nameobjectContains the input to be processed by the model and defines its name.

The input name object

"model-x-input-name": "A string to run."
ParameterTypeDescription
inputstringA string to be processed. The input name needs to match the model’s input name.

Embedded inputs

The inputs object - embedded

{
  "input": {
    "type": "embedded",
    "sources": {
      "my-image": {
        "image": "data:image/jpeg;base64,/.../2Q=="
      }
    }
  }
}
ParameterTypeDescription
typestringThe input type to be processed. Use embedded.
sourcesobjectContains all the input item objects to be processed.

The sources object

{
  "my-input-reference-name-1": {}
}
ParameterTypeDescription
input_item_nameobjectContains the input to be processed by the model and defines its name.

The input item name object

{
  "model-x-input-name": "A string to run."
}
ParameterTypeDescription
inputstringA base64 string to be processed. The input name needs to match the model’s input name.

AWS S3 inputs

The inputs object - aws-s3 / aws-s3-folder

{
  "input": {
    "type": "aws-s3",
    "accessKeyID": "...",
    "secretAccessKey": "...",
    "region": "...",
    "sources": {
      "my-input-reference-name-1": {
          "model-x-input-name": {
            "bucket": "...",
            "key": "..."
          }
      }
    }
  }
}
ParameterTypeDescription
typestringThe input type to be processed. Use aws-s3 to run a single item or aws-s3-folder to run all the items in a folder.
accessKeyIDstringThe access key ID provided by AWS.
secretAccessKeystringThe secret access key provided by AWS.
regionstringName of the geographical area where the input item is stored by AWS.
sourcesobjectContains all the input item objects to be processed.

The sources object

{
  "my-input-reference-name-1": {}
 }
ParameterTypeDescription
input_item_nameobjectContains the input to be processed by the model and defines its name.

The input item name object

"model-x-input-name": {
  "bucket": "...",
  "key": "..."
}
ParameterTypeDescription
inputobjectAn AWS bucket URL and the AWS key. The input name needs to match the model’s input name. Add one per bucket. The key may be a directory or a file.

JDBC inputs

The inputs object - jdbc

{
  "input": {
    "type": "jdbc",
    "url": "...",
    "username": "...",
    "password": "...",
    "driver": "...",
    "query":"..."
  }
}
typestringThe input type to be processed. Use jdbc.
urlstringThe URL to connect to the database.
usernamestringThe username to access the database.
passwordstringThe password to access the database.
driverstringThe JDBC driver to connect to the database.
querystringThe SQL query to use to get the input item.