开发者社区> 问答> 正文

如何获取Job列表



描述


此操作会列出Job列表,包括正在进行的以及近期完成的Job。
默认情况下,此操作返回的列表中最多会有1000个Job,列表按Job ID升序排列。用户应始终检查返回体中的Marker字段,该字段可以在新的请求中作为获取下一个列表的起点;如果Marker为””(空串),则表示列表已全部获取完成。用户还可以通过设置limit参数来限制每次请求返回的Job数量,但是limit不能超过1000,如果超过1000,按1000处理。

请求参数

名称是否必须描述
limit指定列表返回数量的上限。如果未指定,则最多会返回1000个Job。当用户设置大于1000时,当1000处理
marker指定本次请求列表的起始位置。第一次请求列表时,不需要带上marker;当返回体提示Marker不为空串(””)时,第二次请求带上之前返回体中的Marker值就可以获取后续列表。当marker对应ID不存在时,会报异常。


请求头部


无,其他公共请求头部参见2.4.1

请求体




返回头部


无,其他公共返回头部参见2.4.2

返回体

  • [backcolor=transparent]Marker

下一次列表请求的起始标记,空串(””)表示无后续的列表
  • [backcolor=transparent]JobList

Job元数据数组,以下是元数据的字段
  • [backcolor=transparent]Action

任务类型,对于archive-retrieval类型,返回ArchiveRetrieval;对于inventory-retrieval类型,返回InventoryRetrieval;对于pull-from-oss类型,返回PullFromOSS; 对于push-to-oss类型,返回PushToOSS
  • [backcolor=transparent]ArchiveId

对于archive-retrieval,push-to-oss任务,该值为创建Job时指定的ArchiveID
对于pull-from-oss任务,Job完成时,该值为OAS生成的ArchiveId;Job未完成时,该值为空串(””)
对于inventory-retrieval任务,该值为空串(””)
  • [backcolor=transparent]ArchiveSizeInBytes

如果Job是archive-retrieval,pull-from-oss, push-to-oss类型,Job完成时,该值为创建Job时指定的Archive的大小(以字节为单位)
如果Job是inventory-retrieval类型或者 Job未完成,该值为-1
  • [backcolor=transparent]TreeEtag

Job对应范围的校验码,对于inventory-retrieval类型、未完成或者不满足tree-hash树对齐(2.5.4)的archive-retrieval类型Job,该值为空串(””)。
  • [backcolor=transparent]ArchiveTreeEtag

Archive的校验码,对于inventory-retrieval类型或未完成的archive-retrieval,pull-from-oss, push-to-oss类型Job,该值为空串(””)。
  • [backcolor=transparent]Completed

指示Job是否完成,Job完成时,用户可以使用Job Output下载(4.4.2)获取Job结果
  • [backcolor=transparent]CompletionDate

Job请求完成的GMT时间,当Job正在进行时,该值为空串(””)
  • [backcolor=transparent]CreationDate

创建Job的GMT时间
  • [backcolor=transparent]InventorySizeInBytes

如果Job是inventory-retrieval类型,Job完成时,该值为可下载的Archive列表信息的字节数
如果Job是archive-retrieval,pull-from-oss, push-to-oss类型或者Job未完成,该值为-1
  • [backcolor=transparent]JobDescription

创建Job时提供的Job描述
  • [backcolor=transparent]JobId

Job ID
  • [backcolor=transparent]RetrievalByteRange

初始化archive-retrieval类型Job时指定的Archive需要取出的字节范围,如果未指定,则返回整个Archive字节范围, 对于inventory-retrieval,pull-from-oss, push-to-oss类型Job,该字段为空串(””)
  • [backcolor=transparent]StatusCode

状态代码可以是InProgress、Succeeded或Failed,它指示Job状态
  • [backcolor=transparent]StatusMessage

Job状态消息

示例


请求示例 GET /vaults/[VaultId]/jobs HTTP/1.1
Host: cn-hangzhou.oas.aliyuncs.com
Date: Tue, 25 Mar 2014 12:00:00 GMT
x-oas-version: 2014-01-01
Authorization: [SignatureValue]


返回示例 HTTP/1.1 200 OK
x-oas-request-id: [RequestId]
Date: Tue, 25 Mar 2014 12:00:00 GMT
Content-Type: application/json
Content-Length: 1522
{
  "JobList":
  [{
    "Action": "InventoryRetrieval",
    "ArchiveId": "",
    "ArchiveSizeInBytes": -1,
    "TreeEtag": "",
    "ArchiveTreeEtag": "",
    "Completed": false,
    "CompletionDate": "",
    "CreationDate": "Tue, 25 Mar 2014 12:00:00 GMT",
    "InventorySizeInBytes": -1,
    "JobDescription": "MyJob1",
    "JobId": "BE21ED08CE3747A0B8EE4EF401AC9C43",
    "StatusCode": "InProgress",
    "StatusMessage": "operation in progress"
  },
  {
    "Action": "ArchiveRetrieval",
    "ArchiveId": "0BE09D02858A4B13A3624CC6FB10336B79ACA1B5FF4D38F8CAB47E9C7CBD7DDC9667A8BB98BF1D6735495EF5AE046FB9",
    "ArchiveSizeInBytes": 123,
    "TreeEtag": "DBB87C0A23C894006EA80A386314D003",
    "ArchiveTreeEtag": "F0C9A541B382F8820D3D19D8E8343A26",
    "Completed": true,
    "CompletionDate": " Tue, 25 Mar 2014 11:55:52 GMT",
    "CreationDate": "Tue, 25 Mar 2014 08:00:00 GMT",
    "InventorySizeInBytes": -1,
    "JobDescription": "MyJob2",
    "JobId": "D9A741E689E94A078B469E9A9DC03BE9",
    "RetrievalByteRange": "0-122",
    "StatusCode": "Succeeded",
    "StatusMessage": "operation is succeeded"
  },
  {
    "Action": "ArchiveRetrieval",
    "ArchiveId": "0BCC996ACD22401A823E44FD553CA823C38A0963C98A1CCCA2B013E5D847F46C675DA67DEC135C292C9C5ECC9D24F2FF",
    "ArchiveSizeInBytes": 1024,
    "TreeEtag": "DBB87C0A23C894006EA80A386314D003",
    "ArchiveTreeEtag": "B78BDC0A23C894006EA80A386314D003",
    "Completed": true,
    "CompletionDate": "Tue, 25 Mar 2014 11:55:42 GMT",
    "CreationDate": "Tue, 25 Mar 2014 08:00:00 GMT",
    "InventorySizeInBytes": -1,
    "JobDescription": "MyJob3",
    "JobId": "DEFB618D721C4FE59D384EACECADEB3E",
    "RetrievalByteRange": "0-1023",
    "StatusCode": "Succeeded",
    "StatusMessage": "operation is succeeded"
  }],
  "Marker": ""
}


带limit的请求示例 GET /vaults/[VaultId]/jobs?limit=2 HTTP/1.1
Host: cn-hangzhou.oas.aliyuncs.com
Date: Tue, 25 Mar 2014 12:00:00 GMT
x-oas-version: 2014-01-01
Authorization: [SignatureValue]


返回示例 HTTP/1.1 200 OK
x-oas-request-id: [RequestId]
Date: Tue, 25 Mar 2014 12:00:00 GMT
Content-Type: application/json
Content-Length: 1522
{
  "JobList":
  [{
    "Action": "InventoryRetrieval",
    "ArchiveId": "",
    "ArchiveSizeInBytes": -1,
    "TreeEtag": "",
    "ArchiveTreeEtag": "",
    "Completed": false,
    "CompletionDate": "",
    "CreationDate": "Tue, 25 Mar 2014 12:00:00 GMT",
    "InventorySizeInBytes": -1,
    "JobDescription": "MyJob1",
    "JobId": "BE21ED08CE3747A0B8EE4EF401AC9C43",
    "RetrievalByteRange": "",
    "StatusCode": "InProgress",
    "StatusMessage": "operation in progress"
  },
  {
    "Action": "ArchiveRetrieval",
    "ArchiveId": "0BE09D02858A4B13A3624CC6FB10336B79ACA1B5FF4D38F8CAB47E9C7CBD7DDC9667A8BB98BF1D6735495EF5AE046FB9",
    "ArchiveSizeInBytes": 1024,
    "TreeEtag": "DBB87C0A23C894006EA80A386314D003",
    "ArchiveTreeEtag": "F0C9A541B382F8820D3D19D8E8343A26",
    "Completed": true,
    "CompletionDate": " Tue, 25 Mar 2014 11:55:52 GMT",
    "CreationDate": "Tue, 25 Mar 2014 08:00:00 GMT",
    "InventorySizeInBytes": -1,
    "JobDescription": "MyJob2",
    "JobId": "D9A741E689E94A078B469E9A9DC03BE9",
    "StatusCode": "Succeeded",
    "StatusMessage": "operation is succeeded"
  }],
  "Marker": "D9A741E689E94A078B469E9A9DC03BE9"
}


带limit和marker的请求示例 GET /vaults/[VaultId]/jobs?limit=2&marker=D9A741E689E94A078B469E9A9DC03BE9 HTTP/1.1
Host: cn-hangzhou.oas.aliyuncs.com
Date: Tue, 25 Mar 2014 12:00:00 GMT
x-oas-version: 2014-01-01
Authorization: [SignatureValue]


返回示例 HTTP/1.1 200 OK
x-oas-request-id: [RequestId]
Date: Tue, 25 Mar 2014 12:00:00 GMT
Content-Type: application/json
Content-Length: 1522
{
  "JobList":
  [{
    "Action": "ArchiveRetrieval",
    "ArchiveId": "0BCC996ACD22401A823E44FD553CA823C38A0963C98A1CCCA2B013E5D847F46C675DA67DEC135C292C9C5ECC9D24F2FF",
    "ArchiveSizeInBytes": 1024,
    "TreeEtag": "DBB87C0A23C894006EA80A386314D003",
    "ArchiveTreeEtag": "B78BDC0A23C894006EA80A386314D003",
    "Completed": true,
    "CompletionDate": "Tue, 25 Mar 2014 11:55:42 GMT",
    "CreationDate": "Tue, 25 Mar 2014 08:00:00 GMT",
    "InventorySizeInBytes": -1,
    "JobDescription": "MyJob3",
    "JobId": "DEFB618D721C4FE59D384EACECADEB3E",
    "StatusCode": "Succeeded",
    "StatusMessage": "operation is succeeded"
  }],
  "Marker": ""
}

展开
收起
云栖大讲堂 2017-10-26 14:22:31 2450 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载

相关实验场景

更多