modzyClient.getResult

Retrieve the results execution

modzyClient.getResult(jobId)

Return the current results of a Job execution, including completed, failed, total number of items processed

Parameters

Parameter

Type

Description

Example

jobId

string

Job identifier

'14856eb1-0ad8-49e7-9da3-887acb80fea5'

Returns

A Results object with the job results

📘

Result structure is different for each job and model

In each job, you define the input keys (i.e. my-input), and in the resulting structure, you need to use the same key to query the specific result. Also, each model can define his own output keys, which allow you to search specifically for the result of the model.

{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "$ref": "#/definitions/Result",
    "definitions": {
        "Results": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "jobIdentifier": {
                    "type": "string",
                    "format": "uuid"
                },
                "accountIdentifier": {
                    "type": "string"
                },
                "team": {
                    "$ref": "#/definitions/Team"
                },
                "total": {
                    "type": "integer"
                },
                "completed": {
                    "type": "integer"
                },
                "failed": {
                    "type": "integer"
                },
                "finished": {
                    "type": "boolean"
                },
                "submittedByKey": {
                    "type": "string"
                },
                "explained": {
                    "type": "boolean"
                },
                "submittedAt": {
                    "type": "string",
                    "format": "date-time"
                },
                "initialQueueTime": {
                    "type": "integer"
                },
                "totalQueueTime": {
                    "type": "integer"
                },
                "averageModelLatency": {
                    "type": "number"
                },
                "totalModelLatency": {
                    "type": "number"
                },
                "elapsedTime": {
                    "type": "integer"
                },
                "startingResultSummarizing": {
                    "type": "string",
                    "format": "date-time"
                },
                "resultSummarizing": {
                    "type": "integer"
                },
                "results": {
                    "type": "object",
                    "additionalProperties": {
                        "$ref": "#/definitions/Result"
                    }
                }
            },
            "required": [
                "accountIdentifier",
                "averageModelLatency",
                "completed",
                "elapsedTime",
                "explained",
                "failed",
                "finished",
                "initialQueueTime",
                "jobIdentifier",
                "resultSummarizing",
                "results",
                "startingResultSummarizing",
                "submittedAt",
                "submittedByKey",
                "team",
                "total",
                "totalModelLatency",
                "totalQueueTime"
            ]            
        },
        "Result": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "status": {
                    "type": "string"
                },
                "engine": {
                    "type": "string"
                },
                "inputFetching": {
                    "type": "integer"
                },
                "outputUploading": {
                    "type": "null"
                },
                "modelLatency": {
                    "type": "number"
                },
                "queueTime": {
                    "type": "integer"
                },
                "startTime": {
                    "type": "string"
                },
                "updateTime": {
                    "type": "string"
                },
                "endTime": {
                    "type": "string"
                },
                <<<<data-output-item-key>>>>: {
                    "type": "object",
                    "title": "This object or the content is specific to the model and version"
                },                
                "voting": {
                    "$ref": "#/definitions/Voting"
                }
            },
            "required": [
                "endTime",
                "engine",
                "inputFetching",
                "modelLatency",
                "outputUploading",
                "queueTime",
                "results.json",
                "results.png",
                "startTime",
                "status",
                "updateTime",
                "voting"
            ]
        },        
        "Voting": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "up": {
                    "type": "integer"
                },
                "down": {
                    "type": "integer"
                }
            },
            "required": [
                "down",
                "up"
            ]            
        },
        "Team": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string"
                }
            },
            "required": [
                "identifier"
            ]            
        }
    }
}

Examples

let result = modzyClient.getResult('14856eb1-0ad8-49e7-9da3-887acb80fea5')
console.log( `Result ${result.jobIdentifier} is finished: ${result.finished}` );
console.log( `Model Result ${result.results['my-input']['results.json']}` );

Using promises

modzyClient.getResult('14856eb1-0ad8-49e7-9da3-887acb80fea5')
  .then(
    (result)=>{
      console.log( `Result ${result.jobIdentifier} is finished: ${result.finished}` );
      console.log( `Model Result ${result.results['my-input']['results.json']}` );
    }
  )
  .catch(
    (error)=>{
      console.error(error);
    }
  );

Did this page help you?