modzyClient.getJobClient().submitJob

Submits a Job for processing

submitJob(String modelId, String modelVersionId, JobInput<?> jobInput, Boolean explain)

Submits a job based on the inputs provided. The structure is handled by the JobInput type provided (see below).

Parameters

Parameter

Type

Description

Example

modelId

java.lang.String

Model identifier provided by Modzy.

"ed542963de"

versionId

java.lang.String

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

"1.0.1"

jobInput

com.modzy.sdk.model.JobInput

A subclass of JobInput object, populated with inputs of specific type:

com.modzy.sdk.model.JobInputText

com.modzy.sdk.model.JobInputS3

com.modzy.sdk.model.JobInputEmbedded

com.modzy.sdk.model.JobInputJDBC

JobInput<String> jobInput = new JobInputText();
jobInput.addSource("source-key", mapSource);

explain

java.lang.Boolean

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

true

Returns

com.modzy.sdk.model.Job A Job object with the job status obtained from the server.

Examples

Text Inputs

Submits a job with text as inputs

JobInput<String> jobInput = new JobInputText();
Map<String,String> mapSource = new HashMap<>();
mapSource.put("input.txt", "Modzy is great!");
jobInput.addSource("my-input", mapSource);
Job job = modzyClient.submitJob("ed542963de", "1.0.1", jobInput, false);

Embedded Inputs

Submits a job with bytes as inputs

JobInput<EmbeddedData> jobInput = new JobInputEmbedded();
Map<String,EmbeddedData> mapSource = new HashMap<>();
mapSource.put("input.txt", new EmbeddedData("text/plain", "Modzy is great!".getBytes(StandardCharsets.UTF_8)));
jobInput.addSource("my-input", mapSource);
Job job = modzyClient.submitJob("ed542963de", "1.0.1", jobInput, false);

File Inputs

JobInput<InputStream> jobInput = new JobInputStream();
Map<String,InputStream> mapSource = new HashMap<>();
mapSource.put("input.txt", new FileInputStream( "/usr/inputs/some_file.txt" ));
jobInput.addSource("my-input", mapSource);
Job job = modzyClient.submitJob("ed542963de", "1.0.1", jobInput, false);

AWS S3 Input

JobInput<S3FileRef> jobInput = new JobInputS3("accessKey", "secretAccessKey", "us-east-1");
Map<String,S3FileRef> mapSource = new HashMap<>();
mapSource.put("image", new S3FileRef("someBucket", "someKey"));
jobInput.addSource("my-input", mapSource);
Job job = modzyClient.submitJob("ed542963de", "1.0.1", jobInput, false);

JDBC

JobInput<String> jobInput = new JobInputJDBC("jdbc:postgresql://database-host:5432/mydatabase", "username", "password", "org.posgresql.Driver", "select description as \'input.txt\' from my-table");   
Job job = modzyClient.submitJob("ed542963de", "1.0.1", jobInput, false);

Did this page help you?