Canceling a Video Parsing Task

Notes

  • To cancel a task, you need to provide the task ID.
  • The task to be canceled must be a task in the task queue. A video parsing task that has been started or completed cannot be deleted.

Core Code

1
2
3
String taskId = "1234";
BaseResponse deleteResponse = mpcClient.deleteExtractTask(taskId);
System.out.println(gson.toJson(deleteResponse));

Full Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import com.google.gson.Gson;
import com.huawei.mpc.client.MpcClient;
import com.huawei.mpc.client.MpcConfig;
import com.huawei.mpc.model.BaseResponse;

Gson gson = new Gson();

// Initialize the client.
MpcConfig mpcConfig = new MpcConfig();
mpcConfig.setEndPoint("mpc.cn-north-4.myhuaweicloud.com");
mpcConfig.setProjectId("ca225055625d48f6888f60730fb82657");
mpcConfig.setAk("Your project ID");
mpcConfig.setSk("****************************************");

MpcClient mpcClient = new MpcClient(mpcConfig);

String taskId = "1234";
BaseResponse deleteResponse = mpcClient.deleteExtractTask(taskId);
System.out.println(gson.toJson(deleteResponse));