重启作业
更新时间:
接口
startJob
参数
| 参数 | 类型 | 是否必选 | 说明 |
|---|---|---|---|
| jobId | String | 是 | 作业ID |
返回值
启动成功后返回一个 StartJobResponse 实例;启动失败后,抛出异常: ClientException 。
例子
Java 源码
import com.aliyuncs.batchcompute.main.v20151111.*;import com.aliyuncs.batchcompute.model.v20151111.*;import com.aliyuncs.exceptions.ClientException;public class StartJob {static String ACCESS_KEY_ID = "xxx"; //这里填写您的 AccessKeyIdstatic String ACCESS_KEY_SECRET = "xxx"; //这里填写您的 AccessKeySecretstatic String REGION_ID = "cn-xxx"; //这里填写 regionstatic String jobId = "job-000000005BE3E897000007FA00114EE9";public static void main(String[] args) {BatchCompute client = new BatchComputeClient(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);try{StartJobResponse response = client.startJob(jobId);//成功接受System.out.println("RequestId: " + response.getRequestId());System.out.println("StatusCode: " + response.getStatusCode());}catch(ClientException e){e.printStackTrace();//失败}}}
执行结果:
{RequestId: nullStatusCode: 201}
注意
- 当作业的状态为 Stopped 或者 Failed,才支持调用该接口。
- 当 Failed 状态的作业重启之后,已经运行成功的 Instance 不会重新运行。
该文章对您有帮助吗?