Help Center> Cloud Data Migration> API Reference> API> Job Management> Creating a Job in a Specified Cluster

Creating a Job in a Specified Cluster

Function

You can create a data migration job in a specified CDM cluster, but the job will not automatically start.

URI

  • URI format
    POST /v1.1/{project_id}/clusters/{cluster_id}/cdm/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.

    cluster_id

    Yes

    String

    Cluster ID. Obtain the value from the response for Creating a Cluster.

Request

  • Sample request
    POST /v1.1/1551c7f6c808414d8e9f3c514a170f2e/clusters/6ec9a0a4-76be-4262-8697-e7af1fac7920/cdm/job
    
    {
      "jobs": [
        {
       "job_type": "NORMAL_JOB",
       "name": "mysql2dws",
       "from-link-name": "mysql_link",
       "from-connector-name": "generic-jdbc-connector",
       "to-link-name": "dws_link",
       "to-connector-name": "generic-jdbc-connector",
       "from-config-values": {
            "configs": [
              {
                "inputs": [
                  {
                    "name": "fromJobConfig.useSql",
                    "value": "false"
                  },
                  {
                    "name": "fromJobConfig.schemaName",
                    "value": "rf_database"
                  },
                  {
                    "name": "fromJobConfig.tableName",
                    "value": "rf_from"
                  },
                  {
                    "name": "fromJobConfig.columnList",
                    "value": "AA&BB"
                  },
                  {
                    "name": "fromJobConfig.incrMigration",
                    "value": "false"
                  },
                  {
                    "name": "fromJobConfig.createOutTable",
                    "value": "false"
                  }
                ],
                "name": "fromJobConfig"
              }
            ]
          },
          "to-config-values": {
            "configs": [
              {
                "inputs": [
                  {
                    "name": "toJobConfig.schemaName",
                    "value": "rf_to_database"
                  },
                  {
                    "name": "toJobConfig.tablePreparation",
                    "value": "DROP_AND_CREATE"
                  },
                  {
                    "name": "toJobConfig.tableName",
                    "value": "rf_to"
                  },
                  {
                    "name": "toJobConfig.columnList",
                    "value": "AA&BB"
                  },
                  {
                    "name": "toJobConfig.isCompress",
                    "value": "false"
                  },
                  {
                    "name": "toJobConfig.orientation",
                    "value": "ROW"
                  },
                  {
                    "name": "toJobConfig.useStageTable",
                    "value": "false"
                  },
                  {
                    "name": "toJobConfig.shouldClearTable",
                    "value": "false"
                  },
                  {
                    "name": "toJobConfig.extendCharLength",
                    "value": "false"
                  }
                ],
                "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": "smnConfig.isNeedNotification",
                    "value": "false"
                  }
                ],
                "name": "smnConfig"
              },
              {
                "inputs": [
                  {
                    "name": "retryJobConfig.retryJobType",
                    "value": "NONE"
                  }
                ],
                "name": "retryJobConfig"
              }
            ]
          }
        }
      ]
    }
  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    jobs

    Yes

    List

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

  • Description of the jobs parameter

    Parameter

    Mandatory

    Type

    Description

    job_type

    Yes

    String

    Job type

    • NORMAL_JOB: table/file migration
    • BATCH_JOB: entire DB migration

    name

    Yes

    String

    Job name

    from-link-name

    Yes

    String

    Source link name

    from-connector-name

    Yes

    String

    Name of the connector of the source link

    to-link-name

    Yes

    String

    Destination link name

    to-connector-name

    Yes

    String

    Name of the connector of the destination link

    from-config-values

    Yes

    Dictionary

    Source link configuration. For details, see Description of from-config-values.

    to-config-values

    Yes

    Dictionary

    Destination link configuration. For details, see Description of to-config-values.

    driver-config-values

    Yes

    Dictionary

    Job parameter configuration. For details, see Description of driver-config-values.

  • Description of from-config-values, to-config-values, and driver-config-values

    Parameter

    Mandatory

    Type

    Description

    configs

    Yes

    List

    The data structures of source link parameters, destination link parameters, and job parameters are the same. However, the inputs parameter varies. For details, see Description of the configs parameter.

  • Description of the configs parameter

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Configuration name

    • fromJobConfig: source job configuration name
    • toJobConfig: destination job configuration name

    inputs

    Yes

    List

    Input parameter list. Each element in the list is in name,value format. For details, see Description of the inputs parameter.

  • Description of the inputs parameter

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Parameter name

    value

    Yes

    String

    Parameter value

Response

  • Sample response
    {
      "name": "mysql2hive"
       "validation-result": [{},{},{}
    }
  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Job name

    validation-result

    Yes

    List

    Validation result

    • If a job fails to be modified, the failure cause is returned.
    • If a job is successfully modified, a blank list is returned.

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.