Manage PAI resources from the command line. PAI CLI supports DSW instance management, DLC distributed training, resource quota management, and other operations. Use the command reference, global parameters, override flags, and exit codes to automate workflows.
Commands
|
Command |
Description |
Documentation |
|
|
Manage interactive modeling (DSW) instances |
|
|
|
Manage distributed training jobs |
|
|
|
Manage resource quotas |
|
|
|
Manage datasets |
|
|
|
Manage images |
|
|
|
Manage workspaces |
|
|
|
Invoke OpenAPI |
|
|
|
Generate shell completion scripts |
|
|
|
Manage configuration |
Global parameters
The following parameters apply to all commands and can be placed anywhere in the command line.
|
Parameter |
Type |
Default |
Description |
|
|
string |
Profile setting |
Override the region, such as cn-hangzhou, cn-shanghai, or cn-wulanchabu |
|
|
string |
default |
Specify a configuration profile for switching between accounts |
|
|
string |
table |
Output format: |
|
|
bool |
false |
Print HTTP request and response debug information |
For scripting, use -o json and parse the output with jq. Example: pai dsw instance list -o json | jq '.[].instance_id'. To get only IDs, use -o quiet instead: pai dsw instance list -o quiet prints one instance ID per line.
--override request body editing
For write commands that accept a configuration file or request body, use the --override family of flags to modify fields before submission, without copying the configuration file for each run. This is equivalent to manually editing the file before submission. Argument precedence rules are unchanged.
|
Parameter |
Description |
|
|
Modify a value in the request body. Can be specified multiple times. The type is determined by the original value being replaced. An entire list or object can be replaced with a same-shaped JSON value (also a way to add new elements). Quoted paths with subscripts are supported: |
|
|
Same as --override, but always writes a string value |
|
|
Remove a value from the request body. Can be specified multiple times |
Supported commands: dlc job submit, dsw instance create / update / apply / render, resource quota write commands, and pai api.
# Same configuration, change the instance type and apply (applied changes are logged to stderr)
pai dsw instance apply -f team-env.yaml --override EcsSpec=ecs.gn7i-c16g1.4xlarge
# Modify nested fields + remove fields
pai dlc job submit --body-json @job.json \
--override DisplayName=bert-lr001 --override-unset Priority
Each effective modification prints a line to stderr: [info] applied to the body: PATH old -> new. This audit information doesn't pollute stdout.
Exit codes
|
Exit code |
Meaning |
Typical scenario |
|
0 |
Success |
The command completed successfully (including --dry-run previews) |
|
1 |
Resource not found |
The specified instance, job, service, or quota doesn't exist |
|
2 |
Argument error |
A required parameter is missing, a parameter format is invalid, the subcommand is unknown, or the --output value is unrecognized |
|
3 |
Authentication or permission error |
Invalid credentials, insufficient RAM permissions, or unauthorized service (checked before 404) |
|
4 |
Server or runtime error |
The API returned a 5xx error, the network connection failed, the target service is unreachable, or the operation timed out |
|
5 |
Confirmation required |
A high-risk write operation was run without |
Exit codes are a stable contract for scripts and agents. Error details are output to stderr as a {"error","message","hint"} JSON envelope with -o json. Stdout stays clean.