文档

获取实例信息

更新时间:

get_instance

参数说明:

属性 类型 描述
job CreateResponse, str 作业标识符
task_name str 任务名称
instance_id str 实例标识符

返回值说明:

get_instance方法将返回一个GetResponse 对象, 封装了Instance类型的所有接口。

(1) Instance 类

参数说明:

参数 类型 描述
properties dict, str, Instance object 作业运行状态信息

属性说明:

序号 属性 类型 描述
1. InstanceId int 实例标识符
2. State str 实例运行状态
3. StartTime str 实例开始时间
4. EndTime str 实例结束时间
5. RetryCount int 实例重试次数
6. Progross int 实例完成进度
7. StdoutRedirectPath str 标准输出路径
8. StderrRedirectPath str 标准出错路径
9. Result Result object 实例返回值信息
10. NodeIp str 任务执行的对应实例的IP信息

(2) Result 类

参数说明:

参数 类型 描述
properties dict, str, Result object 实例返回值信息

属性说明:

序号 属性 类型 描述
1. ExitCode int 命令行返回值
2. ErrorCode str 实例错误代码
3. ErrorMessage str 实例错误信息描述
4. Detail str 实例详细信息

e.g.

  1. try:
  2. # Get a Client object.
  3. client = Client(...
  4. ...
  5. # Job ID.
  6. job = "job-xxxx"
  7. task_name = "echo_task"
  8. instance_id = 0
  9. instance_desc = client.get_instance(job, task_name, instance_id)
  10. print (instance_desc.InstanceId, instance_desc.State, instance_desc.NodeIp)
  11. except ClientError, e:
  12. print(e)
  • 本页导读 (0)
文档反馈