# Querying the Version List of a Data Processing Task

#### Function

This API is used to query the version list of a data processing task.

#### URI

GET /v2/{project_id}/processor-tasks/{task_id}/versions

Table 1 Path parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
project_id | Yes | String | Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.
task_id | Yes | String | ID of a data processing task.

Table 2 Query parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
limit | No | Integer | Maximum number of records returned on each page. The value ranges from 1 to 100. The default value is 100.
offset | No | Integer | Start page of the paging list. The default value is 0.

order

No

String

Sorting sequence of the query. The options are as follows:

- asc: ascending order

- desc: descending order (default value)

sort_by

No

String

Sorting mode of the query. The options are as follows:

- create_time: Sort by creation time. (Default value)

- version_name: Sort by task version name.

#### Request Parameters

None

#### Response Parameters

Status code: 200

Table 3 Response body parameters
Parameter | Type | Description
--- | --- | ---
count | Integer | Total number of versions.
versions | Array of DescTaskVersionResp objects | Version list of a data processing task queried by page.

Table 4 DescTaskVersionResp
Parameter | Type | Description
--- | --- | ---
add_sample_count | Integer | Number of added images after processing.
create_time | Long | Time when a data processing task is created.
deleted_sample_count | Integer | Number of deleted images after processing.
description | String | Version description of a data processing task.
duration_seconds | Integer | Running time of a data processing task, in seconds.
inputs | Array of ProcessorDataSource objects | Input channel of a data processing task.
modified_sample_count | Integer | Number of modified images after processing.
origin_sample_count | Integer | Number of images before processing.

status

Integer

Status of a data processing task. The options are as follows:

- 0: initialized

- 1: running

- 2: completed

- 3: failed

- 4: stopped

task_id | String | ID of a data processing task.
task_version_id | String | Version ID of a data processing task.
template | TemplateParam object | Algorithm template, such as the algorithm ID and parameters.
unmodified_sample_count | Integer | Number of unmodified images after processing.
update_time | Long | Time when a data processing task is created.
version_name | String | Version name of a data processing task.
work_path | WorkPath object | Output channel of a data processing task.

Table 5 ProcessorDataSource
Parameter | Type | Description
--- | --- | ---
name | String | Dataset name.

source

String

Data source path. The options are as follows:

- If type is set to OBS, source is an OBS path.

- If type is set to TASK, source is a task ID.

- If type is set to DATASET, source is a dataset ID.

- If type is set to CUSTOM and the API is called by resource tenants, set source to the project_id of the actual user. Otherwise, this field is left blank.

type

String

Data source type. The options are as follows:

- OBS: Data obtained from OBS

- TASK: Data processing task

- DATASET: Dataset

- CUSTOM: Data called by resource tenants

version_id | String | Version of a dataset.
version_name | String | Dataset version name.

Table 6 TemplateParam
Parameter | Type | Description
--- | --- | ---

id

String

Task type, that is, ID of a data processing template. The options are as follows:

- sys_data_analyse: feature analysis

- sys_data_cleaning: data cleansing

- sys_data_augmentation: data augmentation

- sys_data_validation: data validation

- sys_data_selection: data selection

name | String | Template name.
operator_params | Array of OperatorParam objects | Operator parameter list.

Table 7 OperatorParam
Parameter | Type | Description
--- | --- | ---
advanced_params_switch | Boolean | Advanced parameter switch.
id | String | ID of an operator.
name | String | Name of an operator.
params | Object | Operator parameter. The parameter type is map<string,object>. Currently, object only supports the types of Boolean, Integer, Long, String, List and Map<String,String>. For two special scenarios of object detection and image classification in a data preprocessing task, the value of task_type is object_detection or image_classification.

Table 8 WorkPath
Parameter | Type | Description
--- | --- | ---
name | String | Dataset name.
output_path | String | Output path.

path

String

Working path. The options are as follows:

- If type is set to OBS, source is an OBS path.

- If type is set to DATASET, source is a dataset ID.

type

String

Type of a working path. The options are as follows:

- OBS: OBS path

- DATASET: dataset

version_id | String | Version of a dataset.
version_name | String | Name of a dataset version. The value can contain 0 to 32 characters. Only digits, letters, underscores (_), and hyphens (-) are allowed.

#### Example Requests

Querying the Version List of a Data Processing Task

    GET https://{endpoint}/v2/{project_id}/processor-tasks/{task_id}/versions?offset=0&limit=5

#### Example Responses

Status code: 200

OK

    {
      "count" : 2,
      "versions" : [ {
        "task_version_id" : "qSaudx2sbPvthHygckA",
        "task_id" : "kM7j9TSa611ZzBThzSr",
        "version_name" : "V002",
        "description" : "",
        "status" : 0,
        "create_time" : 1606377874450,
        "inputs" : [ {
          "type" : "DATASET",
          "source" : "PYc9H2HGv5BJNwBGXyK",
          "version_id" : "Osc8SZ7TZStiRV4vYkZ",
          "name" : "dataset-test",
          "version_name" : "V0010"
        } ],
        "work_path" : {
          "type" : "DATASET",
          "path" : "PYc9H2HGv5BJNwBGXyK",
          "name" : "dataset-test",
          "version_name" : "V0011",
          "output_path" : "/test-obs/classify/output/qSaudx2sbPvthHygckA/"
        },
        "template" : {
          "id" : "sys_data_validation",
          "name" : "name to translate",
          "operator_params" : [ {
            "name" : "MetaValidation",
            "advanced_params_switch" : false,
            "params" : {
              "task_type" : "image_classification",
              "dataset_type" : "manifest",
              "source_service" : "select",
              "filter_func" : "data_validation_select",
              "image_max_width" : "1920",
              "image_max_height" : "1920",
              "total_status" : "[0,1,2]"
            }
          } ]
        },
        "duration_seconds" : 151
      }, {
        "task_version_id" : "YHFWU18zXuNbqxtzegG",
        "task_id" : "kM7j9TSa611ZzBThzSr",
        "version_name" : "V001",
        "description" : "",
        "status" : 2,
        "create_time" : 1606375407276,
        "inputs" : [ {
          "type" : "DATASET",
          "source" : "PYc9H2HGv5BJNwBGXyK",
          "version_id" : "yoJ5ssClpNlOrsjjFDa",
          "name" : "dataset-test",
          "version_name" : "V009"
        } ],
        "work_path" : {
          "type" : "DATASET",
          "path" : "PYc9H2HGv5BJNwBGXyK",
          "name" : "dataset-test",
          "version_id" : "Osc8SZ7TZStiRV4vYkZ",
          "version_name" : "V0010",
          "output_path" : "/test-obs/classify/output/YHFWU18zXuNbqxtzegG/"
        },
        "template" : {
          "id" : "sys_data_validation",
          "name" : "name to translate",
          "operator_params" : [ {
            "name" : "MetaValidation",
            "advanced_params_switch" : false,
            "params" : {
              "task_type" : "image_classification",
              "dataset_type" : "manifest",
              "source_service" : "select",
              "filter_func" : "data_validation_select",
              "image_max_width" : "1920",
              "image_max_height" : "1920",
              "total_status" : "[0,1,2]"
            }
          } ]
        },
        "duration_seconds" : 812,
        "origin_sample_count" : 18,
        "add_sample_count" : 0,
        "modified_sample_count" : 0,
        "unmodified_sample_count" : 18,
        "deleted_sample_count" : 0
      } ]
    }

#### Status Codes

Status Code | Description
--- | ---
200 | OK
401 | Unauthorized
403 | Forbidden
404 | Not Found

#### Error Codes

See Error Codes.

Parent topic: Processing Task