← Về thư mục
openai4s/execution/coordinator.py
- TicketState · class · L36-L43 — class TicketState(str, Enum)
- CoordinatorError · class · L58-L59 — class CoordinatorError(RuntimeError)
- CoordinatorClosed · class · L62-L63 — class CoordinatorClosed(CoordinatorError)
- ExecutionCancelled · class · L66-L67 — class ExecutionCancelled(CoordinatorError)
- TicketStateError · class · L70-L71 — class TicketStateError(CoordinatorError)
- QueueDepthExceeded · class · L74-L86 — class QueueDepthExceeded(CoordinatorError)
- ExecutionOwner · class · L90-L108 — class ExecutionOwner
- post_init · method · L101-L105 — def post_init(self) -> None
- as_dict · method · L107-L108 — def as_dict(self) -> dict[str, str]
- CancellationSignal · class · L111-L142 — class CancellationSignal
- init · method · L120-L123 — def init(self) -> None
- is_set · method · L125-L126 — def is_set(self) -> bool
- wait · method · L128-L129 — def wait(self, timeout: float | None = None) -> bool
- reason · method · L132-L134 — def reason(self) -> str | None
- _request · method · L136-L142 — def _request(self, reason: str) -> bool
- ExecutionTicket · class · L145-L263 — class ExecutionTicket
- init · method · L148-L183 — def init( self, *, coordinator_token: object, execution_id: str, session_id: str, owner: ExecutionOwner, queued_at: float, branch_id: str | None, language: str | None, generation_id: str | int | None, resource_keys: Sequence[str], metadata: Mapping[str, Any] | None, ) -> None
- state · method · L186-L188 — def state(self) -> TicketState
- status · method · L191-L192 — def status(self) -> str
- started_at · method · L195-L197 — def started_at(self) -> float | None
- finished_at · method · L200-L202 — def finished_at(self) -> float | None
- error · method · L205-L207 — def error(self) -> str | None
- cancelled · method · L210-L211 — def cancelled(self) -> bool
- wait_finished · method · L213-L216 — def wait_finished(self, timeout: float | None = None) -> bool
- snapshot · method · L218-L243 — def snapshot(self, *, queue_position: int | None = None) -> dict[str, Any]
- _transition · method · L245-L263 — def _transition( self, state: TicketState, *, at: float, error: str | None = None, ) -> None
- _SessionQueue · class · L267-L273 — class _SessionQueue
- SessionExecutionCoordinator · class · L281-L851 — class SessionExecutionCoordinator
- init · method · L289-L305 — def init( self, *, event_sink: EventSink | None = None, clock: Clock = time.time, id_factory: IdFactory | None = None, max_queue_depth: int = DEFAULT_MAX_QUEUE_DEPTH, ) -> None
- submit · method · L307-L370 — def submit( self, session_id: str, *, owner: ExecutionOwner | str, owner_id: str | None = None, execution_id: str | None = None, branch_id: str | None = None, language: str | None = None, generation_id: str | int | None = None, resource_keys: Sequence[str] = (), metadata: Mapping[str, Any] | None = None, ) -> ExecutionTicket
- wait_until_running · method · L372-L422 — def wait_until_running( self, ticket: ExecutionTicket, timeout: float | None = None ) -> ExecutionTicket
- execution · method · L425-L466 — def execution( self, session_id: str, *, owner: ExecutionOwner | str, owner_id: str | None = None, execution_id: str | None = None, branch_id: str | None = None, language: str | None = None, generation_id: str | int | None = None, resource_keys: Sequence[str] = (), metadata: Mapping[str, Any] | None = None, timeout: float | None = None, ) -> Iterator[ExecutionTicket]
- complete · method · L468-L471 — def complete(self, ticket: ExecutionTicket) -> bool
- fail · method · L473-L477 — def fail(self, ticket: ExecutionTicket, error: BaseException | str) -> bool
- cancel_queued · method · L479-L518 — def cancel_queued( self, *, session_id: str, execution_id: str, owner: ExecutionOwner | str, owner_id: str | None = None, reason: str = "cancelled by owner", ) -> bool
- request_interrupt · method · L520-L559 — def request_interrupt( self, *, session_id: str, execution_id: str, owner: ExecutionOwner | str, owner_id: str | None = None, reason: str = "interrupt requested by owner", ) -> bool
- snapshot · method · L561-L568 — def snapshot(self, session_id: str) -> dict[str, Any]
- snapshots · method · L570-L577 — def snapshots(self) -> dict[str, dict[str, Any]]
- close_session · method · L579-L582 — def close_session(self, session_id: str, *, reason: str = "session closed") -> bool
- cleanup_session · method · L584-L594 — def cleanup_session( self, session_id: str, *, reason: str = "session cleaned up" ) -> bool
- close · method · L596-L608 — def close(self, *, reason: str = "coordinator closed") -> None
- closed · method · L611-L613 — def closed(self) -> bool
- _finish · method · L615-L660 — def _finish(self, ticket: ExecutionTicket, *, error: str | None) -> bool
- _close_session · method · L662-L680 — def _close_session( self, session_id: str, *, reason: str, remove_when_idle: bool ) -> bool
- _close_session_locked · method · L682-L719 — def _close_session_locked( self, session_id: str, session: _SessionQueue, reason: str, events: list[dict[str, Any]], ) -> None
- _promote_locked · method · L721-L742 — def _promote_locked( self, session_id: str, session: _SessionQueue, events: list[dict[str, Any]], ) -> None
- _remove_idle_session_locked · method · L744-L750 — def _remove_idle_session_locked( self, session_id: str, session: _SessionQueue ) -> None
- _snapshot_locked · method · L752-L771 — def _snapshot_locked( self, session_id: str, session: _SessionQueue ) -> dict[str, Any]
- _empty_snapshot · method · L773-L783 — def _empty_snapshot(self, session_id: str) -> dict[str, Any]
- _queue_event_locked · method · L785-L792 — def _queue_event_locked( self, session_id: str, session: _SessionQueue ) -> dict[str, Any]
- _state_event · method · L794-L811 — def _state_event( self, ticket: ExecutionTicket, *, queue_position: int | None = None, reason: str | None = None, error: str | None = None, ) -> dict[str, Any]
- _owner_event · method · L813-L833 — def _owner_event( self, session_id: str, *, previous: ExecutionTicket | None, current: ExecutionTicket | None, reason: str, ) -> dict[str, Any]
- _validate_ticket · method · L835-L839 — def _validate_ticket(self, ticket: ExecutionTicket) -> None
- _emit · method · L841-L851 — def _emit(self, events: Sequence[dict[str, Any]]) -> None
- _coerce_owner · function · L854-L862 — def _coerce_owner(owner: ExecutionOwner | str, owner_id: str | None) -> ExecutionOwner
- _required · function · L865-L869 — def _required(name: str, value: object) -> str
- _error_text · function · L872-L874 — def _error_text(error: BaseException) -> str