Skip to content

cancel_data_repository_task async

cancel_data_repository_task(
    *,
    config_overrides: Optional[AsyncFSxClientConfig] = None,
    task_id: Optional[TaskId] = None,
) -> CancelDataRepositoryTaskResponse

Cancels an existing Amazon FSx for Lustre data repository task if that task is in either the PENDING or EXECUTING state. When you cancel an export task, Amazon FSx does the following.

  • Any files that FSx has already exported are not reverted.

  • FSx continues to export any files that are in-flight when the cancel operation is received.

  • FSx does not export any files that have not yet been exported.

For a release task, Amazon FSx will stop releasing files upon cancellation. Any files that have already been released will remain in the released state.

Parameters:

  • task_id (Optional[TaskId], default: None ) –

    Specifies the data repository task to cancel.

Raises:

Source code in docs_src/capo_fsx/_services/async_f_sx.py
async def cancel_data_repository_task(
    self,
    *,
    config_overrides: Optional[AsyncFSxClientConfig] = None,
    task_id: Optional["capo_fsx.types.task_id.TaskId"] = None,
) -> "capo_fsx.types.cancel_data_repository_task_response.CancelDataRepositoryTaskResponse":
    """<p>Cancels an existing Amazon FSx for Lustre data repository task if that task is in either the <code>PENDING</code> or <code>EXECUTING</code> state. When you cancel an export task, Amazon FSx does the following.</p> <ul> <li> <p>Any files that FSx has already exported are not reverted.</p> </li> <li> <p>FSx continues to export any files that are in-flight when the cancel operation is received.</p> </li> <li> <p>FSx does not export any files that have not yet been exported.</p> </li> </ul> <p>For a release task, Amazon FSx will stop releasing files upon cancellation. Any files that have already been released will remain in the released state.</p>

    Args:
        task_id: <p>Specifies the data repository task to cancel.</p>

    Raises:
        capo_fsx.errors.bad_request.BadRequest: <p>A generic error indicating a failure with a client request.</p>
        capo_fsx.errors.data_repository_task_ended.DataRepositoryTaskEnded: <p>The data repository task could not be canceled because the task has already ended.</p>
        capo_fsx.errors.data_repository_task_not_found.DataRepositoryTaskNotFound: <p>The data repository task or tasks you specified could not be found.</p>
        capo_fsx.errors.internal_server_error.InternalServerError: <p>A generic error indicating a server-side failure.</p>
        capo_fsx.errors.unsupported_operation.UnsupportedOperation: <p>The requested operation is not supported for this resource or API.</p>
        capo_fsx.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_fsx.types.cancel_data_repository_task_request.CancelDataRepositoryTaskRequest]",
    ) -> AsyncOperationResponse[
        "capo_fsx.types.cancel_data_repository_task_response.CancelDataRepositoryTaskResponse"
    ]:
        import capo_fsx._operations.aws_simba_api_service_v20180301.cancel_data_repository_task

        (
            output,
            http_response,
        ) = await capo_fsx._operations.aws_simba_api_service_v20180301.cancel_data_repository_task.async_cancel_data_repository_task(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelDataRepositoryTask")
    )
    input_: capo_fsx.types.cancel_data_repository_task_request.CancelDataRepositoryTaskRequest = {}
    if task_id is not None:
        input_["task_id"] = task_id

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output