modzyClient.submitJobAWSS3

Submit a job using aws s3 files as inputs

modzyClient.submitJobAWSS3(modelId, versionId, accessKeyID, secretAccessKey, region, awss3Sources, explain=false)

Submit a job based on data files stored in AWS S3 buckets, the sources dictionary is a double object structure as follows:

{
  '<<<<input-item-key>>>>': {
    '<<<<data-input-item-key>>>>: {
      'bucket': '<<aws_bucket>>',
      'key': '<<aws_file_key>>'
    }
  }
}

Where:

<<<<input-item-key>>>>: are user defined keys to identify the input items.
<<<<data-input-item-key>>>>: are model defined keys (usually file names).

Parameters

Parameter

Type

Description

Example

modelId

string

Model identifier provided by Modzy.

'ed542963de'

versionId

string

The model’s version number. It follows the semantic versioning format.

'1.0.1'

accessKeyId

string

The AWS access key

'SomeAccessKey

secretAccessKey

string

The AWS secret access key

'SomeSecretAccessKey

region

string

The AWS Region

'us-east-1

awss3Sources

object

A mapping of source names to s3 bucket/key references. Each source should be a mapping of model input key to a aws s3 bucket/key reference.

'{'my-input': {'input.txt': {'bucket': 'some_bucket', 'key': 'some_key.txt'}}}'

explain

boolean

If the model supports explainability, flag this job to return an explanation of the predictions

true

Returns

A Job object with the status from the server

{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "$ref": "#/definitions/Job",
    "definitions": {
        "Job": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "model": {
                    "$ref": "#/definitions/Model"
                },
                "status": {
                    "type": "string"
                },
                "totalInputs": {
                    "type": "integer"
                },
                "jobIdentifier": {
                    "type": "string",
                    "format": "uuid"
                },
                "accessKey": {
                    "type": "string"
                },
                "explain": {
                    "type": "boolean"
                },
                "jobType": {
                    "type": "string"
                },
                "accountIdentifier": {
                    "type": "string"
                },
                "team": {
                    "$ref": "#/definitions/Team"
                },
                "user": {
                    "$ref": "#/definitions/User"
                },
                "jobInputs": {
                    "$ref": "#/definitions/JobInputs"
                },
                "submittedAt": {
                    "type": "string",
                    "format": "date-time"
                },
                "imageClassificationModel": {
                    "type": "boolean"
                }
            },
            "required": [
                "accessKey",
                "accountIdentifier",
                "explain",
                "imageClassificationModel",
                "jobIdentifier",
                "jobInputs",
                "jobType",
                "model",
                "status",
                "submittedAt",
                "team",
                "totalInputs",
                "user"
            ]            
        },
        "JobInputs": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "identifier"
            ]            
        },
        "Model": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string"
                },
                "version": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            },
            "required": [
                "identifier",
                "name",
                "version"
            ]            
        },
        "Team": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string"
                }
            },
            "required": [
                "identifier"
            ]            
        },
        "User": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string",
                    "format": "uuid"
                },
                "firstName": {
                    "type": "string"
                },
                "lastName": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                }
            },
            "required": [
                "email",
                "firstName",
                "identifier",
                "lastName"
            ]            
        }
    }
}

Examples

sources = {'my-input': {'input.txt': {'bucket': 'some-bucket', 'key': 'some_key.txt'}}};
job = await modzyClient.submitJobEmbedded('ed542963de', '0.0.27', 'aws_key', 'aws_secret_key', 'us-east-1', sources);
console.log( `Job ${job.identifier} status ${job.status}` );

Using promises

sources = {'my-input': {'input.txt': {'bucket': 'some-bucket', 'key': 'some_key.txt'}}};
modzyClient.submitJobEmbedded('ed542963de', '0.0.27', 'aws_key', 'aws_secret_key', 'us-east-1', sources, true)
  .then(
    (job)=>{
      console.log( `Job ${job.identifier} status ${job.status}` );
    }
  )
  .catch(
    (error)=>{
      console.error(error);
    }
  );

Did this page help you?