tencent cloud

Batch Compute

Product Introduction
What's Batch?
Scenarios
Strengths
Glossary
Quota & Limits
Data Security
Purchase Guide
Getting Started
Preparation
Using CLI - Submit a Job
Using CLI - Compute Environment
Configuring a Job
Using Console
Console User Guide
Task Template Management
Job Management
User Guide
How to create images usable by BatchCompute
Windows Custom Images
Environment Variables
Entering COS & CFS Paths
Event Notice & Callback
Cloud Access Management
Command Line Interface
Preparation
Quick Start
Running Remote Package
Mapping Remote Storage
Use Cases
Building Cluster Using Compute Environment
Example: 3ds Max 2018 Rendering
Example: Deep Learning
API Documentation
History
Introduction
API Category
Making API Requests
Compute Environment APIs
Configuration Viewing-related APIs
Task Template-related APIs
Job-related APIs
Data Types
Error Codes
SDK Documentation
Instructions
FAQs
Contact Us
Glossary

Preparation

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2025-08-29 15:20:06
Before installing TCCLI, make sure that your system has the Python environment installed. For details, see prerequisites instructed in Installing TCCLI.

Step 1: Installing TCCLI

Installing TCCLI

Run commands based on the actual situation.
TCCLI not installed Run the following command to quickly install TCCLI via pip. For details, please see Installing TCCLI.
$ sudo pip install tccli
TCCLI installed Run the following command to quickly upgrade TCCLI through pip:
$ sudo pip install --upgrade tccli

Verifying installation

Run the following command to check whether TCCLI is successfully installed and has Batch-related capabilities:
tccli batch help
The returned result is as follows, indicating that TCCLI is successfully installed:
NAME
batch
DESCRIPTION
batch-2017-03-12
USEAGE
tccli batch <action> [--param...]
OPTIONS
help
show the tccli batch help info
--version
specify a batch api version
AVAILABLE ACTION
DescribeComputeEnv
Used to query details of the computing environment
CreateTaskTemplate
Used to create a task template

Step 2: Configuring TCCLI

1. Log in to the API Key Management.
2. Click Create Key or use an available key to record SecretID and SecretKey. See the figure below:


3. Run the command tccli configure and enter the TCCLI configuration information. For details, please see Configuring TCCLI.
$ tccli configure
TencentCloud API secretId[None]:
TencentCloud API secretKey[None]:
region[None]:
output[json]:

Step 3: Preparing the COS Directory

Creating a bucket and sub-folders

1. Log in to the COS console and choose Bucket List in the left sidebar.
2. Create a bucket and create 3 folders in the bucket. See the figure below:


1. Click Basic Configuration on the left to view the endpoint in Basic Information. See the figure below:


2. Acquire the endpoints of subfolders in the COS bucket.
Note:
Acquire COS-related endpoints based on the actual situation.
The acquired COS bucket endpoint is https://batchdemo-xxxxxxxxx.cos.ap-guangzhou.myqcloud.com. The endpoints of the three folders created in Creating a Bucket and Sub-folders can be acquired by combining domain and sub-folder names as follows:
cos://batchdemo-xxxxxxxxx.cos.ap-guangzhou.myqcloud.com/logs/
cos://batchdemo-xxxxxxxxx.cos.ap-guangzhou.myqcloud.com/input/
cos://batchdemo-xxxxxxxxx.cos.ap-guangzhou.myqcloud.com/output/

Step 4: Downloading the Demo File

Access the Batch demo, download the test package, and decompress it.
Note:
The demo is provided in the format of the Python+Batch CLI. Since BatchCompute has many capabilities and configuration items, you can work with it more conveniently by using Python scripts.

Step 5: Modifying Demo Custom Information

Note:
Change the general part of the custom information about the Batch demo. Modify all files in Demo as follows:
Use the following custom information in 1_SimpleStart.py as an example:
# custom (Change to your info)
imageId = "img-m4q71qnf"
Application = {
"DeliveryForm": "LOCAL",
"Command": " python -c \\"fib=lambda n:1 if n<=2 else fib(n-1)+fib(n-2); print(fib(20))\\" "
}
StdoutRedirectPath = "cos://batchdemo-xxxxxxxxxx.cos.ap-guangzhou.myqcloud.com/logs/"
StderrRedirectPath = "cos://batchdemo-xxxxxxxxxx.cos.ap-guangzhou.myqcloud.com/logs/"
The following table lists the information to be modified.
Configuration Item
Description
imageId
Custom images are created based on this image. For more information, see Windows Custom Image.
StdoutRedirectPath
Enter the complete log folder endpoint acquired in Acquiring COS-related endpoints.
StderrRedirectPath
Application
The startup command. Use the default setting.
cmd = "tccli batch SubmitJob \\
--version 2017-03-12 \\
--Placement '{\\"Zone\\": \\"ap-guangzhou-6\\"}' \\
--Job ' %s ' "%(json.dumps(testJob))
The demo specifies Guangzhou Zone 6 for resource application. You can select the corresponding availability zone to apply for resources based on the default region configured in TCCLI.
For more information about regions and availability zones, see Regions and AZs.

Step 6: Testing

Experience the Batch usage methods and computing capability in the following sequence according to the reference course.
1. 1_SimpleStart.py: Quick Start
2. 2_RemoteCodePkg.py: Running Remote Package
3. 3_StoreMapping.py: Mapping Remote Storage


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백