Skip to content

send_task_success

send_task_success(
    task_token: TaskToken,
    output: SensitiveData,
    *,
    config_overrides: Optional[SFNClientConfig] = None,
) -> SendTaskSuccessOutput

Used by activity workers, Task states using the callback pattern, and optionally Task states using the job run pattern to report that the task identified by the taskToken completed successfully.

Parameters:

  • task_token (TaskToken) –

    The token that represents this task. Task tokens are generated by Step Functions when tasks are assigned to a worker, or in the context object when a workflow enters a task state. See GetActivityTaskOutput$taskToken.

  • output (SensitiveData) –

    The JSON output of the task. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

Raises:

  • InvalidOutput –

    The provided JSON output data is not valid.

  • InvalidToken –

    The provided token is not valid.

  • KmsAccessDeniedException –

    Either your KMS key policy or API caller does not have the required permissions.

  • KmsInvalidStateException –

    The KMS key is not in valid state, for example: Disabled or Deleted.

  • KmsThrottlingException –

    Received when KMS returns ThrottlingException for a KMS call that Step Functions makes on behalf of the caller.

  • TaskDoesNotExist –

    The activity does not exist.

  • TaskTimedOut –

    The task token has either expired or the task associated with the token has already been closed.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sfn/_services/sfn.py
def send_task_success(
    self,
    task_token: "capo_sfn.types.task_token.TaskToken",
    output: "capo_sfn.types.sensitive_data.SensitiveData",
    *,
    config_overrides: Optional[SFNClientConfig] = None,
) -> "capo_sfn.types.send_task_success_output.SendTaskSuccessOutput":
    """<p>Used by activity workers, Task states using the <a href="https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token">callback</a> pattern, and optionally Task states using the <a href="https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync">job run</a> pattern to report that the task identified by the <code>taskToken</code> completed successfully.</p>

    Args:
        task_token: <p>The token that represents this task. Task tokens are generated by Step Functions when tasks are assigned to a worker, or in the <a href="https://docs.aws.amazon.com/step-functions/latest/dg/input-output-contextobject.html">context object</a> when a workflow enters a task state. See <a>GetActivityTaskOutput$taskToken</a>.</p>
        output: <p>The JSON output of the task. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.</p>

    Raises:
        capo_sfn.errors.invalid_output.InvalidOutput: <p>The provided JSON output data is not valid.</p>
        capo_sfn.errors.invalid_token.InvalidToken: <p>The provided token is not valid.</p>
        capo_sfn.errors.kms_access_denied_exception.KmsAccessDeniedException: <p>Either your KMS key policy or API caller does not have the required permissions.</p>
        capo_sfn.errors.kms_invalid_state_exception.KmsInvalidStateException: <p>The KMS key is not in valid state, for example: Disabled or Deleted.</p>
        capo_sfn.errors.kms_throttling_exception.KmsThrottlingException: <p>Received when KMS returns <code>ThrottlingException</code> for a KMS call that Step Functions makes on behalf of the caller.</p>
        capo_sfn.errors.task_does_not_exist.TaskDoesNotExist: <p>The activity does not exist.</p>
        capo_sfn.errors.task_timed_out.TaskTimedOut: <p>The task token has either expired or the task associated with the token has already been closed.</p>
        capo_sfn.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sfn.types.send_task_success_input.SendTaskSuccessInput]",
    ) -> OperationResponse[
        "capo_sfn.types.send_task_success_output.SendTaskSuccessOutput"
    ]:
        import capo_sfn._operations.aws_step_functions.send_task_success

        output, http_response = (
            capo_sfn._operations.aws_step_functions.send_task_success.send_task_success(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_sfn.types.send_task_success_input.SendTaskSuccessInput",
    ) -> dict[str, Any]:
        import capo_sfn.types.send_task_success_input

        return capo_sfn.types.send_task_success_input.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("SendTaskSuccess", redact_input=_redact_input),
    )
    input_: capo_sfn.types.send_task_success_input.SendTaskSuccessInput = {
        "task_token": task_token,
        "output": output,
    }

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