Create custom runtime API

You can use this API to create a custom runtime.

HTTP method and URI path

POST /v4/runtimes

Standard headers

Use the following standard HTTP header with this request:

Content-Type: application/json

Authorization: <Bearer token>

Required authorizations

The user ID associated with the token which is specified in the request header needs to be granted with one of the following roles:

  • sysadm
  • mladm
  • apiuser
  • devuser
  • appuser

Request body

The request content is expected to contain a JSON object. See Table 1 for the description of the fields.
Table 1. Supported parameters for the Create custom runtime API

In this table, the Parameter column lists the supported parameters; the Type column lists the data type for the parameter, the Required or optional column indicates whether the parameter is required or optional for this request; and the Description column provides a brief description of the parameter.

Parameter Type Required or optional Description
tags Array Optional

An array of tags for the runtime. Each tag includes following two fields.

  • value: Required for String. The text of the tag.
  • Description: Optional for String. Description of the tag.
name String Required The name of the custom runtime.
description String Optional The description of the runtime.
platform JSON object Required
  • name: Required for string. The name of the platform that the runtime supports.
  • versions: Required for string. The version of the platform.
custom_libraries Array Optional

An array of the libraries in the runtime. Each element includes:

  • href: Required for String. The href of the library.
  • id: Optional for String. The ID of the library.
.
system_defined Boolean Optional Indicates if this runtime is pre-defined in the system (true if it is). If missing (default is false), it indicates that this is a user defined runtime.
services String Optional

The services by which this custom runtime is used.

For example, [“training”, “scoring”].

It indicates the custom runtime can be used as training or scoring.
Example of request body:
{
    "name": "runtimes_0413",
    "description": "runtime spec created for custom libraries",
    "platform": {
        "name": "spark",
        "version": "4.0"
    },
    "tags": [
        {
            "value": "ProjectA",
            "description": "ProjectA description"
        }
    ],
    "custom_libraries": [
        {
            "href": "/v4/libraries/64a7e2c8-3cb0-4d18-bf65-b66ea32dd39f"
        }
] ,
"system_difined": false,
"services": ["training", "scoring"]
}
 

Expected response

On completion, the service returns an HTTP response, which includes a status code that indicates whether your request is completed. Status code 201 indicates a successful completion. A status code of 4nn or 5nn indicates an error.

Table 2. Response headers
Parameter Value Description
location /v4/runtime/<runtime_id> Location of the newly created runtime.
Content-type application/json The type of the response body.
Table 3. Response from a successful request

In this table, the Field column and Subfield columns list the returned fields, and the Description column provides a brief description of the field.

Field Subfield Description
Entity name The name of the runtime.
platform The platform of the runtime, including:
  • name: Required for string. The name of the platform. Example: “spark”.
  • version: Required for string. The version of the platform. Example: “4.0”.
custom_libraries

An array of the libraries in the runtime. Each element includes:

  • href: Required for String. The href of the library.
  • id: Optional for String. The ID of the library.
description The description of the runtime.
space Internal library space. It can’t be changed in system. We use a static space ID.
  • href: The href of the space that the library stored in.
  • id: The ID of the space.
system_defined Indicates if this runtime is pre-defined in the system (true if it is). If missing (default is false), it indicates that this is a user defined runtime.
tags An array of tags for the library. Each tag includes following two fields.
  • value: Required for String. The text of the tag.
  • description: Optional for String. Description of the tag.
services

The services by which this custom runtime is used.

For example, [“training”, “scoring”].

It indicates the custom runtime can be used as training or scoring.
metadata guid The unique ID of the runtime.
id The unique ID of the runtime. Same as guid.
href The URI of the runtime.
owner The ID of the user that created this runtime.
created_at The creation timestamp of the runtime.
modified_at The timestamp of the last modification of the runtime.
Response example of a successful request:
{
    "entity": {
        "custom_libraries": [
            {
                "href": "/v4/libraries/64a7e2c8-3cb0-4d18-bf65-b66ea32dd39f",
                "id": "64a7e2c8-3cb0-4d18-bf65-b66ea32dd39f"
            }
        ],
        "description": "runtime spec created for custom libraries",
        "name": "runtimes_0413",
        "platform": {
            "name": "spark",
            "version": "4.0"
        },
        "services": [
            "training",
            "scoring"
        ],
        "space": {
            "href": "/v4/spaces/017cbc6c-7a49-4c44-956c-8a0c26a3f76d",
            "id": "017cbc6c-7a49-4c44-956c-8a0c26a3f76d"
        },
        "system_defined": false,
        "tags": [
            {
                "description": "ProjectA description",
                "value": "ProjectA"
            }
        ]
    },
    "metadata": {
        "created_at": "2022-11-29T02:06:45.648Z",
        "guid": "1f7588d1-ed17-4bde-b611-ca8e4eba7e1c",
        "href": "/v4/runtimes/1f7588d1-ed17-4bde-b611-ca8e4eba7e1c",
        "id": "1f7588d1-ed17-4bde-b611-ca8e4eba7e1c",
        "modified_at": "2022-11-29T02:06:45.648Z",
        "owner": "wmlz01"
    }
}