tencent cloud

Tencent Cloud DataBuddy

Python File Tasks

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-10-09 16:12:35
AI 번역
A Python File task is used to schedule and run .py files in Studio within a Workflow. The execution path is similar to that of a Notebook task, but the file granularity is a single Python script, making it suitable for engineering scenarios such as modular code, script jobs, and Python package entry points.

Overview

Dimension
Notebook task
Python File task
File Type
.ipynb
.py
Running Mode
Organized by cell and executed in order
Run entire file
Scenario
Interactive development and ML experiments
Engineering scripts and production jobs
Data Interaction Capability
Full DLCUtils module support
Full DLCUtils module support
Resource mode
Distributed / Single-node
Distributed / Single-node
For general configurations (task name, upstream dependencies, run conditions, parameters, monitoring metrics, alarms, and failure and timeout policies), see Task General Configuration.

Prerequisites

The workspace is bound to available compute resources that support CPU compute types, as well as distributed and single-node resource modes. For more information, see Compute Resource Overview.
The target Python file already exists in Studio, and the current user (or Run As account) has Run permission or higher.
If you use a Git reference, the workspace must have a Git connection configured.

Operation Steps

Step 1: Creating a Job

1. On the workflow canvas, click + Add Task.
2. Select Python File as the task type.

Step 2: Configuring Basic Information

Parameter
Description
Required
Task Name
Unique within the same workflow.
Yes
Task type
Python File. You can switch to other task types from the dropdown list. After switching, the parameter area will be cleared.
Yes
Task Sources
Workspace / Git.
Yes
Path
Path of the referenced .py file.
Yes

Step 3: Selecting a Python File

The operation is the same as that for a Notebook task. For details, see Step 3: Select a Notebook File in Notebook Task. The file selector displays only .py files.

Step 4: Configuring Compute Resources

Parameter
Description
Required
Default Value
Computing Resource
Displays the compute resources bound to and available in the current workspace in a drop-down list.
Yes
None (User-Selected)
Resource mode
Distributed / Single-node.
Yes
Resource mode of the file in Studio when the file is first configured; defaults to "Distributed" when the file is referenced from Git.
Resource Configuration
Default configuration / Custom configuration (CPU mode). GPU configuration for Python File tasks is not available in this release.
Yes
Default Configuration
The specific configuration items are the same as those in Step 4: Configure Compute Resources of a Notebook task, with the following differences:
Difference
Description
GPU configuration
Python File tasks do not support GPU resource configuration.
Basic environment
The workflow frontend does not have this configuration item. If it is already configured in Studio, the backend directly reuses it; otherwise, the default configuration is used.
Dependency library
The workflow frontend does not have this configuration item. If it is already configured in Studio, it is reused; otherwise, it is submitted as empty.

Step 5: Upstream Dependencies, Parameters, Monitoring Metrics, Alarms, and Failure and Timeout Policies

Step 6: Saving

Click Create Task or Save Task.

Parameter Description

Path Example

Source
Example
Workspace
/Workspace/your_username/etl_pipeline.py
Workspace (Git Folder)
/GitFolder/your_username/etl.py
Git remote repository
scripts/etl/main.py

Running Models

For tasks that use a Serverless resource group, the base environment and dependencies configured for the Python file in Studio are automatically installed before the task runs.
The entire file is executed in a manner equivalent to python file.py. Variables are not retained after the run ends.
The dlcutils library is available in Python File tasks, and its behavior is consistent with that in Notebook.

Use Limits

The compute resource is selected by the user during task configuration and must have the required permissions to run.
GPU resource configuration is not supported for Python File tasks (current limitation).
File execution does not support cell-level interaction. To debug code section by section, use a Notebook file instead.
The Git path is not validated at configuration time. It must be saved and then verified through a debug run.

FAQs

Q1: Why can I select a GPU image in Studio, but cannot configure a GPU for a Python File task in Workflow? GPU configuration is not available for Python File tasks in the current release. If you need GPU training, use a Notebook task or a Ray task instead.
Q2: Can I call dlcutils.notebook.run in a Python file to trigger a Notebook? Yes. Use the following in a Python file:
result = dlcutils.notebook.run('/path/to/another.ipynb', 60)
print(result)
Q3: Is cross-file import supported? Yes. .py files in the same directory or Git folder can be imported by using the standard import statement. For details, see "Step 3: Cross-File References" in Python IDE Basic Operations.

References

도움말 및 지원

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

피드백