ListJobs - 获取任务列表

获取任务列表,支持分页、排序和按条件过滤。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用背景高亮的方式表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
paidlc:ListJobsget
*全部资源
*

请求语法

GET /api/v1/jobs HTTP/1.1

请求参数

名称类型必填描述示例值
DisplayNamestring

任务名称,支持模糊查询,大小写不敏感,不支持通配符。 例如:输入 test,可以匹配 test-job1、job-test、job-test2 或 job-Test;但是不能匹配 job-t1。 默认为空,代表任意任务名称。

tf-mnist-test
JobTypestring

任务类型,可以查询任意任务类型。默认为空,代表所有类型。支持的任务类型如下:

  • TFJob
  • PyTorchJob
  • XGBoostJob
  • OneFlowJob
  • ElasticBatchJob
TFJob
Statusstring

任务状态;默认为空,代表任意状态。

Running
StartTimestring

查询区间的起始时间;使用任务的创建时间来过滤。默认值是当前时间减去 7 天,即:如果 StartTime 与 EndTime 都没有配置时,默认查询最近 7 天的任务列表。

2020-11-08T16:00:00Z
EndTimestring

查询区间的截止时间;使用任务的创建时间来过滤。默认值是当前时刻。

2020-11-09T14:45:00Z
PageNumberinteger

分页查询,指定当前需要返回的页码,起始值为 1,默认为 1。

1
PageSizeinteger

分页查询中,指定每页返回的任务数量。

50
SortBystring

返回任务列表的排序字段,枚举型:

  • DisplayName
  • JobType
  • Status
  • GmtCreateTime
  • GmtFinishTime
GmtCreateTime
Orderstring

排列顺序,枚举类型:

  • desc:降序,默认值。
  • asc:升序。
desc
ShowOwnboolean

是否只查询当前用户提交的任务列表。

true
WorkspaceIdstring

工作空间 ID。如何获取工作空间 ID,请参见 ListWorkspaces

1****
ResourceIdstring

资源组 ID。如何查询专有资源组 ID,详情请参见准备及管理 DLC 资源组集群

r*****
BusinessUserIdstring

任务关联用户 ID。

16****
Callerstring

调用方。

local
Tagsobject

用于过滤的标签。

string

单个标签。

recommandation
PipelineIdstring

过滤指定工作流 ID 创建的任务。

flow-*******
FromAllWorkspacesboolean

是否跨工作空间获取任务列表,需要配合ShowOwn=true参数使用,可以查询当前用户最近提交的任务列表。

false
JobIdstring

任务 ID,不支持模糊查询,对大小写不敏感。不支持通配符。 默认为空,代表任意任务 ID。

dlc********
UserIdForFilterstring

按任务提交者的用户 ID,过滤查询任务列表。

20**************
Usernamestring

按任务提交者的用户名,过滤查询任务列表。支持模糊查询,不支持通配符。默认为空,表示不过滤用户名。

test***
ResourceQuotaNamestring

按资源配额的名字,过滤查询任务列表。支持模糊匹配,不支持通配符。默认为空,表示不过滤资源配额。

quota***
Accessibilitystring

作业的可见性,取值如下:

  • PUBLIC:在此工作空间中,对所有人可见。
  • PRIVATE(默认值):在此工作空间中,仅对您和管理员可见。
PRIVATE

返回参数

名称类型描述示例值
object

任务列表。

Jobsarray

任务列表。

JobsJobItem

单个任务。

TotalCountlong

符合过滤条件的总任务数。

2
RequestIdstring

请求 ID,用于诊断和答疑。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

示例

正常返回示例

JSON格式

{
  "Jobs": [
    {
      "JobId": "dlc-20210126170216-********",
      "CredentialConfig": {
        "EnableCredentialInject": true,
        "AliyunEnvRoleKey": "",
        "CredentialConfigItems": [
          {
            "Key": "",
            "Type": "",
            "Roles": [
              {
                "RoleArn": "",
                "RoleType": "",
                "AssumeRoleFor": "",
                "Policy": "",
                "AssumeUserInfo": {
                  "SecurityToken": "",
                  "AccessKeyId": "",
                  "Type": "",
                  "Id": ""
                }
              }
            ]
          }
        ]
      },
      "JobType": "TFJob",
      "DisplayName": "tf-mnist-test",
      "UserVpc": "vpc-1",
      "UserId": "123456789",
      "Username": "pai-dlc-role",
      "Status": "Stopped",
      "WorkspaceId": "268",
      "WorkspaceName": "dlc-workspace",
      "ResourceId": "dlc-quota",
      "ResourceLevel": "L0",
      "ReasonCode": "JobStoppedByUser",
      "ReasonMessage": "Job is stopped by user.",
      "JobSpecs": [
        {
          "Type": "Worker",
          "Image": "registry-vpc.cn-hangzhou.aliyuncs.com/cloud-dsw/tensorflow:1.12PAI-gpu-py36-cu101-ubuntu18.04",
          "ImageConfig": {
            "DockerRegistry": "docker****registry.com",
            "Username": " username",
            "Password": "password",
            "Auth": ""
          },
          "PodCount": 1,
          "EcsSpec": "ecs.c6.large",
          "ExtraPodSpec": {
            "SideCarContainers": [
              {
                "Name": "data-init",
                "Image": "registry.cn-hangzhou.aliyuncs.com/pai-dlc/curl:v1.0.0",
                "Command": [
                  "curl www.aliyun.com"
                ],
                "Args": [
                  ""
                ],
                "WorkingDir": "/root",
                "Env": [
                  {
                    "Name": "ENABLE_DEBUG",
                    "Value": "true"
                  }
                ],
                "Resources": {
                  "Limits": {
                    "key": "{'cpu': '1', 'memory': '1000Mi'}"
                  },
                  "Requests": {
                    "key": "{'cpu': '1', 'memory': '1000Mi'}"
                  }
                }
              }
            ],
            "InitContainers": [
              {
                "Name": "data-init",
                "Image": "registry.cn-hangzhou.aliyuncs.com/pai-dlc/curl:v1.0.0",
                "Command": [
                  "curl www.aliyun.com"
                ],
                "Args": [
                  ""
                ],
                "WorkingDir": "/root",
                "Env": [
                  {
                    "Name": "ENABLE_DEBUG",
                    "Value": "true"
                  }
                ],
                "Resources": {
                  "Limits": {
                    "key": "{'cpu': '1', 'memory': '1000Mi'}"
                  },
                  "Requests": {
                    "key": "{'cpu': '1', 'memory': '1000Mi'}"
                  }
                }
              }
            ],
            "PodLabels": {
              "key": ""
            },
            "PodAnnotations": {
              "key": ""
            },
            "SharedVolumeMountPaths": [
              "/root/share/"
            ],
            "Lifecycle": {
              "PreStop": {
                "Exec": {
                  "Command": [
                    ""
                  ]
                }
              },
              "PostStart": {
                "Exec": {
                  "Command": [
                    ""
                  ]
                }
              }
            }
          },
          "ResourceConfig": {
            "CPU": "10",
            "GPU": "3",
            "Memory": "10Gi",
            "SharedMemory": "5Gi",
            "GPUType": "Tesla-V100-16G"
          },
          "UseSpotInstance": false,
          "SpotSpec": {
            "SpotStrategy": "",
            "SpotDiscountLimit": 0
          },
          "AssignNodeSpec": {
            "EnableAssignNode": true,
            "NodeNames": "lingjxxxxxxxx",
            "AntiAffinityNodeNames": "lingjxxxxxxxx"
          }
        }
      ],
      "UserCommand": "python /root/code/mnist.py",
      "DataSources": [
        {
          "DataSourceId": "data-20210114104214-********",
          "MountPath": "/mnt/data"
        }
      ],
      "CodeSource": {
        "CodeSourceId": "code-20210111103721-********",
        "Branch": "master",
        "Commit": "44da109b59f8596152987eaa8f3b2487bb******",
        "MountPath": "/mnt/data"
      },
      "ThirdpartyLibs": [
        "numpy==1.16.1"
      ],
      "NodeNames": [
        "i-a"
      ],
      "ThirdpartyLibDir": "/root/code/",
      "Envs": {
        "key": "ENABLE_DEBUG_MODE"
      },
      "SystemEnvs": {
        "key": "ENABLE_DEBUG_MODE"
      },
      "GmtCreateTime": "2021-01-12T14:35:01Z",
      "GmtSubmittedTime": "2021-01-12T14:35:01Z",
      "GmtRunningTime": "2021-01-12T14:35:01Z",
      "GmtSuccessedTime": "2021-01-12T14:35:01Z",
      "GmtStoppedTime": "2021-01-12T14:35:01Z",
      "GmtFailedTime": "2021-01-12T14:35:01Z",
      "GmtFinishTime": "2021-01-12T15:36:08Z",
      "GmtModifiedTime": "2021-01-12T15:36:08Z",
      "Duration": 3602,
      "JobMaxRunningTimeMinutes": 1,
      "Settings": {
        "BusinessUserId": "16****",
        "Caller": "SilkFlow",
        "Tags": {
          "key": ""
        },
        "PipelineId": "pid-123456",
        "EnableTideResource": true,
        "EnableErrorMonitoringInAIMaster": false,
        "ErrorMonitoringArgs": "--enable-log-hang-detection true",
        "EnableRDMA": true,
        "EnableOssAppend": true,
        "OversoldType": "AcceptQuotaOverSold",
        "AdvancedSettings": {
          "test": "test",
          "test2": 1
        },
        "Driver": "535.54.03",
        "EnableSanityCheck": true,
        "SanityCheckArgs": "--sanity-check-timing=AfterJobFaultTolerant --sanity-check-timeout-ops=MarkJobFai",
        "JobReservedMinutes": 30,
        "JobReservedPolicy": "Always",
        "DisableEcsStockCheck": false
      },
      "EnabledDebugger": false,
      "IsDeleted": false,
      "EnablePreemptibleJob": false,
      "ResourceName": "my_resource_group",
      "WorkingDir": "/mnt/data",
      "UserScript": "ls ",
      "RestartTimes": "1",
      "RequestCPU": 1,
      "RequestMemory": "1Gi",
      "ResourceQuotaName": "test",
      "RequestGPU": "1",
      "NodeCount": "1",
      "Priority": 1,
      "SubStatus": "Restarting",
      "UseOversoldResource": false,
      "ResourceType": "ECS",
      "Accessibility": "PUBLIC",
      "ClusterId": "",
      "TenantId": "",
      "StatusHistory": [
        {
          "Status": "",
          "StartTime": "",
          "EndTime": "",
          "ReasonCode": "",
          "ReasonMessage": ""
        }
      ],
      "ElasticSpec": {
        "EnableElasticTraining": true,
        "MinParallelism": 1,
        "MaxParallelism": 8,
        "AIMasterType": "",
        "AIMasterDockerImage": "",
        "EnablePsJobElasticWorker": true,
        "EnableAIMaster": true,
        "EnablePsResourceEstimate": true,
        "EnablePsJobElasticPS": true,
        "PSMinParallelism": 4,
        "PSMaxParallelism": 10,
        "ElasticStrategy": "",
        "EnableEDP": true,
        "EDPMaxParallelism": 16,
        "EDPMinParallelism": 8
      },
      "Pods": [
        {
          "Type": "Worker",
          "PodId": "dlc-20210126170216-mtl37ge7gkvdz-worker-0",
          "PodUid": "fe846462-af2c-4521-bd6f-96787a57591d",
          "Status": "Stopped",
          "Ip": "10.0.1.2",
          "GmtCreateTime": "2021-01-12T14:36:01Z",
          "GmtStartTime": "2021-01-12T14:36:05Z",
          "GmtFinishTime": "2021-01-12T15:36:05Z",
          "HistoryPods": [
            {
              "Type": "Worker",
              "PodId": "dlc-20210126170216-mtl37ge7gkvdz-worker-0",
              "PodUid": "fe846462-af2c-4521-bd6f-96787a57591d",
              "Status": "Stopped",
              "Ip": "10.0.1.2",
              "GmtCreateTime": "2021-01-12T14:36:01Z",
              "GmtStartTime": "2021-01-12T14:36:05Z",
              "GmtFinishTime": "2021-01-12T15:36:05Z",
              "HistoryPods": [
                {
                  "Type": "Worker",
                  "PodId": "dlc-20210126170216-mtl37ge7gkvdz-worker-0",
                  "PodUid": "fe846462-af2c-4521-bd6f-96787a57591d",
                  "Status": "Stopped",
                  "Ip": "10.0.1.2",
                  "GmtCreateTime": "2021-01-12T14:36:01Z",
                  "GmtStartTime": "2021-01-12T14:36:05Z",
                  "GmtFinishTime": "2021-01-12T15:36:05Z",
                  "HistoryPods": []
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "TotalCount": 2,
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

错误码

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2024-04-09OpenAPI 入参发生变更查看变更详情
2024-01-12OpenAPI 入参发生变更查看变更详情
2023-12-14OpenAPI 入参发生变更查看变更详情
2022-11-29OpenAPI 入参发生变更查看变更详情