SubmitRayJob

Updated at:

Submits a Ray job.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

emr-serverless-spark:SubmitRayJob

create

*All Resource

*

None None

Request syntax

POST /api/v1/workspaces/{workspaceId}/rayJob HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

workspaceId

string

No

The workspace ID.

w-d2d82aa09155

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request struct.

entrypoint

string

No

The startup command.

python -c "print('hello ray job')"

name

string

No

The job name.

my-job

displayReleaseVersion

string

No

The Ray DPI engine version number.

err-1.2.0 (Ray 2.55.1, Python 3.12)

tags

array<object>

No

The tags.

object

No

key

string

No

The key.

jobname

value

string

No

The value.

test

networkServiceName

string

No

The network connectivity name.

vpc

runtimeEnvJson

string

No

The Ray runtime environment JSON string.

{"pip":["requests==2.26.0","pendulum==2.1.2"],"env_vars":{"KEY":"VALUE"}}

workingDir

string

No

The URL of the job code working directory.

oss://mybucket/rayjob.zip

metadataJson

string

No

The job metadata JSON string.

{"resourceName": "test"}

submissionMode

string

No

The job submission mode.

HTTPMode

entrypointNumCpus

string

No

The number of CPUs requested by the entrypoint task.

1

entrypointNumGpus

string

No

The number of GPUs requested by the entrypoint task.

0

entrypointMemory

string

No

The memory size requested by the entrypoint task.

4Gi

entrypointResources

string

No

The custom resource request JSON string for the entrypoint task.

{"fpu": 1}

shutdownAfterJobFinishes

boolean

No

Specifies whether to automatically destroy the temporary cluster after the job finishes. Default value: true.

true

ttlSecondsAfterFinished

integer

No

The number of seconds to wait before destroying the cluster. This parameter takes effect only when shutdownAfterJobFinishes is set to true.

60

activeDeadlineSeconds

integer

No

The timeout period of the job, which includes the cluster creation time and job runtime. The job is canceled if this period is exceeded.

3600

volumeIds

array

No

The list of mounted volume IDs.

string

No

The managed file ID.

vol-12345678

headSpec

object

No

The Ray cluster head node parameters.

queueName

string

No

The queue name.

root_queue

cpu

string

No

The number of CPU cores.

2

memory

string

No

The memory size. Unit: GiB.

8Gi

enableAutoScaling

boolean

No

Specifies whether to enable automatic scaling for workers.

true

idleTimeoutSeconds

integer

No

The worker idle timeout period after automatic scaling is enabled.

60

gpuSpec

string

No

The GPU instance type.

ecs.gn6i-c4g1.xlarge

displayReleaseVersion

string

No

The Ray DPI engine version.

err-1.3.0 (Ray 2.55.1, Python 3.12)

workerSpec

array<object>

No

The parameters of the worker nodes in the Ray cluster.

object

No

The worker node struct.

groupName

string

No

The worker group name.

WorkerGroup1

workerType

string

No

The worker type.

CPU

replica

integer

No

The number of workers.

2

queueName

string

No

The queue name.

root_queue

cpu

string

No

The number of CPU cores.

4

memory

string

No

The memory size. Unit: GiB.

16Gi

minReplica

integer

No

The minimum number of workers after automatic scaling is enabled.

1

maxReplica

integer

No

The maximum number of workers after automatic scaling is enabled.

10

gpuSpec

string

No

The GPU instance type.

ecs.gn6i-c4g1.xlarge

displayReleaseVersion

string

No

The database engine version.

ray-1.2.0 (Ray 2.55.1, Python 3.12)

extraParam

string

No

The extra parameters in a JSON string.

{"userDefinedFiles": "oss://mybucket/artifact/config.json,oss://mybucket/artifact/config2.json", "userRequirementsFile": "oss://mybucket/requirements.txt"}

clusterId

string

No

The ID of an existing Ray cluster to which the job is submitted.

ray-xxxxxxxxx

Response elements

Element

Type

Description

Example

object

Schema of Response

requestId

string

The request ID.

DD6B1B2A-5837-5237-ABE4-FF0C8944

submissionId

string

Ray Job ID。

rj-k7nm8ahl5te4tg91

Examples

Success response

JSON format

{
  "requestId": "DD6B1B2A-5837-5237-ABE4-FF0C8944",
  "submissionId": "rj-k7nm8ahl5te4tg91"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.