espnet3.bin.atlas.core.models.StageResult
espnet3.bin.atlas.core.models.StageResult
class espnet3.bin.atlas.core.models.StageResult(status: ~typing.Literal['success', 'failure', 'timeout', 'retry', 'duplicate', 'skip', 'accepted', 'rejected', 'continue', 'done', 'no_budget', 'waiting_agent', 'waiting_job', 'terminal'], message: str = '', next_node: str | None = None, payload: dict[str, ~typing.Any] = <factory>, artifacts: dict[str, str] = <factory>)
Bases: object
The outcome of one BaseStage.run call, used to route the graph.
Persisted by BaseStage.execute as the node run’s success/failure marker, and read back on a re-dispatched run via from_json().
- Parameters:
- status – Outcome used by
ResearchGraph.routeto pick the next node (e.g."success","failure","timeout","terminal"). - message – Short human-readable description of the outcome.
- next_node – Explicit next-node override (bypassing the graph’s
onrouting), orNoneto route normally. - payload – Stage-specific result data.
- artifacts – Named output file paths the stage wrote.
- status – Outcome used by
artifacts : dict[str, str]
classmethod from_json(text: str) → StageResult
Reconstruct a result from the JSON written by to_json().
- Parameters:text – JSON text previously produced by
to_json(). - Returns: The reconstructed result.
- Return type:StageResult
Example
>>> StageResult.from_json('{"status": "success"}').status
'success'message : str = ''
next_node : str | None = None
payload : dict[str, Any]
status : Literal['success', 'failure', 'timeout', 'retry', 'duplicate', 'skip', 'accepted', 'rejected', 'continue', 'done', 'no_budget', 'waiting_agent', 'waiting_job', 'terminal']
to_dict() → dict[str, Any]
Return this result as a plain dict with all five fields.
- Parameters:None.
- Returns:
{"status", "message", "next_node", "payload", "artifacts"}. - Return type: dict[str, Any]
Example
>>> StageResult(status="success").to_dict()["status"]
'success'to_json() → str
Serialize this result to JSON, for the stage marker file.
- Parameters:None.
- Returns: JSON text, as produced by
json.dumps()onto_dict(). - Return type: str
Example
>>> StageResult(status="success").to_json()
'{\n "status": "success",\n ...\n}'