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

Running Remote Package

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2024-01-13 11:19:29

Scenario

Batch allows you to acquire a code package from a .tgz file via HTTP. You can compress the code and upload it to COS. This helps you organize the code more conveniently than using LOCAL mode.

Prerequisites

Complete preparations based on the instructions in Preparation, and learn how to configure the general part of the custom information.

Steps

Viewing the Demo

Note:
Modify the general part of the custom information in 2_RemoteCodePkg.py based on the instructions in Preparation.
Open the 2_RemoteCodePkg.py file in an editor.
# custom (Change to your info)
imageId = "img-m4q71qnf"
Application = {
"DeliveryForm": "PACKAGE",
"Command": "python ./codepkg/fib.py",
"PackagePath": "http://batchdemo-xxxxxxxxx.cos.ap-guangzhou.myqcloud.com/codepkg/codepkg.tgz"
}
StdoutRedirectPath = "your cos path"
StderrRedirectPath = "your cos path"
All information except Application in the general part is described in Preparation. Set the parameters of Application based on the following table.
Configuration Item
Description
DeliveryForm
Three delivery methods of applications are available: software packaging, container image, and direct running within the CVM. In this case, PACKAGE indicates software packaging.
PackagePath
Address of the .tgz software package in HTTP. Batch downloads the software package to a directory of the scheduled CVM and runs `Command` in the directory.
Command
Task startup command. In this case, a Python script file in the software package is directly called. You can download the package, and view the file structure and content in it.
fib.py is composed as below:
fib = lambda n:1 if n<=2 else fib(n-1)+fib(n-2)
print("Remote Code Package : %d"%(fib(20)))

Submitting a Job

Run the following command to run the Python script. The demo encapsulates the job submission process by using Python scripts and the Batch command line tool.
python 2_RemoteCodePkg.py
The returned result is as follows, indicating that the job is successfully submitted:
{
"RequestId": "c09e9291-2661-xxxx-8783-72d36f91ec8a",
"JobId": "job-7xxxx26l"
}
If the submit operation fails, check the returned value or Contact Us.

Viewing State

See Viewing State in Quick Start.

Viewing the Result

1. See Viewing the Result in Quick Start.
2. The execution result of 2_RemoteCodePkg.py is as follows:
Remote Code Package : 6765


도움말 및 지원

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

피드백