Skip to main content

提交作业

请求方式:POST

https://www.bkunyun.com/c3ce/cloud-bursting/job

Body Attributes(Body属性)

ParameterRequiredTypeDescription
envsobject自定义环境变量
jobNameString作业名称
masterIdString主节点id
requestIdString请求Id可以被用来查询提交作业结果。若请求Id为空,则本次请求会提交新的作业。
slurmCommandString经过Base64编码后的提交作业命令
pre-hook.scriptString预处理脚本路径
pre-hook.argsarray预处理脚本参数
lifecycle-hook.scriptString作业lifecycle脚本路径
lifecycle-hook.argsString作业lifecycle脚本参数
lifecycle-hook.conditionarray作业lifecycle脚本执行条件,默认为ONCOMPLETE。可选值: ALWAYS-总是执行 ONRUNNING-作业开始执行 ONCANCELLED-作业取消 ONCOMPLETED-作业完成 ONFAILED-作业执行失败
post-hook.scriptString后置处理脚本脚本路径
post-hook.argsString后置处理脚本参数
post-hook.conditionarray后置处理脚本执行条件,默认为ONCOMPLETE。可选值: ALWAYS-总是执行 ONCANCELLED-作业取消 ONCOMPLETED-作业完成 ONFAILED-作业执行失败

Request(请求)

Headers(HTTP头) 注: 请首先联系Cloudam获取API Token,token相当于密码,请妥善保护。

主要事项:

  1. 同一个管理节点不能提交多个同样的jobname 作业
  2. masterId查看方式
  3. slurmCommand bash64编码转换
{
"Authorization": "Bearer ${token}",
"Content-Type": "application/json"
}

Body(请求体JSON)

{
"envs": {
"workDir": "/home/cloudam/yinfo/jobs/123",
"inputDir": "oss://path/to/input",
"outputDir": "oss://path/to/output"
},
"jobName": "myJob",
"masterId": "63a91e9a14203f0001461c5f",
"requestId": "",
"slurmCommand": "IyEvYmluL2Jhc2gKc2JhdGNoIC1wIGctdjEwMC0xIC1uIDEwIC1jIDEgIC9ob21lL2Nsb3VkYW0vZ3JvbWFjcy5zaA==",
"pre-hook": {
"script": "/home/cloudam/yinfo/download-input-files.sh",
"args": ["arg1", "arg2"]
},
"lifecycle-hook": {
"script": "/home/cloudam/job-status-change.sh",
"args": ["arg1", "arg2"],
"condition": ["ONRUNNING"]
},
"post-hook": {
"script": "/home/cloudam/post-execution.sh",
"args": ["arg1", "arg2"],
"condition": ["ALWAYS"]
}
}

Response(响应) - 200

Headers(响应头)

{
"Content-Type": "application/json"
}

Body(响应体JSON) -- 正确响应

{
"errorCode": "0",
"status": "DONE",
"message": "Success",
"jobId": "22",
"requestId": "123"
}

Response Body Attributes(响应Body属性)

AttributeTypeDescription
statusString作业提交请求状态,DONE 已完成;RUNNING 执行中
errorCodeString错误代码,0表示成功
jobIdString当status的值为DONE且成功提交作业时返回作业id,否则返回空字符串
requestIdString本次请求id
messageString错误信息描述