Skip to content

cancel_task_execution

cancel_task_execution(
    task_execution_arn: TaskExecutionArn,
    *,
    config_overrides: Optional[DataSyncClientConfig] = None,
) -> CancelTaskExecutionResponse

Stops an DataSync task execution that's in progress. The transfer of some files are abruptly interrupted. File contents that're transferred to the destination might be incomplete or inconsistent with the source files.

However, if you start a new task execution using the same task and allow it to finish, file content on the destination will be complete and consistent. This applies to other unexpected failures that interrupt a task execution. In all of these cases, DataSync successfully completes the transfer when you start the next task execution.

Parameters:

  • task_execution_arn (TaskExecutionArn) –

    The Amazon Resource Name (ARN) of the task execution to stop.

Raises:

Source code in docs_src/capo_datasync/_services/data_sync.py
def cancel_task_execution(
    self,
    task_execution_arn: "capo_datasync.types.task_execution_arn.TaskExecutionArn",
    *,
    config_overrides: Optional[DataSyncClientConfig] = None,
) -> (
    "capo_datasync.types.cancel_task_execution_response.CancelTaskExecutionResponse"
):
    """<p>Stops an DataSync task execution that's in progress. The transfer of some files are abruptly interrupted. File contents that're transferred to the destination might be incomplete or inconsistent with the source files.</p> <p>However, if you start a new task execution using the same task and allow it to finish, file content on the destination will be complete and consistent. This applies to other unexpected failures that interrupt a task execution. In all of these cases, DataSync successfully completes the transfer when you start the next task execution.</p>

    Args:
        task_execution_arn: <p>The Amazon Resource Name (ARN) of the task execution to stop.</p>

    Raises:
        capo_datasync.errors.internal_exception.InternalException: <p>This exception is thrown when an error occurs in the DataSync service.</p>
        capo_datasync.errors.invalid_request_exception.InvalidRequestException: <p>This exception is thrown when the client submits a malformed request.</p>
        capo_datasync.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_datasync.types.cancel_task_execution_request.CancelTaskExecutionRequest]",
    ) -> OperationResponse[
        "capo_datasync.types.cancel_task_execution_response.CancelTaskExecutionResponse"
    ]:
        import capo_datasync._operations.fmrs_service.cancel_task_execution

        output, http_response = (
            capo_datasync._operations.fmrs_service.cancel_task_execution.cancel_task_execution(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelTaskExecution")
    )
    input_: capo_datasync.types.cancel_task_execution_request.CancelTaskExecutionRequest = {
        "task_execution_arn": task_execution_arn
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output