Help Center> Cloud Data Migration> API Reference> API> Job Management> Creating and Executing a Job in a Random Cluster

Creating and Executing a Job in a Random Cluster

Function

You can specify a list of CDM clusters. The system selects a random cluster in the running status from the clusters you specified and creates and executes a migration job.

URI

  • URI format
    POST /v1.1/{projectId}/clusters/job
  • URI parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID. For details about how to obtain the project ID, see Obtaining the Project ID, Account Name, and AK/SK.

Request

  • Sample request
    POST /v1.1/ad359ede62234598a962ccb952e3e332/clusters/job
    
    {
        "jobs": [
            {
            "job_type": "NORMAL_JOB",
            "name": "es_css",
            "from-link-name": "css",
            "from-connector-name": "elasticsearch-connector",
            "to-link-name": "dis",
            "to-connector-name": "dis-connector",
            "from-config-values": {
                    "configs": [
                        {
                            "inputs": [
                                {
                                    "name": "fromJobConfig.index",
                                    "value": "52est"
                                },
                                {
                                    "name": "fromJobConfig.type",
                                    "value": "est_array"
                                },
                                {
                                    "name": "fromJobConfig.columnList",
                                    "value": "array_f1_int:long&array_f2_text:string&array_f3_object:nested"
                                },
                                {
                                    "name": "fromJobConfig.splitNestedField",
                                    "value": "false"
                                }
                            ],
                            "name": "fromJobConfig"
                        }
                    ]
                },
            "to-config-values": {
                    "configs": [
                        {
                            "inputs": [
                                {
                                    "name": "toJobConfig.streamName",
                                    "value": "dis-lkGm"
                                },
                                {
                                    "name": "toJobConfig.separator",
                                    "value": "|"
                                },
                                {
                                    "name": "toJobConfig.columnList",
                                    "value": "1&2&3"
                                }
                            ],
                            "name": "toJobConfig"
                        }
                    ]
                },
            "driver-config-values": {
                    "configs": [
                        {
                            "inputs": [
                                {
                                    "name": "throttlingConfig.numExtractors",
                                    "value": "1"
                                },
                                {
                                    "name": "throttlingConfig.submitToCluster",
                                    "value": "false"
                                },
                                {
                                    "name": "throttlingConfig.numLoaders",
                                    "value": "1"
                                },
                                {
                                    "name": "throttlingConfig.recordDirtyData",
                                    "value": "false"
                                }
                            ],
                            "name": "throttlingConfig"
                        },
                        {
                            "inputs": [],
                            "name": "jarConfig"
                        },
                        {
                            "inputs": [
                                {
                                    "name": "schedulerConfig.isSchedulerJob",
                                    "value": "false"
                                },
                                {
                                    "name": "schedulerConfig.disposableType",
                                    "value": "NONE"
                                }
                            ],
                            "name": "schedulerConfig"
                        },
                        {
                            "inputs": [],
                            "name": "transformConfig"
                        },
                        {
                            "inputs": [
                                {
                                    "name": "retryJobConfig.retryJobType",
                                    "value": "NONE"
                                }
                            ],
                            "name": "retryJobConfig"
                        }
                    ]
                }
            }
        ],
        "clusters": [
                "b0791496-e111-4e75-b7ca-9277aeab9297",
                "c2db1191-eb6c-464a-a0d3-b434e6c6df26",
                "9917ab56-7ac9-4a0b-8422-a806cf7b96e9"
        ]
    }
  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    jobs

    Yes

    List

    Job list. For details, see Description of the jobs parameter.

    clusters

    Yes

    String

    IDs of CDM clusters. The system selects a random cluster in the running status from the clusters you specified and creates and executes a migration job. For details about how to obtain the cluster ID list, see Querying the Cluster List.

Response

  • Sample response
    {
      "name": "es_css"
    }
  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Job name

Return Value

  • Normal

    200

  • Abnormal

    Return Value

    Description

    400 Bad Request

    Request error. For details about the returned error code, see Error Code.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    No operation permission.

    404 Not Found

    The requested resource is not found.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    Service unavailable.