perago.RuntimeTaskResult#

class perago.RuntimeTaskResult(*, status, output=None, reason_for_incompletion=None)[源代码]#

Validated result payload returned by a worker attempt.

RuntimeTaskResult is Perago's internal representation of the status and payload that will be written back to Conductor. It enforces the mutually exclusive success and failure payload shapes before the SDK payload is assembled.

Parameters:
status{"COMPLETED", "FAILED", "FAILED_WITH_TERMINAL_ERROR"}

Conductor task result status selected by the worker runtime.

outputdict of str to Any or None, default=None

Completed task output. COMPLETED results require this field, while failed results reject it.

reason_for_incompletionstr or None, default=None

Failure reason. FAILED and FAILED_WITH_TERMINAL_ERROR results require this field, while COMPLETED results reject it.

Raises:
pydantic.ValidationError

If the payload shape is inconsistent with status or if unknown fields are provided.

参数:
  • status (Literal['COMPLETED', 'FAILED', 'FAILED_WITH_TERMINAL_ERROR'])

  • output (dict[str, Any] | None)

  • reason_for_incompletion (str | None)

参见

completed_result

Build a completed result.

failed_result

Build a retryable failed result.

terminal_failed_result

Build a terminal failed result.

result_for_exception

Classify an exception into a runtime result.

Notes

The model is frozen and rejects unknown fields. worker_id is not part of this payload; it is attached separately when the Conductor SDK task result is updated.

Examples

>>> RuntimeTaskResult(status="COMPLETED", output={"result": {"ok": True}})
RuntimeTaskResult(...)

Methods

conductor_payload()

Convert the result to the Conductor update payload shape.

validate_payload_shape()

Validate the mutually exclusive result payload shape.

Attributes

status

output

reason_for_incompletion