Copied.
ma-cli dli-job Commands for Submitting DLI Spark Jobs
$ma-cli dli-job -h Usage: ma-cli dli-job [OPTIONS] COMMAND [ARGS]... DLI spark job submission and query job details. Options: -h, -H, --help Show this message and exit. Commands: get-job Get DLI spark job details. get-log Get DLI spark log details. get-queue Get DLI spark queues info. get-resource Get DLI resources info. stop Stop DLI spark job by job id. submit Submit dli spark batch job. upload Upload local file or OBS object to DLI resources.
Command |
Description |
---|---|
get-job |
Obtain DLI Spark jobs and their details. |
get-log |
Obtain runtime logs of a DLI Spark job. |
get-queue |
Obtain DLI queues. |
get-resource |
Obtain DLI group resources. |
stop |
Stop a DLI Spark job. |
submit |
Submit a DLI Spark job. |
upload |
Upload local files or OBS files to a DLI group. |
Using ma-cli dli-job get-job to Obtain a DLI Spark Job
Run the ma-cli dli-job get-job command to obtain the DLI Spark jobs or details about a job.
ma-cli dli-job get-job -h Usage: ma-cli dli-job get-job [OPTIONS] Get DLI Spark details. Example: # Get DLI Spark job details by job name ma-cli dli-job get-job -n ${job_name} # Get DLI Spark job details by job id ma-cli dli-job get-job -i ${job_id} # Get DLI Spark job list ma-cli dli-job get-job --page-size 5 --page-num 1 Options: -i, --job-id TEXT Get DLI Spark job details by job id. -n, --job-name TEXT Get DLI Spark job details by job name. -pn, --page-num INTEGER RANGE Specify which page to query. [x>=1] -ps, --page-size INTEGER RANGE The maximum number of results for this query. [x>=1] -v, --verbose Show detailed information about DLI Spark job details. -C, --config-file PATH Configure file path for authorization. -D, --debug Debug Mode. Shows full stack trace when error occurs. -P, --profile TEXT CLI connection profile to use. The default profile is "DEFAULT". -H, -h, --help Show this message and exit.
Parameter |
Data Type |
Mandatory |
Description |
---|---|---|---|
-i / --job-id |
String |
No |
ID of the DLI Spark job whose details are to be obtained. |
-n / --job-name |
String |
No |
Name of the DLI Spark job to be queried or name keyword used to filter DLI Spark jobs. |
-pn / --page-num |
Int |
No |
Page number. The default value is 1. |
-ps / --page-size |
Int |
No |
Number of jobs displayed on each page. The default value is 20. |
-v / --verbose |
Bool |
No |
Whether to display detailed information. It is disabled by default. |
Example: Obtain all DLI Spark jobs.
ma-cli dli-job get-job
Using ma-cli dli-job submit to Submit a DLI Spark Job
Run the ma-cli dli-job submit command to submit a DLI Spark job.
When running this command, use the YAML_FILE parameter to specify the path to the configuration file of the target job. If this parameter is not specified, the configuration file is empty. The configuration file is in YAML format, and its parameters are values of OPTIONS in the command. If you specify both the YAML_FILE and the OPTIONS parameters, the OPTIONS value will overwrite the same items in the configuration file.
Command parameters preview
ma-cli dli-job submit -h Usage: ma-cli dli-job submit [OPTIONS] [YAML_FILE]... Submit DLI Spark job. Example: ma-cli dli-job submit --name test-spark-from-sdk --file test/sub_dli_task.py --obs-bucket dli-bucket --queue dli_test --spark-version 2.4.5 --driver-cores 1 --driver-memory 1G --executor-cores 1 --executor-memory 1G --num-executors 1 Options: --file TEXT Python file or app jar. -cn, --class-name TEXT Your application's main class (for Java / Scala apps). --name TEXT Job name. --image TEXT Full swr custom image path. --queue TEXT Execute queue name. -obs, --obs-bucket TEXT DLI obs bucket to save logs. -sv, --spark-version TEXT Spark version. -st, --sc-type [A|B|C] Compute resource type. --feature [basic|custom|ai] Type of the Spark image used by a job (default: basic). -ec, --executor-cores INTEGER Executor cores. -em, --executor-memory TEXT Executor memory (eg. 2G/2048MB). -ne, --num-executors INTEGER Executor number. -dc, --driver-cores INTEGER Driver cores. -dm, --driver-memory TEXT Driver memory (eg. 2G/2048MB). --conf TEXT Arbitrary Spark configuration property (eg. <PROP=VALUE>). --resources TEXT Resources package path. --files TEXT Files to be placed in the working directory of each executor. --jars TEXT Jars to include on the driver and executor class paths. -pf, --py-files TEXT Python files to place on the PYTHONPATH for Python apps. --groups TEXT User group resources. --args TEXT Spark batch job parameter args. -q, --quiet Exit without waiting after submit successfully. -C, --config-file PATH Configure file path for authorization. -D, --debug Debug Mode. Shows full stack trace when error occurs. -P, --profile TEXT CLI connection profile to use. The default profile is "DEFAULT". -H, -h, --help Show this message and exit.
YAML file preview
# dli-demo.yaml name: test-spark-from-sdk file: test/sub_dli_task.py obs-bucket: ${your_bucket} queue: dli_notebook spark-version: 2.4.5 driver-cores: 1 driver-memory: 1G executor-cores: 1 executor-memory: 1G num-executors: 1 ## [Optional] jars: - ./test.jar - obs://your-bucket/jars/test.jar - your_group/test.jar ## [Optional] files: - ./test.csv - obs://your-bucket/files/test.csv - your_group/test.csv ## [Optional] python-files: - ./test.py - obs://your-bucket/files/test.py - your_group/test.py ## [Optional] resources: - name: your_group/test.py type: pyFile - name: your_group/test.csv type: file - name: your_group/test.jar type: jar - name: ./test.py type: pyFile - name: obs://your-bucket/files/test.py type: pyFile ## [Optional] groups: - group1 - group2
Example of submitting a DLI Spark job by specifying OPTIONS:
$ ma-cli dli-job submit --name test-spark-from-sdk \ --file test/sub_dli_task.py \ --obs-bucket ${your_bucket} \ --queue dli_test \ --spark-version 2.4.5 \ --driver-cores 1 \ --driver-memory 1G \ --executor-cores 1 \ --executor-memory 1G \ --num-executors 1
Parameter |
Data Type |
Mandatory |
Description |
---|---|---|---|
YAML_FILE |
String |
No |
Local path to the configuration file of a DLI Spark job. If this parameter is not specified, the configuration file is empty. |
--file |
String |
Yes |
Program entry file. It can be a local file path, an OBS path, or the name of a JAR or PyFile package that has been uploaded to the DLI resource management system. |
-cn / --class_name |
String |
Yes |
Java/Spark main class of the batch processing job. |
--name |
String |
No |
Specified job name. The value consists of a maximum of 128 characters. |
--image |
String |
No |
Path to a custom image in the format of "Organization name/Image name:Image version". This parameter is valid only when feature is set to custom. You can use this parameter with the feature parameter to specify a custom Spark image for running a job. |
-obs / --obs-bucket |
String |
No |
OBS bucket for storing a Spark job. Configure this parameter when you need to save jobs. It can also be used as a transit station for submitting local files to resources. |
-sv/ --spark-version |
String |
No |
Spark version used by a job. |
-st / `--sc-type |
String |
No |
If the current Spark version is 2.3.2, leave this parameter blank. If the current Spark version is 2.3.3, configure this parameter when feature is set to basic or ai. If this parameter is not specified, the default Spark version 2.3.2 will be used. |
--feature |
String |
No |
Job feature, indicating the type of the Spark image used by a job. The default value is basic.
|
--queue |
String |
No |
Queue name. Set this parameter to the name of a created DLI queue. The queue must be of the common type. For details about how to obtain a queue name, see Table 5. |
-ec / --executor-cores |
String |
No |
Number of CPU cores of each Executor in a Spark application. This configuration will replace the default setting in sc_type. |
-em / --executor-memory |
String |
No |
Executor memory of a Spark application, for example, 2 GB or 2048 MB. This configuration will replace the default setting in sc_type. The unit must be provided. Otherwise, the startup fails. |
-ne / --num-executors |
String |
No |
Number of Executors in a Spark application. This configuration will replace the default setting in sc_type. |
-dc / --driver-cores |
String |
No |
Number of CPU cores of the Spark application driver. This configuration will replace the default setting in sc_type. |
-dm / --driver-memory |
String |
No |
Driver memory of a Spark application, for example, 2 GB or 2048 MB. This configuration will replace the default setting in sc_type. The unit must be provided. Otherwise, the startup fails. |
--conf |
Array of String |
No |
batch configuration. For details, see Spark Configuration. To specify multiple parameters, use --conf conf1 --conf conf2. |
--resources |
Array of String |
No |
Name of a resource package, which can be a local file, OBS path, or a file that has been uploaded to the DLI resource management system. To specify multiple parameters, use --resources resource1 --resources resource2. |
--files |
Array of String |
No |
Name of the file package that has been uploaded to the DLI resource management system. You can also specify an OBS path, for example, obs://Bucket name/Package name. Local files are also supported. To specify multiple parameters, use --files file1 --files file2. |
--jars |
Array of String |
No |
Name of the JAR package that has been uploaded to the DLI resource management system. You can also specify an OBS path, for example, obs://Bucket name/Package name. Local files are also supported. To specify multiple parameters, use --jars jar1 --jars jar2. |
-pf /--python-files |
Array of String |
No |
Name of the PyFile package that has been uploaded to the DLI resource management system. You can also specify an OBS path, for example, obs://Bucket name/Package name. Local files are also supported. To specify multiple parameters, use --python-files py1 --python-files py2. |
--groups |
Array of String |
No |
Resource group name. To specify multiple parameters, use --groups group1 --groups group2. |
--args |
Array of String |
No |
Parameters passed to the main class, that is, program parameters. To specify multiple parameters, use --args arg1 --args arg2. |
-q / --quiet |
Bool |
No |
Whether to exit directly without printing the job status synchronously after a DLI Spark job is submitted. |
Example
- Submit a DLI Spark job using YAML_FILE.
$ma-cli dli-job submit dli_job.yaml
- Submit a DLI Spark job by specifying the OPTIONS parameter.
$ma-cli dli-job submit --name test-spark-from-sdk \ > --file test/jumpstart-trainingjob-gallery-pytorch-sample.ipynb \ > --queue dli_ma_notebook \ > --spark-version 2.4.5 \ > --driver-cores 1 \ > --driver-memory 1G \ > --executor-cores 1 \ > --executor-memory 1G \ > --num-executors 1
Using ma-cli dli-job get-log to Obtain Run Logs of a DLI Spark Job
Run the ma-cli dli-job get-log command to obtain the run logs of a DLI Spark job.
$ ma-cli dli-job get-log -h Usage: ma-cli dli-job get-log [OPTIONS] Get DLI spark job log details. Example: # Get job log by job id ma-cli dli-job get-log --job-id ${job_id} Options: -i, --job-id TEXT Get DLI spark job details by job id. [required] -C, --config-file TEXT Configure file path for authorization. -D, --debug Debug Mode. Shows full stack trace when error occurs. -P, --profile TEXT CLI connection profile to use. The default profile is "DEFAULT". -H, -h, --help Show this message and exit.
Parameter |
Data Type |
Mandatory |
Description |
---|---|---|---|
-i / --job-id |
String |
Yes |
ID of the DLI Spark job whose logs are to be obtained. |
Example: Obtain the run logs of a specified DLI Spark job.
ma-cli dli-job get-log --job-id ${your_job_id}
Using ma-cli dli-job get-queue to Obtain a DLI Queue
Run the ma-cli dli-job get-queue command to obtain a DLI queue.
ma-cli dli-job get-queue -h Usage: ma-cli dli-job get-queue [OPTIONS] Get DLI queues info. Example: # Get DLI queue details by queue name ma-cli dli-job get-queue --queue-name $queue_name} Options: -pn, --page-num INTEGER RANGE Specify which page to query. [x>=1] -ps, --page-size INTEGER RANGE The maximum number of results for this query. [x>=1] -n, --queue-name TEXT Get DLI queue details by queue name. -t, --queue-type [sql|general|all] DLI queue type (default "all"). -tags, --tags TEXT Get DLI queues by tags. -C, --config-file PATH Configure file path for authorization. -D, --debug Debug Mode. Shows full stack trace when error occurs. -P, --profile TEXT CLI connection profile to use. The default profile is "DEFAULT". -H, -h, --help Show this message and exit.
Parameter |
Data Type |
Mandatory |
Description |
---|---|---|---|
-n / --queue-name |
String |
No |
Name of the DLI queue to be obtained. |
-t / --queue-type |
String |
No |
Type of the DLI queue to be obtained. The value can be sql, general, or all. The default value is all. |
-tags / --tags |
String |
No |
Tags of the DLI queue to be obtained. |
-pn / --page-num |
Int |
No |
DLI queue page number. The default value is 1. |
-ps / --page-size |
Int |
No |
Number of DLI queues displayed on each page. The default value is 20. |
Example: Query information about the queue named dli_ma_notebook.
ma-cli dli-job get-queue --queue-name dli_ma_notebook
Using ma-cli dli-job get-resource to Obtain DLI Group Resources
Run the ma-cli dli-job get-resource command to obtain details about DLI resources, such as the resource name and resource type.
$ ma-cli dli-job get-resource -h Usage: ma-cli dli-job get-resource [OPTIONS] Get DLI resource info. Example: # Get DLI resource details by resource name ma-cli dli-job get-resource --resource-name ${resource_name} Options: -n, --resource-name TEXT Get DLI resource details by resource name. -k, --kind [jar|pyFile|file|modelFile] DLI resources type. -g, --group TEXT Get DLI resources by group. -tags, --tags TEXT Get DLI resources by tags. -C, --config-file TEXT Configure file path for authorization. -D, --debug Debug Mode. Shows full stack trace when error occurs. -P, --profile TEXT CLI connection profile to use. The default profile is "DEFAULT". -H, -h, --help Show this message and exit.
Parameter |
Data Type |
Mandatory |
Description |
---|---|---|---|
-n / --resource-name |
String |
No |
Resource name of the DLI group resources to be queried. |
-k / --kind |
String |
No |
Resource type of the DLI group resources to be queried. The type can be JAR, PyFile, file, or modelFile. |
-g / --group |
String |
No |
Group name of the DLI group resources to be queried. |
-tags / --tags |
String |
No |
Tags of the DLI group resources to be queried. |
Example: Obtain information about all DLI group resources.
ma-cli dli-job get-resource
Using ma-cli dli-job upload to Upload Files to a DLI Group
Run the ma-cli dli-job upload command to upload local files or OBS files to a DLI group.
$ ma-cli dli-job upload -h Usage: ma-cli dli-job upload [OPTIONS] PATHS... Upload DLI resource. Tips: --obs-path is need when upload local file. Example: # Upload an OBS path to DLI resource ma-cli dli-job upload obs://your-bucket/test.py -g test-group --kind pyFile # Upload a local path to DLI resource ma-cli dli-job upload ./test.py -g test-group -obs ${your-bucket} --kind pyFile # Upload local path and OBS path to DLI resource ma-cli dli-job upload ./test.py obs://your-bucket/test.py -g test-group -obs ${your-bucket} Options: -k, --kind [jar|pyFile|file] DLI resources type. -g, --group TEXT DLI resources group. -tags, --tags TEXT DLI resources tags, follow --tags `key1`=`value1`. -obs, --obs-bucket TEXT OBS bucket for upload local file. -async, --is-async whether to upload resource packages in asynchronous mode. The default value is False. -C, --config-file TEXT Configure file path for authorization. -D, --debug Debug Mode. Shows full stack trace when error occurs. -P, --profile TEXT CLI connection profile to use. The default profile is "DEFAULT". -H, -h, --help Show this message and exit.
Parameter |
Data Type |
Mandatory |
Description |
---|---|---|---|
PATHS |
String |
Yes |
Paths to the local files or OBS files to be uploaded to a DLI group. Multiple paths can be specified at a time. |
-k / --kind |
String |
No |
Type of the file to be uploaded, which can be JAR, PyFile, or file. |
-g / --group |
String |
No |
Name of the DLI group to which files are to be uploaded. |
-tags / --tags |
String |
No |
Tag of the files to be uploaded. |
-obs / --obs-bucket |
String |
No |
If the files to be uploaded contain a local path, specify an OBS bucket for transit. |
-async / --is-async |
Bool |
No |
Whether to asynchronously upload files. This method is recommended. |
Example
- Upload local files to a DLI group.
ma-cli dli-job upload ./test.py -obs ${your-bucket} --kind pyFile
- Upload OBS files to a DLI group.
ma-cli dli-job upload obs://your-bucket/test.py --kind pyFile
Using ma-cli dli-job stop to Stop a DLI Spark Job
Run the ma-cli dli-job stop command to stop a DLI Spark job.
$ ma-cli dli-job stop -h Usage: ma-cli dli-job stop [OPTIONS] Stop DLI spark job by job id. Example: Stop training job by job id ma-cli dli-job stop --job-id ${job_id} Options: -i, --job-id TEXT Get DLI spark job event by job id. [required] -y, --yes Confirm stop operation. -C, --config-file TEXT Configure file path for authorization. -D, --debug Debug Mode. Shows full stack trace when error occurs. -P, --profile TEXT CLI connection profile to use. The default profile is "DEFAULT". -H, -h, --help Show this message and exit.
Parameter |
Data Type |
Mandatory |
Description |
---|---|---|---|
-i / --job-id |
String |
Yes |
DLI Spark job ID |
-y / --yes |
Bool |
No |
Whether to forcibly stop a specified DLI Spark job |
Example
ma-cli dli-job stop -i ${your_job_id}
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot