Skip to content

Job Manager Service– Samples

Running a Model

Input Parameters

  • modelId: Defines the ID of the model, which must be accessible by the tenant using Model Management Service.

    Supported Models

    Currently, only Apache Zeppelin notebooks are supported.

  • configurationId: Defines the Environment Configuration created using the Predictive Learning services. The Job Manager instantiates the environment and runs the model on it.

  • inputFolderId: Defines the folder holding the input data, which must be accessible by the tenant using Data Exchange Service.
  • outputFolderId: Defines the output folder, which must already be created and be accessible by the tenant using Data Exchange Service.
  • maximumExecutionTimeInSeconds: Defines the maximum allowed execution time of the job. Only the actual execution time of the execution engine (Apache Zeppelin) is taken into account.

Starting the Job

Request:

1
2
POST /api/jobmanager/v3/jobs
X-XSRF-TOKEN: `<xsrf_token>`

The input parameters are defined in the body:

1
2
3
4
5
6
7
{
  "modelId": "<modelId>",
  "configurationId": "<configurationId>",
  "inputFolderId": "<inputFolderId>",
  "outputFolderId": "<outputFolderId>",
  "maximumExecutionTimeInSeconds":"7200"
}

Sample response:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "id": "<job_execution_id>",
  "modelId": "<modelId>",
  "environmentId": "<environmentId>",
  "message": "",
  "status": "SUBMITTED",
  "creationDate": "2018-10-01T12:00:00.001Z",
  "createdBy": "<your_tenant_id>",
  "inputFolderId": "<inputFolderId>",
  "outputFolderId": "<outputFolderId>",
  "configurationId": "<configurationId>",
  "maximumExecutionTimeInSeconds":"7200"
}

The <job_execution_id> is required for monitoring the job using the Job Manager.

Monitoring Job Execution

The current status of a job is requested using:

1
GET /api/jobmanager/v3/jobs/<job_execution_id>

Sample response:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "id": "<job_execution_id>",
  "modelId": "<modelId>",
  "environmentId": "<environmentId>",
  "message": "Started notebook execution.",
  "status": "RUNNING",
  "creationDate": "2018-10-01T02:00:00.001Z",
  "createdBy": "<your_tenant_id>",
  "inputFolderId": "<inputFolderId>",
  "outputFolderId": "<outputFolderId>",
  "configurationId": "<configurationId>",
  "maximumExecutionTimeInSeconds":"7200"
}

The following statuses are available:

1
2
3
4
5
6
7
SUBMITTED
STARTING
RUNNING
STOPPING
FAILED
SUCCEDED
STOPPED

The status is FAILED, if the job execution cannot be completed or an error occurred during the execution. This is also true, if only a single paragraph within a Zeppelin notebook fails and all other steps succeed. The Job Manager attempts to continue a job execution, if the execution workflow allows skipping individual steps.

Retrieving the List of Jobs

A list of all available jobs is retrieved using the following request:

1
GET /api/jobmanager/v3/jobs

By default, the Job Manager divides the result into pages of 100 entries and returns the first page. Using the query parameter <pageNumber>, the page number to be returned can be changed. The query parameter <pageSize> changes the number entries per page.

Response:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
 "content": [
  {
     "jobId": "<job_execution_id>",
     "modelId": "<modelId>",
     "environmentId": <environmentId>,
     "message": "message",
     "status": "SUCCEEDED",
     "creationDate": "2018-10-01T12:00:00.001Z",
     "createdBy": "TenantId",
     "inputFolderId": "<inputFolderId>",
     "outputFolderId": "<outputFolderId>",
     "configurationId": "<configurationId>",
     "maximumExecutionTimeInSeconds":"7200"
  },
  {
     "jobId": "<job_execution_id>",
     "modelId": "<modelId>",
     "environmentId": <environmentId>,
     "message": "Unable to import model into Zeppelin[I/O error on GET request for \"https://gateway.{region}.mindsphere.io/api/modelmanagement/v3/models/<model_id>/versions/last\": Server returned HTTP response code: 504 for URL: https://gateway.{region}.mindsphere.io/api/modelmanagement/v3/models/<model_id>/versions/last; nested exception is java.io.IOException: Server returned HTTP response code: 504 for URL: https://gateway.{region}.mindsphere.io/api/modelmanagement/v3/models/Model_id/versions/last] Error while stopping environment",
     "status": "STOPPING",
     "creationDate": "2018-10-01T12:00:00.001Z",
     "createdBy": "TenantId",
     "inputFolderId": "<inputFolderId>",
     "outputFolderId": "<outputFolderId>",
     "configurationId": "<configurationId>",
     "maximumExecutionTimeInSeconds":"7200"
  },
  {
     "jobId": "<job_execution_id>",
     "modelId": "<modelId>",
     "environmentId": <environmentId>,
     "message": "Failed to start environment [An environment has already been started for the configuration]",
     "status": "FAILED",
     "creationDate": "2018-10-02T12:00:00.001Z",
     "createdBy": "TenantId",
     "inputFolderId": "<inputFolderId>",
     "outputFolderId": "<outputFolderId>",
     "configurationId": "<configurationId>",
     "maximumExecutionTimeInSeconds":"7200"
  }
  ],
 "totalPages": 1,
 "totalElements": 3,
 "last": true,
 "size": 20,
 "number": 0,
 "numberOfElements": 3,
 "first": true,
 "sort": null
}

The second and third entry illustrate, that the chain of messages is returned to the user, if a fatal error is encountered and the execution logic cannot recover. The Job Manager attempts to stop the used instances, while preserving any outputs that might have been produced.

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.