Obtaining the Training Job Resource List (Filtering by Tag)
Function
This API is used to obtain the list of training job resources in a project based on criteria such as tags and resource names, and return the tag information of each job.
This API applies to the following scenario: When you need to filter training jobs by tag or resource name for resource classification management or batch operations, you can use this API to obtain the list of job resources that meet the filter criteria. Before using this API, ensure that you have the permission to view tags. After the query is complete, the platform returns the list and total number of job resources that meet the filter criteria. If the tag format is invalid, the tag key is duplicate, or you do not have the required permissions, an error message is returned.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.
URI
POST /v2/{project_id}/modelarts-training-job/resource-instances/filter
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: Project ID. For details, see Obtaining a Project ID and Name. Constraints: N/A Range: The value can contain 1 to 64 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| limit | No | Integer | Definition: Number of resources returned on each page. Constraints: N/A Range: 1 to 1000. Default Value: 1000 |
| offset | No | Integer | Definition: Offset of pagination query. Constraints: N/A Range: greater than or equal to 0 Default Value: 0 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| workspace_id | No | String | Definition: Workspace ID. If no workspace is created, the default value is 0. If a workspace has been created and used, use the actual value. Constraints: N/A Range: N/A Default Value: 0 |
| tags | No | Array of MutiValueTag objects | Definition: Tag filter criteria. Jobs are filtered by tag key-value pair. Multiple values under the same key are in the OR relationship, and different keys are in the AND relationship. Constraints: The values under the same key must be unique, and different keys must be unique. Range: N/A |
| without_any_tag | No | Boolean | Definition: Specifies whether to obtain jobs that have no tags. Constraints: If this parameter is set to true, the tag filter criteria are ignored. Range: Default Value: false |
| matches | No | Array of Match objects | Definition: Resource name. Constraints: Only one matching item is supported, and the key must be resource_name. Range: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key | No | String | Definition: Tag key. Range: 1 to 128 characters. Only letters, digits, and special characters (_.:=+-@) are allowed. The value cannot start with sys. |
| values | No | Array of strings | Definition: List of values for the key. The relationship between multiple values is OR. Constraints: The values under the same key must be unique. A maximum of 10 values are allowed. Range: 0 to 255 characters. Only letters, digits, and special characters (_.:/=+-@) are allowed. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| resources | Array of ResourceInstance objects | Definition: List of training job resources that meet the search criteria. Range: N/A |
| total_count | Integer | Definition: Total number of training jobs that meet the search criteria. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| resource_detail | Object | Definition: Resource details. Currently, this parameter is left blank. Range: N/A |
| workspace_id | String | Definition: Workspace ID. Range: N/A |
| resource_id | String | Definition: Training job ID. Range: N/A |
| resource_name | String | Definition: Training job name. Range: N/A |
| tags | Array of TmsTagResp objects | Definition: List of tags of the training job. If a job has no tag, an empty array is returned. Range: N/A |
Example Requests
Example Responses
Status code: 200
Query succeeded.
{
"resources" : [ {
"resource_detail" : { },
"workspace_id" : "0",
"resource_id" : "3faf5c03-aaa1-4cbe-879d-24b05d997347",
"resource_name" : "trainjob--py14-108",
"tags" : [ {
"key" : "test",
"value" : "1122"
}, {
"key" : "k2",
"value" : "v2"
} ]
} ],
"total_count" : 1
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Query succeeded. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot