Command
field of Application
. The returned result is saved in the configured stdout output location.tccli batch help
NAMEbatchDESCRIPTIONbatch-2017-03-12USEAGEtccli batch <action> [--param...]OPTIONShelpshow the tccli batch help info--versionspecify a batch api versionAVAILABLE ACTIONDescribeComputeEnvUsed to query details of the computing environmentCreateTaskTemplateUsed to create a task template
stdout
and stderr
from the standard output and upload them to the specified COS bucket upon task completion. You need to create a bucket and a subfolder for storage in advance.tccli batch SubmitJob --version 2017-03-12 --Job '{"JobName": "TestJob", // Job name"JobDescription": "for test ", // Job description"Priority": "1", // Job priority"Tasks": [ // Task list (this example only contains one task){"TaskName": "Task1", // Task 1 name"Application": { // Task execution command"DeliveryForm": "LOCAL", // Runs the local command."Command": "python -c \\"fib=lambda n:1 if n<=2 else fib(n-1)+fib(n-2); print(fib(20))\\" " // Command content (Fibonacci summation)},"ComputeEnv": { // Computing environment configuration"EnvType": "MANAGED", // Computing environment types: MANAGED and UNMANAGED"EnvData": { // Specific configuration (The current type is MANAGED. Refer to the CVM instance creation description)"InstanceType": "S1.SMALL1", // CVM instance type"ImageId": "img-m4q71qnf", // CVM image ID (o be replaced)}},"RedirectInfo": { // Configuration of standard output redirection"StdoutRedirectPath": "cos://dondonbatchv5-1251783334.cosgz.myqcloud.com/logs/", // Standard output (to be replaced)"StderrRedirectPath": "cos://dondonbatchv5-1251783334.cosgz.myqcloud.com/logs/" // Standard error (to be replaced)}}]}'--Placement'{"Zone": "ap-guangzhou-2" // Availability zone (to be replaced)}'
SubmitJob
CommandSubmitJob
command in Batch:tccli batch SubmitJob --version 2017-03-12 --Job '{"JobName": "TestJob", "JobDescription": "for test", "Priority": "1", "Tasks": [{"TaskName": "Task1", "TaskInstanceNum": 1, "Application": {"DeliveryForm": "LOCAL", "Command": "python -c \\"fib=lambda n:1 if n<=2 else fib(n-1)+fib(n-2); print(fib(20))\\" "}, "ComputeEnv": {"EnvType": "MANAGED", "EnvData": {"InstanceType": "S1.SMALL1", "ImageId": "To be replaced" } }, "RedirectInfo": {"StdoutRedirectPath": "To be replaced", "StderrRedirectPath": "To be replaced"}, "MaxRetryCount": 1 } ] }' --Placement '{"Zone": "ap-guangzhou-2"}'
SubmitJob
command includes the following 3 parameters:Parameter | Description |
version | Version, which is fixed to 2017-03-12. |
Job | Job configuration (in JSON format). For more information, see the example. |
Placement | Availability zone for job execution. |
"ImageId": "To be replaced"
"StdoutRedirectPath": "To be replaced", "StderrRedirectPath": "To be replaced"
--Placement '{"Zone": "ap-guangzhou-2"}'
{"RequestId": "db84b7f8-ff8e-4c11-81c1-9a3b02652a46","JobId": "job-cr8qyyh9"}
$ tccli batch DescribeJob --version 2017-03-12 --JobId job-cr8qyyh9{"EndTime": "2019-10-08T07:28:07Z","JobState": "SUCCEED","TaskInstanceMetrics": {...},"Zone": "ap-guangzhou-2","TaskMetrics": {...},"JobName": "TestJob","Priority": 1,"RequestId": "0e5c5ea5-ef25-4f90-b355-cfaa8057d473","TaskSet": [{...}],"StateReason": null,"JobId": "job-cr8qyyh9","DependenceSet": [],"CreateTime": "2019-10-08T07:27:17Z"}
$ tccli batch DescribeJobs --version 2017-03-12
Was this page helpful?