方法说明
通过作业ID和任务名称获取一个任务下所有实例的状态详情(listInstances
)。
参数说明
参数 | 类型 | 是否必选 | 说明 |
---|---|---|---|
jobId | String | 是 | 作业ID |
taskName | String | 是 | 任务名称 |
marker | String | 否 | 本页起始资源标识符。默认为空字符串。 |
maxItemCount | int | 否 | 返回条数,最大取值200,默认200 |
返回值说明
成功后返回一个ListInstancesResponse实例, 可以通过这个实例的 getInstanceList() 方法,拿到 List<Instance> 对象。
如果失败,抛出异常: ClientException。
代码示例
try{
ListInstancesResponse response = client.listInstances("job-0101010299123","Find");
//成功
List<Instance> list = response.getItems();
//下一页的marker,查询下一页的时候,需要带上这个参数
String nextMarker = response.getNextMarker();
}catch(ClientException e){
e.printStackTrace();
//失败
}
代码示例2
String marker = ""; //上次listJobs返回的nextMarker,第一次查询不用填。
int maxItemCount = 200; //最大200,默认200
try{
ListInstancesResponse response = client.listInstances("job-0101010299123","Find",marker,maxItemCount);
//成功
List<Instance> list = response.getItems();
//下一页的marker,查询下一页的时候,需要带上这个参数
String nextMarker = response.getNextMarker();
}catch(ClientException e){
e.printStackTrace();
//失败
}
Instance 属性
属性 | 类型 | 说明 |
---|---|---|
instanceId | int | 实例ID |
state | String | 任务运行状态: Waiting, Running, Failed, Finished, Stopped。. |
startTime | Date | 任务开始时间,如果还在Waiting状态,则为null。 |
endTime | Date | 任务结束时间, 如果还没结束,则为null。 |
retryCount | int | 重试次数。 |
progress | int | 进度。 |
stdoutRedirectPath | String | 标准输出日志OSS路径。 |
stderrRedirectPath | String | 标准错误日志OSS路径。 |
result | Result | 结果信息。 |
Result 属性
属性 | 类型 | 说明 |
---|---|---|
exitCode | int | 程序运行的exitCode |
errorCode | String | 错误code |
errorMessage | String | 错误信息。 |
detail | String | 详细信息。 |