GuidesRecipesAPI ReferenceChangelogDiscussions
Log In

modzyClient.getJobHistory

Retrieve jobs history

getJobHistory(user, accessKey, startDate, endDate, jobIdentifiers, status, page, perPage=1000, direction, sortBy)

Retrieve the list of jobs by using the search parameters.

ParameterTypeDescriptionExample
userstringName of the job submitter'Sarah Connor'
accessKeystringIdentifier of the access key'jU7q896uSReJcXXDOS6P'
startDatestring
Date
Filters jobs by the start date. It requires ISO8601 format (YYYY-MM-DDThh:mm:ss.sTZD) format or to be a date object.'2021-08-13T07:28:03.831'
endDatestring
Date
Filters jobs by the end date. It requires ISO8601 formated string (YYYY-MM-DDThh:mm:ss.sTZD) or a date object.'2021-08-13T07:28:03.831'
jobIdentifiersstringjob identifiers'14856eb1-0ad8-49e7-9da3-887acb80fea5'
statusstringFilters by the job status categories. Values can be: ALL, PENDING, TERMINATED. It can also filter by the job status: SUBMITTED, COMPLETED, CANCELED, IN_PROGRESS, TIMEDOUT, ERROR.'ALL'
pageintThe page number to be returned. Defaults to 0.1
perPageintThe number of records returned per page. Defaults to 10.10
directionstringOrders the records in ascending (ASC) or descending (DESC) order. It defaults to ASC.'ASC'
sortBystringCan be sorted by identifier, submittedBy, submittedJobs, status, createdAt, updatedAt, submitedAt, total, completed, fail and model.'model'

Returns

A job object list

{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "type": "array",
    "items": {
        "$ref": "#/definitions/Job"
    },
    "definitions": {
        "Job": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "jobIdentifier": {
                    "type": "string",
                    "format": "uuid"
                },
                "submittedBy": {
                    "$ref": "#/definitions/SubmittedBy"
                },
                "accountIdentifier": {
                    "$ref": "#/definitions/AccountIdentifier"
                },
                "model": {
                    "$ref": "#/definitions/Model"
                },
                "status": {
                    "$ref": "#/definitions/Status"
                },
                "createdAt": {
                    "type": "string",
                    "format": "date-time"
                },
                "updatedAt": {
                    "type": "string",
                    "format": "date-time"
                },
                "submittedAt": {
                    "type": "string",
                    "format": "date-time"
                },
                "total": {
                    "type": "integer"
                },
                "pending": {
                    "type": "integer"
                },
                "completed": {
                    "type": "integer"
                },
                "failed": {
                    "type": "integer"
                },
                "elapsedTime": {
                    "type": "integer"
                },
                "queueTime": {
                    "type": "integer"
                },
                "user": {
                    "$ref": "#/definitions/User"
                },
                "jobInputs": {
                    "type": "array",
                    "items": {}
                },
                "explain": {
                    "type": "boolean"
                }
            },
            "required": [
                "accountIdentifier",
                "completed",
                "createdAt",
                "explain",
                "failed",
                "jobIdentifier",
                "jobInputs",
                "model",
                "pending",
                "status",
                "submittedAt",
                "submittedBy",
                "total",
                "updatedAt"
            ]
        },
        "Model": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string"
                },
                "version": {
                    "$ref": "#/definitions/Version"
                },
                "name": {
                    "type": "string"
                }
            },
            "required": [
                "identifier",
                "name",
                "version"
            ]
        },
        "User": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string",
                    "format": "uuid"
                },
                "externalIdentifier": {
                    "type": "string"
                },
                "firstName": {
                    "type": "string"
                },
                "lastName": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "accessKeys": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/AccessKey"
                    }
                },
                "status": {
                    "type": "string"
                },
                "title": {
                    "type": "string"
                }
            },
            "required": [
                "accessKeys",
                "email",
                "externalIdentifier",
                "firstName",
                "identifier",
                "lastName",
                "status",
                "title"
            ]
        },
        "AccessKey": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "prefix": {
                    "type": "string"
                },
                "isDefault": {
                    "type": "boolean"
                }
            },
            "required": [
                "isDefault",
                "prefix"
            ]
        },
        "AccountIdentifier": {
            "type": "string"            
        },
        "Version": {
            "type": "string"            
        },
        "Status": {
            "type": "string",
            "enum": [
                "COMPLETED",
                "OPEN",
                "TIMEDOUT",
                "SUBMITTED",
                "CANCELLED"
            ]
        },
        "SubmittedBy": {
            "type": "string"            
        }
    }
}

Examples

job_history = modzyClient.getJobHistory(
  /*user*/null, /*accessKey*/null, /*startDate*/null, /*endDate*/null, 
  /*jobIdentifiers*/null, /*status*/null, 
  /*page*/, /*perPage*/10, /*direction*/null, /*sortBy*/null);
console.log( `Job History models ${models.length}` );

Using promises

modzyClient.modzyClient.getJobHistory(
  /*user*/null, /*accessKey*/null, /*startDate*/null, /*endDate*/null, 
  /*jobIdentifiers*/null, /*status*/null, 
  /*page*/, /*perPage*/10, /*direction*/null, /*sortBy*/null)
  .then(
    (models)=>{
      console.log( `Job History models ${models.length}` );
    }
  )
  .catch(
    (error)=>{
      console.error(error);
    }
  );