Updated on 2026-11-06 GMT+08:00

Using APIs to Connect to a Ray Federation Endpoint and Submit Jobs

If you need to integrate data processing capabilities into your service system, or to submit Ray jobs and query job status automatically, you can use APIs to connect to a Ray Federation endpoint and submit jobs. AI DataLake provides standard RESTful APIs that you can call programmatically.

Prerequisites

RayCluster endpoints and a Ray Federation endpoint have been created, and they are in the Running state. For details, see Creating a Ray Engine Endpoint.

Related APIs

Running a Job

Procedure

  1. Use an API tool, such as Postman, to call the API to connect to the Ray Federation endpoint and submit a job.

    For details about calling APIs, see Calling APIs.

    An example request is as follows:

    POST /v2/workspaces/{workspace_id}/ray-jobs
    {
      "name": "xd-test-010-0906",
      "endpoint_name": "ray-federation-1hrr",
      "config": {
        "entrypoint": "python3 -c \"import ray,time; time.sleep(30); ray.init(); print(ray.cluster_resources())\"",
        }
    }

    Table 1 describes the key parameters. For more information, see Running a Job.

    Table 1 Parameter description

    Parameter

    Description

    workspace_id

    Enter the workspace ID. For details about how to obtain a workspace ID, see Managing Workspaces.

    name

    Enter the job name.

    endpoint_name

    Enter the Ray Federation endpoint name. For details about how to obtain the endpoint name, see Managing a Ray Engine Endpoint.

    entrypoint

    Enter the main script for running the job.

  2. Check the returned response. A response similar to the following indicates that the Ray Federation endpoint is connected and the job is submitted:

    {
      "job_id" : "ac8111bf-3601-4905-8ddd-b41d3e63****"
    }

Related Operations