# Querying the Dataset Import Task List

#### Function

This API is used to query the dataset import task list by page.

#### URI

GET /v2/{project_id}/datasets/{dataset_id}/import-tasks

Table 1 Path Parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
dataset_id | Yes | String | Dataset ID.
project_id | Yes | String | Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

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 10.
offset | No | Integer | Start page of the paging list. The default value is 0.

#### Request Parameters

None

#### Response Parameters

Status code: 200

Table 3 Response body parameters
Parameter | Type | Description
--- | --- | ---
import_tasks | Array of ImportTaskStatusResp objects | List of import tasks.
total_count | Integer | Number of import tasks.

Table 4 ImportTaskStatusResp
Parameter | Type | Description
--- | --- | ---
annotated_sample_count | Long | Number of labeled samples.
create_time | Long | Time when a task is created.
data_source | DataSource object | Data source.
dataset_id | String | Dataset ID.
elapsed_time | Long | Task running time, in seconds.
error_code | String | Error code.
error_msg | String | Error message.
file_statistics | FileCopyProgress object | Progress of file copy.
finished_file_count | Long | Number of files that have been transferred.
finished_file_size | Long | Size of the file that has been transferred, in bytes.
import_path | String | OBS path or manifest path to be imported. - When importing a manifest file, ensure that the path is accurate to the manifest file.- When a path is imported as a directory, the dataset type can only support image classification, object detection, text classification, or sound classification.
import_type | Integer | Import mode. The options are as follows: - 0: Import by directory. - 1: Import by manifest file.
imported_sample_count | Long | Number of imported samples.
imported_sub_sample_count | Long | Number of imported subsamples.
processor_task_id | String | ID of a preprocessing task.
processor_task_status | Integer | Status of a preprocessing task.
status | String | Status of an import task. The options are as follows: - QUEUING: queuing - STARTING: execution started - RUNNING: running - COMPLETED: completed - FAILED: failed - NOT_EXIST: not found
task_id | String | Task ID.
total_file_count | Long | Total number of files.
total_file_size | Long | Total file size, in bytes.
total_sample_count | Long | Total number of samples.
total_sub_sample_count | Long | Total number of subsamples generated from the parent samples.
unconfirmed_sample_count | Long | Number of samples to be confirmed.
update_ms | Long | Time when a task is updated.

Table 5 DataSource
Parameter | Type | Description
--- | --- | ---
data_path | String | Data source path.
data_type | Integer | Data type. The options are as follows: - 0: OBS bucket (default value) - 1: GaussDB(DWS) - 2: DLI - 3: RDS - 4: MRS - 5: AI Gallery - 6: Inference service
schema_maps | Array of SchemaMap objects | Schema mapping information corresponding to the table data.
source_info | SourceInfo object | Information required for importing a table data source.
with_column_header | Boolean | Whether the first row in the file is a column name. This field is valid for the table dataset. The options are as follows: - true: The first row in the file is the column name. - false: The first row in the file is not the column name.

Table 6 SchemaMap
Parameter | Type | Description
--- | --- | ---
dest_name | String | Name of the destination column.
src_name | String | Name of the source column.

Table 7 SourceInfo
Parameter | Type | Description
--- | --- | ---
cluster_id | String | ID of an MRS cluster.
cluster_mode | String | Running mode of an MRS cluster. The options are as follows: - 0: normal cluster - 1: security cluster
cluster_name | String | Name of an MRS cluster.
database_name | String | Name of the database to which the table dataset is imported.
input | String | HDFS path of a table dataset.
ip | String | IP address of your GaussDB(DWS) cluster.
port | String | Port number of your GaussDB(DWS) cluster.
queue_name | String | DLI queue name of a table dataset.
subnet_id | String | Subnet ID of an MRS cluster.
table_name | String | Name of the table to which a table dataset is imported.
user_name | String | Username, which is mandatory for GaussDB(DWS) data.
user_password | String | User password, which is mandatory for GaussDB(DWS) data.
vpc_id | String | ID of the VPC where an MRS cluster resides.

Table 8 FileCopyProgress
Parameter | Type | Description
--- | --- | ---
file_num_finished | Long | Number of files that have been transferred.
file_num_total | Long | Total number of files.
file_size_finished | Long | Size of the file that has been transferred, in bytes.
file_size_total | Long | Total file size, in bytes.

#### Example Requests

Obtaining the Dataset Import Task List

    GET https://{endpoint}/v2/{project_id}/datasets/{dataset_id}/import-tasks

#### Example Responses

Status code: 200

OK

    {
      "total_count" : 1,
      "import_tasks" : [ {
        "status" : "COMPLETED",
        "task_id" : "gfghHSokody6AJigS5A_RHJ1zOkIoI3Nzwxj8nh",
        "dataset_id" : "gfghHSokody6AJigS5A",
        "import_path" : "obs://test-obs/daoLu_images/cat-dog/",
        "import_type" : 0,
        "total_sample_count" : 20,
        "imported_sample_count" : 20,
        "annotated_sample_count" : 20,
        "total_sub_sample_count" : 0,
        "imported_sub_sample_count" : 0,
        "total_file_size" : 0,
        "finished_file_count" : 0,
        "finished_file_size" : 0,
        "total_file_count" : 0,
        "create_time" : 1606114833874,
        "elapsed_time" : 2
      } ]
    }

#### Status Codes

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

#### Error Codes

See Error Codes.

Parent topic: Data Import Task