Updated on 2023-11-27 GMT+08:00

Uploading a PyFile Package Group (Discarded)

Function

This API is used to upload a group of PyFile packages to a project. When a group with the same name as the PyFile package is uploaded, the new group overwrites the old group.

This API has been discarded and is not recommended.

URI

  • URI format

    POST /v2.0/{project_id}/resources/pyfiles

  • Parameter description
    Table 1 URI parameter

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

paths

Yes

Array of strings

List of OBS object paths. The OBS object path refers to the OBS object URL.

group

Yes

String

Name of a package group.

Response

Table 3 Response parameters

Parameter

Mandatory

Type

Description

group_name

No

String

Group name.

status

No

String

Status of a package group to be uploaded.

resources

No

Array of strings

List of names of resource packages contained in the group.

details

No

Array of body

Details about a group resource package. For details, see Table 4.

create_time

No

Long

UNIX timestamp when a package group is uploaded.

update_time

No

Long

UNIX timestamp when a package group is updated.

is_async

No

Boolean

Whether to upload resource packages in asynchronous mode. The default value is false, indicating that the asynchronous mode is not used. You are advised to upload resource packages in asynchronous mode.

owner

No

String

Owner of a resource package.

description

No

String

Description of a resource module.

module_name

No

String

Name of a resource module.

module_type

No

String

Type of a resource module.

  • jar: User JAR file
  • pyFile: User Python file
  • file: User file
Table 4 details parameter description

Parameter

Mandatory

Type

Description

create_time

No

Long

UNIX time when a resource package is uploaded. The timestamp is in milliseconds.

update_time

No

Long

UNIX time when the uploaded resource package is uploaded. The timestamp is in milliseconds.

resource_type

No

String

Resource type. Set this parameter to pyFile.

resource_name

No

String

Resource name.

status

No

String

  • Value UPLOADING indicates that the resource package group is being uploaded.
  • Value READY indicates that the resource package has been uploaded.
  • Value FAILED indicates that the resource package fails to be uploaded.

underlying_name

No

String

Name of the resource packages in a queue.

is_async

No

Boolean

Indicates whether to upload a resource package asynchronously.

Example Request

Upload a Python file from OBS to DLI and name the group gatk.

{
    "paths": [
        "https://test.obs.xxx.com/dli_tf.py"
    ],
    "group": " gatk"
}

Example Response

{
    "group_name": "gatk",
    "status": "READY",
    "resources": [
        "dli_tf.py"
    ],
    "details":[
        {
          "create_time":1608804435312,
          "update_time":1608804435312,
          "resource_type":"pyFile",
          "resource_name":"dli_tf.py",
          "status":"READY",
          "underlying_name":"dli_tf.py"
        }
       ],
    "create_time": 1521532893736,
    "update_time": 1521552364503,
    "is_async":false
}

Status Codes

Table 5 describes the status code.

Table 5 Status codes

Status Code

Description

201

Upload succeeded.

400

Request error.

500

Internal service error.

Error Codes

If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Codes.