setTaskStatus method
- required String taskId,
- required TaskStatus taskStatus,
- String? errorId,
- String? errorMessage,
- String? errorStackTrace,
Task runners call SetTaskStatus
to notify AWS Data Pipeline
that a task is completed and provide information about the final status. A
task runner makes this call regardless of whether the task was sucessful.
A task runner does not need to call SetTaskStatus
for tasks
that are canceled by the web service during a call to
ReportTaskProgress.
May throw InternalServiceError. May throw TaskNotFoundException. May throw InvalidRequestException. May throw PipelineNotFoundException. May throw PipelineDeletedException.
Parameter taskId
:
The ID of the task assigned to the task runner. This value is provided in
the response for PollForTask.
Parameter taskStatus
:
If FINISHED
, the task successfully completed. If
FAILED
, the task ended unsuccessfully. Preconditions use
false.
Parameter errorId
:
If an error occurred during the task, this value specifies the error code.
This value is set on the physical attempt object. It is used to display
error information to the user. It should not start with string "Service_"
which is reserved by the system.
Parameter errorMessage
:
If an error occurred during the task, this value specifies a text
description of the error. This value is set on the physical attempt
object. It is used to display error information to the user. The web
service does not parse this value.
Parameter errorStackTrace
:
If an error occurred during the task, this value specifies the stack trace
associated with the error. This value is set on the physical attempt
object. It is used to display error information to the user. The web
service does not parse this value.
Implementation
Future<void> setTaskStatus({
required String taskId,
required TaskStatus taskStatus,
String? errorId,
String? errorMessage,
String? errorStackTrace,
}) async {
ArgumentError.checkNotNull(taskId, 'taskId');
_s.validateStringLength(
'taskId',
taskId,
1,
2048,
isRequired: true,
);
ArgumentError.checkNotNull(taskStatus, 'taskStatus');
_s.validateStringLength(
'errorId',
errorId,
0,
1024,
);
_s.validateStringLength(
'errorStackTrace',
errorStackTrace,
0,
1024,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'DataPipeline.SetTaskStatus'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'taskId': taskId,
'taskStatus': taskStatus.toValue(),
if (errorId != null) 'errorId': errorId,
if (errorMessage != null) 'errorMessage': errorMessage,
if (errorStackTrace != null) 'errorStackTrace': errorStackTrace,
},
);
}