跳到主要内容

任务命令:job

bohr job 用于管理 Bohrium 计算任务。后续查看、下载、停止或删除任务时,请使用 bohr job listBOHR_ID 列显示的 Bohr ID

提示:提交新任务推荐使用 Batch Job,参见批处理任务,运行 bohr batchjob submit 即可。旧的 Job 模块仍可使用,后续将逐步过渡到 Batch Job。

命令

命令用法说明
listbohr job list [flags]查询和筛选任务
submitbohr job submit [flags]提交任务
describebohr job describe [flags]查看任务或任务组详情
logbohr job log <bohr_id>... [flags]下载日志文件
downloadbohr job download <bohr_id>... [flags]下载结果文件
terminatebohr job terminate <bohr_id>... [flags]优雅终止任务
killbohr job kill <bohr_id>... [flags]强制停止任务
deletebohr job delete <bohr_id>... [flags]删除任务

还提供适合 Agent 的快捷命令:+submit+watch+cancel

查询任务

bohr job list -n 20
bohr job list --running -o json
bohr job list -j 1022 --fail

常用筛选参数包括 -j, --job_group_id-n, --number--pending-r, --running-i, --finish-f, --fail-s, --scheduling-t, --stopping-d, --stopped

使用全局输出参数选择结构化格式:

bohr job list --output yaml

提交任务

使用 JSON 配置文件:

bohr job submit -i job.json --input_directory ./input

也可以直接传入参数:

bohr job submit \
--project_id 123 \
--machine_type c2_m4_cpu \
--image_address registry.dp.tech/dptech/ubuntu:22.04 \
--command "python main.py" \
--input_directory ./input

关键参数:

参数说明
-i, --config_fileJSON 配置文件
--input_directory本地输入目录;没有 -p 缩写
--project_idBohrium 项目 ID
-m, --image_address镜像地址
-t, --machine_type机型;可用 bohr machine list -c all 查询
-c, --command任务执行命令
-g, --job_group_idbohr job_group create 创建的分组
-r, --result_path/personal/share 下的 Bohrium 远端路径,不是本地路径
--max_run_time最大运行时间,单位为分钟
--nnode计算节点数,默认 1

提交任务可能创建计费资源。CLI 会要求确认;可以先用 --dry-run 校验而不提交。

查看与下载

bohr job describe -i 20143720 -o json
bohr job log 20143720 --out ./logs
bohr job download 20143720 --out ./results

logdownload 使用 --out 指定本地目录。-o 专用于全局输出格式。

停止或删除任务

bohr job terminate 20143720
bohr job kill 20143720
bohr job delete 20143720

killdelete 是破坏性操作,需要确认。自动化执行前建议先使用 --dry-run