Updated on 2025-11-25 GMT+08:00

Querying Dump Task Details

Function

This API is used to query details of a dump task.

Calling Method

For details, see Calling APIs.

URI

GET /v2/{project_id}/streams/{stream_name}/transfer-tasks/{task_name}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

stream_name

Yes

String

Name of the stream

task_name

Yes

String

Name of the dump task to be queried

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

stream_name

String

Name of the stream to which the dump task belongs

task_name

String

Name of the dump task

state

String

Dump task status.

  • ERROR: An error occurs.

  • STARTING: The task is starting.

  • PAUSED: The task has been stopped.

  • RUNNING: The task is running.

  • DELETE: The task has been deleted.

  • ABNORMAL: The task is abnormal.

destination_type

String

Type of the dumping task.

- OBS: Data is dumped to OBS.

create_time

Long

Time when the dump task is created

last_transfer_timestamp

Long

Latest dump time of the dump task

partitions

Array of PartitionResult objects

List of partition dump details

obs_destination_description

OBSDestinationDescriptorRequest object

Parameter list of OBS to which data in the DIS stream will be dumped

Table 4 PartitionResult

Parameter

Type

Description

status

String

Current status of the partition

  • CREATING

  • ACTIVE

  • DELETED

  • EXPIRED

partition_id

String

Unique identifier of the partition

hash_range

String

Possible value range of the hash key used by the partition

sequence_number_range

String

Sequence number range of the partition

parent_partitions

String

Parent partition

Table 5 OBSDestinationDescriptorRequest

Parameter

Type

Description

task_name

String

Definition

Name of the dump task

Constraints

N/A

Range

It can contain 1 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

Default Value

N/A

agency_name

String

Definition

Name of the agency created in IAM. DIS uses an agency to access your specified resources. If agencies are available, you can use an IAM API to obtain the available agencies. If dump tasks are used on the console or through API calls, the system displays a message indicating that an agency named dis_admin_agency will be automatically created.

Constraints

Agency parameter settings:

  • Agency Type: Cloud service

  • Cloud Service: DIS

  • Validity Period: Unlimited

  • Set Policy to Tenant Administrator on the OBS project in the Global service region.

Range

Name of the agency to be created. The value of this parameter is 1 to 64 characters long and cannot be left unspecified.

Default Value

N/A

deliver_time_interval

Integer

Definition

User-defined interval (s) at which data is imported into OBS. If no data is pushed during the current interval, no dump file package will be generated.

Constraints

N/A

Range

The value is an integer ranging from 30 to 900.

Default Value

N/A

deliver_size_interval

Integer

Definition

Dump file size (MB). A dump is triggered when the size of the local cache reaches the threshold.

Constraints

N/A

Range

The value is an integer ranging from 1 to 300.

Default Value

N/A

consumer_strategy

String

Definition

Offset

Constraints

When modifying a dump task, ensure that the offset is the same as that set when the dump task was created. For example, if the maximum offset was set during dump task creation, the maximum offset must be used during dump task modification.

Range

  • LATEST: maximum offset, indicating that the latest data will be extracted.

  • TRIM_HORIZON: minimum offset, indicating that the earliest data will be extracted.

Default Value

N/A

file_prefix

String

Definition

Custom OBS directory for storing stream files. It is empty by default.

Constraints

Different directory levels are separated by forward slashes (/).

Range

The value can contain a maximum of 50 characters, including letters, digits, underscores (_), and slashes (/).

Default Value

Empty

partition_format

String

Definition

Directory structure of the object file written into OBS. The directory structure is in the format of yyyy/MM/dd/HH/mm (time at which the dumping task was created). After the data is dumped successfully, the storage directory structure is obs_bucket_path/file_prefix/partition_format. For example, if the dump task was created at 14:49 on November 10, 2017, then the directory structure is 2017 > 11 > 10 > 14 > 49.

Constraints

N/A

Range

  • N/A: If this field is left unspecified, the time directory format will not be used.

  • yyyy: year.

  • yyyy/MM: year and month

  • yyyy/MM/dd: year, month, and day

  • yyyy/MM/dd/HH: year, month, day, and hour

  • yyyy/MM/dd/HH/mm: year, month, day, hour, and minute.

Default Value

N/A

obs_bucket_path

String

Definition

Name of the OBS bucket used to store the stream data.

Constraints

It consists of lowercase letters, digits, hyphens (-), underscores (), and periods (.). Range The value contains 3 to 63 characters, including lowercase letters, digits, hyphens (-), underscores (), and periods (.).

Default Value

N/A

destination_file_type

String

Definition

Dump file format

Constraints

The csv and parquet formats can be selected only when Source Data Type is set to JSON and Dump Destination is set to OBS.

Range

  • text: This is the default value.

  • csv

  • parquet

Default Value

Text

processing_schema

ProcessingSchema object

Definition

Dump time directory generated based on the timestamp of the source data and the configured partition_format. Directory structure of the object file written into OBS. The directory structure is in the format of yyyy/MM/dd/HH/mm.

Constraints

N/A

Range

N/A

Default Value

N/A

record_delimiter

String

Definition

Delimiter for the dump file, which is used to separate the user data that is written into the dump file.

Constraints

It consists of lowercase letters, digits, hyphens (-), underscores (_), and periods (.).

Range

  • ,: comma, which is the default value

  • ;: semicolon

  • |: vertical bar

  • \n: newline character

  • NULL: null

Default Value

"\n"

Table 6 ProcessingSchema

Parameter

Type

Description

timestamp_name

String

Definition

Attribute name of the source data timestamp

Constraints

N/A

Range

N/A

Default Value

N/A

timestamp_type

String

Definition

Type of the source data timestamp.

Constraints

N/A

Range

  • String: string type

  • Timestamp: 13-bit timestamp of the long type

Default Value

N/A

timestamp_format

String

Definition

OBS directory generated based on the timestamp format. This parameter is mandatory when the timestamp type of the source data is String.

Constraints

N/A

Range

N/A

Default Value

N/A

Example Requests

Querying Dump Task Details

GET https://{Endpoint}/v2/{project_id}/streams/{stream_name}/transfer-tasks/{task_name}

Example Responses

Status code: 200

Normal response

{
  "stream_id" : "RdMFID6edQdf8eDzc9e",
  "stream_name" : "newstream",
  "task_name" : "newtask",
  "task_id" : "As805BudhcH1lDs6gbn",
  "destination_type" : "OBS",
  "state" : "RUNNING",
  "create_time" : 1606554932552,
  "last_transfer_timestamp" : 1606984428612,
  "obs_destination_description" : {
    "agency_name" : "dis_admin_agency",
    "file_prefix\"" : "",
    "partition_format" : "yyyy/MM/dd",
    "obs_bucket_path" : "obsbucket",
    "deliver_time_interval" : 60,
    "consumer_strategy" : "LATEST",
    "retry_duration" : 0,
    "destination_file_type" : "text",
    "record_delimiter" : ""
  },
  "partitions" : [ {
    "partitionId" : "shardId-0000000000",
    "discard" : 0,
    "state" : "RUNNING",
    "last_transfer_timestamp" : 1606984428612,
    "last_transfer_offset" : 289897
  } ]
}

SDK Sample Code

The SDK sample code is as follows.

Java

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.dis.v2.region.DisRegion;
import com.huaweicloud.sdk.dis.v2.*;
import com.huaweicloud.sdk.dis.v2.model.*;


public class ShowTransferTaskSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        DisClient client = DisClient.newBuilder()
                .withCredential(auth)
                .withRegion(DisRegion.valueOf("<YOUR REGION>"))
                .build();
        ShowTransferTaskRequest request = new ShowTransferTaskRequest();
        request.withStreamName("{stream_name}");
        request.withTaskName("{task_name}");
        try {
            ShowTransferTaskResponse response = client.showTransferTask(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

Python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkdis.v2.region.dis_region import DisRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkdis.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = DisClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(DisRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ShowTransferTaskRequest()
        request.stream_name = "{stream_name}"
        request.task_name = "{task_name}"
        response = client.show_transfer_task(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Go

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    dis "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dis/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dis/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dis/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := dis.NewDisClient(
        dis.DisClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ShowTransferTaskRequest{}
	request.StreamName = "{stream_name}"
	request.TaskName = "{task_name}"
	response, err := client.ShowTransferTask(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

More

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

Normal response

Error Codes

See Error Codes.