Updated on 2022-08-17 GMT+08:00

Importing a Job

Function

This API is used to import one or more job files from OBS to DLF.

Before using this API, store job files in OBS buckets.

URI

  • URI format

    POST /v1/{project_id}/jobs/import

  • Parameter description
    Table 1 URI parameter

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID. For details about how to obtain a project ID, see Project ID and Account ID.

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

path

Yes

String

If OBS is deployed, it refers to the OBS path for storing the job definition file. For the format of the job definition file, see the response message of the exported job, for example, obs://myBucket/jobs.zip.

params

No

Map<String,String>

Public job parameter.

sameNamePolicy

No

String

Policy for specifying how to handle duplicate names. The options are as follows:

  • SKIP
  • OVERWRITE

Default value: SKIP

jobsParam

No

List<JobParam>

Job parameter. For details, see Table 3.

executeUser

No

String

User that executes the job.

Table 3 JobParam parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Job name.

params

No

Map<String,String>

Job parameter.

Response

Table 4 Response parameter

Parameter

Mandatory

Type

Description

taskId

Yes

String

ID of the task. Used to call the API for querying system tasks to obtain the import status.

Example

Import jobs from OBS to DLF. If there are jobs and scripts with the same name, overwrite them.

  • Request
    POST /v1/b384b9e9ab9b4ee8994c8633aabc9505/jobs/import
    {
    "path": "obs://aaaaa/job_batch.zip",
    "sameNamePolicy": "OVERWRITE",
    "jobsParam": [{
    "name": "job_batch",
    "params": {
    "streamName": "dis-AHTr"
    }
    }]
    }
  • Success response
    HTTP status code 200
    {
    "taskId":"008aae2e675933c7016759418e870000"
    }
  • Failure response

    HTTP status code 400

    {
        "error_code":"DLF.0815",
        "error_msg":"Fail to read OBS file."
    }