Rerunning Job Instances
Function
Job instances and upstream and downstream job instances can be rerun.
Calling Method
For details, see Calling APIs.
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}/factory/jobs/{job_name}/instances/retry
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
job_name |
Yes |
String |
Current Job Name |
|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see Project ID and Account ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
No |
String |
IAM token, which is obtained by calling the IAM API for obtaining a user token (value of X-Subject-Token in the response header). This parameter is mandatory when token authentication is used. The value contains 0 to 4096 characters. |
|
workspace |
Yes |
String |
Workspace ID. For details about how to obtain the workspace ID, see Instance ID and Workspace ID. |
|
Content-Type |
Yes |
String |
Default value: application/json;charset=UTF-8 Optional. This parameter is mandatory if a body is available. If no body is available, you do not need to set or verify this parameter. |
|
X-Project-Id |
No |
String |
project_id: project ID. For details about how to obtain the project ID and account ID, see Project ID and Account ID. This field is mandatory for API requests that use AK/SK authentication in multi-project scenarios. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
retry_location |
Yes |
String |
Rerun start position. The value can be firstNode, errorNode, or specifiedNode. |
|
node_name |
No |
String |
Node name |
|
retry_task_version |
Yes |
String |
Job parameter. The value can be original_version or current_version. |
|
ignore_obs_monitor |
No |
Boolean |
Whether to ignore OBS listening. The default value is true. |
|
task_retrys |
No |
Array of task_retrys objects |
Job instance rerun parameter. When the current instance type is rerun, you need to specify the rerun information of this parameter. You do not need to specify this parameter when rerun the current job and its upstream and downstream job instance types. |
|
begin_time |
No |
Long |
Instance start time. This parameter is valid only when the current job and its upstream and downstream job instances are re-executed. |
|
end_time |
No |
Long |
Instance end time. This parameter is valid only when the current job and its upstream and downstream job instances are re-executed. |
|
jobs |
No |
Array of jobs objects |
Job instance rerun parameter. When the current job and its upstream and downstream job instance types are rerun, you need to specify the rerun information of this parameter. You do not need to specify this parameter for the current instance type. |
|
concurrent |
No |
Integer |
Concurrency. This parameter is valid when the current job and its upstream and downstream job instances are re-executed. The default value is 1, and the value ranges from 1 to 128. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
job_id |
Yes |
Long |
Job ID of the current rerun instance. |
|
plan_time |
Yes |
Long |
Planned time of an instance. The value is a 13-digit timestamp, which can be obtained by calling the API for querying the job instance list. |
|
submit_time |
Yes |
Long |
Time when an instance is submitted. The value is a 13-digit timestamp, which can be obtained by calling the API for querying the job instance list. |
Response Parameters
Status code: 200
The job is re-executed successfully, and no response is returned.
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Example Requests
-
Rerun the current instance of the test_job_name job.
POST /v2/62099355b894428e8916573ae635f1f9/factory/jobs/test_job_name/instances/retry { "retry_location" : "errorNode", "retry_task_version" : "original_version", "ignore_obs_monitor" : true, "task_retrys" : [ { "job_id" : 917567, "plan_time" : 1732601580000, "submit_time" : 1732239754684 } ] } -
Rerun the current job and its upstream and downstream job instances of the test_job_name job.
POST /v2/62099355b894428e8916573ae635f1f9/factory/jobs/test_job_name/instances/retry { "retry_location" : "errorNode", "retry_task_version" : "current_version", "ignore_obs_monitor" : true, "begin_time" : 1732608520000, "end_time" : 1732612120000, "jobs" : [ { "job_name" : "job_test_smn2", "workspace_id" : "62fbba734e634c5087656fc3ff7adf34" } ], "concurrent" : 2 }
Example Responses
Status code: 400
Response to a job re-execution failure.
{
"error_code" : "DLF.1000",
"error_msg" : "Failed to find the job."
}
SDK Sample Code
The SDK sample code is as follows.
-
Rerun the current instance of the test_job_name job.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.dataartsstudio.v1.region.DataArtsStudioRegion; import com.huaweicloud.sdk.dataartsstudio.v1.*; import com.huaweicloud.sdk.dataartsstudio.v1.model.*; import java.util.List; import java.util.ArrayList; public class RetryFactoryJobInstanceSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); DataArtsStudioClient client = DataArtsStudioClient.newBuilder() .withCredential(auth) .withRegion(DataArtsStudioRegion.valueOf("<YOUR REGION>")) .build(); RetryFactoryJobInstanceRequest request = new RetryFactoryJobInstanceRequest(); request.withJobName("{job_name}"); RetryFactoryJobInstanceBody body = new RetryFactoryJobInstanceBody(); List<RetryFactoryJobInstanceBodyTaskRetrys> listbodyTaskRetrys = new ArrayList<>(); listbodyTaskRetrys.add( new RetryFactoryJobInstanceBodyTaskRetrys() .withJobId(917567L) .withPlanTime(1732601580000L) .withSubmitTime(1732239754684L) ); body.withTaskRetrys(listbodyTaskRetrys); body.withIgnoreObsMonitor(true); body.withRetryTaskVersion("original_version"); body.withRetryLocation("errorNode"); request.withBody(body); try { RetryFactoryJobInstanceResponse response = client.retryFactoryJobInstance(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } }
-
Rerun the current job and its upstream and downstream job instances of the test_job_name job.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.dataartsstudio.v1.region.DataArtsStudioRegion; import com.huaweicloud.sdk.dataartsstudio.v1.*; import com.huaweicloud.sdk.dataartsstudio.v1.model.*; import java.util.List; import java.util.ArrayList; public class RetryFactoryJobInstanceSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); DataArtsStudioClient client = DataArtsStudioClient.newBuilder() .withCredential(auth) .withRegion(DataArtsStudioRegion.valueOf("<YOUR REGION>")) .build(); RetryFactoryJobInstanceRequest request = new RetryFactoryJobInstanceRequest(); request.withJobName("{job_name}"); RetryFactoryJobInstanceBody body = new RetryFactoryJobInstanceBody(); List<RetryFactoryJobInstanceBodyJobs> listbodyJobs = new ArrayList<>(); listbodyJobs.add( new RetryFactoryJobInstanceBodyJobs() .withJobName("job_test_smn2") .withWorkspaceId("62fbba734e634c5087656fc3ff7adf34") ); body.withConcurrent(2); body.withJobs(listbodyJobs); body.withEndTime(1732612120000L); body.withBeginTime(1732608520000L); body.withIgnoreObsMonitor(true); body.withRetryTaskVersion("current_version"); body.withRetryLocation("errorNode"); request.withBody(body); try { RetryFactoryJobInstanceResponse response = client.retryFactoryJobInstance(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } }
-
Rerun the current instance of the test_job_name job.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdataartsstudio.v1.region.dataartsstudio_region import DataArtsStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdataartsstudio.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = DataArtsStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(DataArtsStudioRegion.value_of("<YOUR REGION>")) \ .build() try: request = RetryFactoryJobInstanceRequest() request.job_name = "{job_name}" listTaskRetrysbody = [ RetryFactoryJobInstanceBodyTaskRetrys( job_id=917567, plan_time=1732601580000, submit_time=1732239754684 ) ] request.body = RetryFactoryJobInstanceBody( task_retrys=listTaskRetrysbody, ignore_obs_monitor=True, retry_task_version="original_version", retry_location="errorNode" ) response = client.retry_factory_job_instance(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
Rerun the current job and its upstream and downstream job instances of the test_job_name job.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdataartsstudio.v1.region.dataartsstudio_region import DataArtsStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdataartsstudio.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = DataArtsStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(DataArtsStudioRegion.value_of("<YOUR REGION>")) \ .build() try: request = RetryFactoryJobInstanceRequest() request.job_name = "{job_name}" listJobsbody = [ RetryFactoryJobInstanceBodyJobs( job_name="job_test_smn2", workspace_id="62fbba734e634c5087656fc3ff7adf34" ) ] request.body = RetryFactoryJobInstanceBody( concurrent=2, jobs=listJobsbody, end_time=1732612120000, begin_time=1732608520000, ignore_obs_monitor=True, retry_task_version="current_version", retry_location="errorNode" ) response = client.retry_factory_job_instance(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
Rerun the current instance of the test_job_name job.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dataartsstudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := dataartsstudio.NewDataArtsStudioClient( dataartsstudio.DataArtsStudioClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.RetryFactoryJobInstanceRequest{} request.JobName = "{job_name}" var listTaskRetrysbody = []model.RetryFactoryJobInstanceBodyTaskRetrys{ { JobId: int64(917567), PlanTime: int64(1732601580000), SubmitTime: int64(1732239754684), }, } ignoreObsMonitorRetryFactoryJobInstanceBody:= true request.Body = &model.RetryFactoryJobInstanceBody{ TaskRetrys: &listTaskRetrysbody, IgnoreObsMonitor: &ignoreObsMonitorRetryFactoryJobInstanceBody, RetryTaskVersion: "original_version", RetryLocation: "errorNode", } response, err := client.RetryFactoryJobInstance(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
-
Rerun the current job and its upstream and downstream job instances of the test_job_name job.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dataartsstudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := dataartsstudio.NewDataArtsStudioClient( dataartsstudio.DataArtsStudioClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.RetryFactoryJobInstanceRequest{} request.JobName = "{job_name}" var listJobsbody = []model.RetryFactoryJobInstanceBodyJobs{ { JobName: "job_test_smn2", WorkspaceId: "62fbba734e634c5087656fc3ff7adf34", }, } concurrentRetryFactoryJobInstanceBody:= int32(2) endTimeRetryFactoryJobInstanceBody:= int64(1732612120000) beginTimeRetryFactoryJobInstanceBody:= int64(1732608520000) ignoreObsMonitorRetryFactoryJobInstanceBody:= true request.Body = &model.RetryFactoryJobInstanceBody{ Concurrent: &concurrentRetryFactoryJobInstanceBody, Jobs: &listJobsbody, EndTime: &endTimeRetryFactoryJobInstanceBody, BeginTime: &beginTimeRetryFactoryJobInstanceBody, IgnoreObsMonitor: &ignoreObsMonitorRetryFactoryJobInstanceBody, RetryTaskVersion: "current_version", RetryLocation: "errorNode", } response, err := client.RetryFactoryJobInstance(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
The job is re-executed successfully, and no response is returned. |
|
400 |
Response to a job re-execution failure. |
Feedback
Was this page helpful?
Provide feedbackThank 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