跳到主要内容

任务管理命令:job

查询:ls

入口:

lbg job ls

概要:

usage: lbg job ls [-h] [-i INDEX] [-jg JOB_GROUP_ID] [-fa] [-pe] [-ru] [-fi] [-sc] [-st] [-sp]
[-q] [--csv] [--json] [--yaml] [--table] [--noheader] [-n NUMBER]

options:
-h, --help show this help message and exit
-i INDEX, --index INDEX
index of job group, default is 0, which use id of job group in rank n,
disable if job group id is specified
-jg JOB_GROUP_ID, --job_group_id JOB_GROUP_ID
job group id
-fa, --fail only show failed job
-pe, --pending only show pending job
-ru, --running only show running job
-fi, --finished only show finished job
-sc, --scheduling only show scheduling job
-st, --stopping only show stopping job
-sp, --stopped only show stopped job
-q, --quiet only show job id
--csv output with csv format
--json output with json format
--yaml output with yaml format
--table output with table format
--noheader does not print header information
-n NUMBER, --number NUMBER
number of result to be display, default all

参数说明:

参数缩写说明必填
--index-i显示第n个job group下的所有job,默认为0(即为最新的job group)。当job group被指定时此项失效
--job_group_id-jg显示job group id下的任务
--fail-fa只显示失败的任务
--pending-pe只显示等待中的任务
--running-ru只显示运行中的任务
--finish-fi只显示完成的任务
--scheduling-sc只显示调度中的任务
--stopping-st只显示暂停中的任务
--stopped-sp只显示已暂停的任务
--quiet-q只显示Job ID
--number-n显示多少个job

案例:

lbg job ls -i 5 --yaml # 查看第5个job group下所有job并输出为yaml格式
lbg job ls -jg 1022 -fi # 查看1022 Job Group下的所有已完成的Job

提交:submit

入口:

lbg job submit

概要:

usage: lbg job submit [-h] [-i FILE] [-p INPUT] [-jt JOB_TYPE] [-jgid JOB_GROUP_ID]
[-pjid PROJECT_ID] [-n JOB_NAME] [-im IMAGE_NAME] [-ds DISK_SIZE]
[-sc SCASS_TYPE] [-mt MACHINE_TYPE] [-nn NNODE] [-igid INSTANCE_GROUP_ID]
[-c CMD] [-l LOG_FILE] [-o [OUT_FILES]] [-pf PLATFORM] [-r REGION]
[-odm ON_DEMAND] [-ckptt CHECKPOINT_TIME] [-ckptf [CHECKPOINT_FILES]] [-dpb]
[-oji] [-ojgi]

options:
-h, --help show this help message and exit
-i FILE, --file FILE predefined file
-p INPUT, --input INPUT
input file location
-jt JOB_TYPE, --job_type JOB_TYPE
indicate/container
-jgid JOB_GROUP_ID, --job_group_id JOB_GROUP_ID
job group id
-pjid PROJECT_ID, --project_id PROJECT_ID
project id, will overwrite default
-n JOB_NAME, --job_name JOB_NAME
name
-im IMAGE_NAME, --image_name IMAGE_NAME
image name
-ds DISK_SIZE, --disk_size DISK_SIZE
disk size (GB)
-sc SCASS_TYPE, --scass_type SCASS_TYPE
scass type
-mt MACHINE_TYPE, --machine_type MACHINE_TYPE
machine type
-nn NNODE, --nnode NNODE
nnode
-igid INSTANCE_GROUP_ID, --instance_group_id INSTANCE_GROUP_ID
instance group id
-c CMD, --cmd CMD command
-l LOG_FILE, --log_file LOG_FILE
log file location
-r RESULT, --result RESULT
download result
-o [OUT_FILES], --out_files [OUT_FILES]
log file location
-pf PLATFORM, --platform PLATFORM
ali/sugon
-rg REGION, --region REGION
region name
-odm ON_DEMAND, --on_demand ON_DEMAND
0:spot(default) 1:on_demand
-ckptt CHECKPOINT_TIME, --checkpoint_time CHECKPOINT_TIME
checkpoint time (minute)
-ckptf [CHECKPOINT_FILES], --checkpoint_files [CHECKPOINT_FILES]
checkpoint file
-dpb, --disable_progress
disable progress bar
-oji, --only_job_id only show job id
-ojgi, --only_job_group_id
only show job id

参数缩写必填说明
--file-i配置预定义文件,如果相同字段在命令行声明则会替换
--job_type-jt任务类型,该参数仅对platform为ali生效,默认值为indicate,表示虚拟机类型任务。该参数取值包括:
  • indicate:虚拟机类型
  • container:容器类型
  • --input-p输入文件,例如:-p ./ 表示当前目录
    --result-r结果文件自动下载至指定目录,注:数据仅支持自动下载至 data 盘,参数 -r 后指定路径请以 /data 开头
    --job_group_id-jgidjob分组id
    --project_id-pjid项目id, 是您创建的项目ID,可在项目管理中查看
    --name-njob名称
    --image_name-im镜像名称, 根据任务类型不同,可能为虚拟机镜像名称或容器镜像名称
    --disk_size-ds所需磁盘大小
    --machine_type-mt实例配置
    --nnode-nn需要同时开多少个计算节点,并行执行
    --instance_group_id-igid镜像名称, 根据任务类型不同,可能为虚拟机镜像名称或容器镜像名称
    --command-c任务执行命令
    --log_file-l任务日志路径
    --backward_files-o任务运行结束后回收的文件,填空则全部回收
    --platform-pf任务提交到哪个平台
    --region-rg任务提交到哪个地区
    --on_demand-odm是否使用抢占式
  • 0: 使用抢占式
  • 1: 使用按量付费
  • --checkpoint_time-ckptt续算文件同步时间,最低为15分钟
    --checkpoint_files-ckptf续算文件名称
    --disable_progress-dpg上传时不显示进度条
    --only_job_id-oji提交完成后只显示job id
    --only_job_group_id-ojgi提交完成后只显示job group id

    案例:

    lbg job submit -i job.json -p ./input # 使用job.json下的文件并用input目录下的文件当作输入

    --file -i json文件示例

    {
    "job_name": "DeePMD-kit test",
    "command": "cd se_e2_a && dp train input.json > tmp_log 2>&1 && dp freeze -o graph.pb",
    "log_file": "se_e2_a/tmp_log",
    "out_files": ["se_e2_a/lcurve.out","se_e2_a/graph.pb"],
    "platform": "ali",
    "disk_size": 200,
    "machine_type": "c4_m15_1 * NVIDIA T4",
    "image_name": "registry.dp.tech/dptech/deepmd-kit:2.1.5-cuda11.6"
    }

    删除:rm

    入口:

    lbg job rm

    概要:

    usage: lbg job rm [-h] [-f] job_ids [job_ids ...]

    positional arguments:
    job_ids id of the job

    options:
    -h, --help show this help message and exit
    -f, --force force delete job

    参数说明:

    参数缩写说明必填
    --force-f不询问则删除
    --job_ids-删除的job id

    案例:

    $ lbg job rm 1235 2312 # 删除ID为1235和2312的任务

    提前终止:terminate

    入口:

    lbg job terminate

    概要:

    usage: lbg job terminate [-h] [-f] job_ids [job_ids ...]

    positional arguments:
    job_ids id of the job

    options:
    -h, --help show this help message and exit
    -f, --force force terminate job

    参数说明:

    参数缩写说明必填
    --force-f不询问
    --job_ids-提前终止的job id

    案例:

    $ lbg job terminate 1235 2312 # 提前终止ID为1235和2312的任务

    停止:kill

    入口:

    lbg job kill

    概要:

    usage: lbg job kill [-h] [-f] job_ids [job_ids ...]

    positional arguments:
    job_ids id of the job

    options:
    -h, --help show this help message and exit
    -f, --force force kill job

    参数说明:

    参数缩写说明必填
    --force-f不询问则停止
    --job_ids-停止的job id

    案例:

    $ lbg job kill 1235 2312 # 停止ID为1235和2312的任务

    日志:log

    入口:

    lbg job log

    概要:

    usage: lbg job log [-h] [-f] job_ids [job_ids ...]

    positional arguments:
    job_ids id of the job

    options:
    -h, --help show this help message and exit

    案例:

    $ lbg job log 1235 # 查看Job ID 1235的日志

    下载:download

    入口:

    lbg job download

    概要:

    usage: lbg job download [-h] [-p PATH] [-pr] job_ids [job_ids ...]

    positional arguments:
    job_ids id of the job

    options:
    -h, --help show this help message and exit
    -p PATH, --path PATH download location default current dir
    -pr, --parent create parent dir if needed

    参数说明:

    参数缩写说明必填
    --parent-pr创建父目录如果父目录不存在
    --path-p下载到指定目录,默认为当前目录

    案例:

    $ lbg job download 1235 2312 # 下载Job ID 1235和2312的文件

    查看详情:describe

    入口:

    lbg job describe

    概要:

    usage: lbg job describe [-h] [--csv] [--json] [--yaml] [--table] [--noheader] job_id [job_id ...]

    positional arguments:
    job_id id of the job

    options:
    -h, --help show this help message and exit
    --csv output with csv format
    --json output with json format
    --yaml output with yaml format
    --table output with table format
    --noheader does not print header information

    案例:

    $ lbg job describe 1235 2312 --yaml # 显示 Job ID 1235 2312的详情并以yaml格式显示