GuidesRecipesAPI ReferenceChangelogDiscussions
Log In

client.jobs.submit_file

Submit a job using files as inputs

client.jobs.submit_file(model, version, sources, explain=False)

Submit a job based on file (path or content) inputs, the sources dictionary is a double dict structure as follows:

{
  '<<<<input-item-key>>>>': {
    '<<<<data-input-item-key>>>>: '/some/file/path.ext'
  }
}

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

ParameterTypeDescriptionExample
modelstr
Model
Model identifier provided by Modzy or a model object previusly loaded.'ed542963de'
versionstrThe model’s version number. It follows the semantic versioning format.'1.0.1'
sourcesdictA mapping of source names to binary or path sources. Each source should be a mapping of model input key to a byte array, a path or a pathlib object (https://docs.python.org/3/library/pathlib.html).'{'my-input': {'input.txt': '/usr/inputs/some_file.txt'}}'
explainboolIf the model supports explainability, flag this job to return an explanation of the predictionsTrue

Returns

A Job object with the status from the server

{
  "job_identifier": "string",
  "status",
  "account_identifier": "string",        
  "explain": "boolean",        
  "created_at": "date-time",
  "updated_at": "date-time",
  "submitted_at": "date-time",
  "submitted_by": "string",        
  "pending": "integer",
  "completed": "integer",    
  "failed": "integer",
  "total": "integer",    
  "model": {
    "identifier": "string",
    "version": "string",
    "name": "string"
  },
  "job_inputs": ["string"],
  "user": {
    "identifier": "string",
    "external_identifier": "string",
    "email": "string",
    "firstName": "string",      
    "lastName": "string",
    "status": "string",
    "title": "string"
    "access_keys": [
    	{
    		"prefix": "string",
        "is_default": "boolean"
  		}
    ]                        
  }
}

Examples

>>>job = client.jobs.submit_file('ed542963de', '0.0.27', {'my-input': {'input.txt': '/usr/inputs/some_file.txt'}})
>>>job.job_identifier
'14856eb1-0ad8-49e7-9da3-887acb80fea5'
>>>job.status
'SUBMITTED'

Using a pathlib object

>>>import pathlib
>>>input_path = pathlib.Path('/usr/inputs/some_file.txt')
>>>job = client.jobs.submit_file('ed542963de', '0.0.27', {'my-input': {'input.txt': input_path}})
>>>job.job_identifier
'14856eb1-0ad8-49e7-9da3-887acb80fea5'
>>>job.status
'SUBMITTED'