← Về thư mục
openai4s/compute/manager.py
- _confinement_mode · function · L85-L94 — def _confinement_mode(value: str | None = None) -> str
- ComputeError · class · L105-L136 — class ComputeError(RuntimeError)
- init · method · L118-L136 — def init( self, msg: str, kind: str = "transient", concurrency: dict | None = None, *, indeterminate: bool | None = None, )
- _helper_exec_env · function · L162-L196 — def _helper_exec_env( environ: dict[str, str], declared_secret_env: list[str] | tuple[str, ...] = () ) -> dict[str, str]
- _safe_remote_path · function · L199-L218 — def _safe_remote_path(value: str, *, label: str) -> str
- _safe_alias · function · L229-L240 — def _safe_alias(value: str) -> str
- _safe_stage_name · function · L243-L265 — def _safe_stage_name(value: str, *, label: str) -> str
- _declared_input_versions · function · L268-L278 — def _declared_input_versions(inputs: Any) -> list[str]
- _sandbox_lifetime_s · function · L281-L298 — def _sandbox_lifetime_s(spec: Any) -> int
- _find_stay_clause · function · L375-L397 — def _find_stay_clause(patterns: list[str]) -> tuple[str, str]
- _ssh_harvest_script · function · L400-L473 — def _ssh_harvest_script( workdir: str, max_file_bytes: int, exclude_patterns: list[str] | None = None ) -> str
- _prune_local_matches · function · L476-L494 — def _prune_local_matches(dest: Path, patterns: list[str]) -> list[str]
- _parse_harvest_ack · function · L497-L528 — def _parse_harvest_ack(stdout: str) -> tuple[str, list[str], list[str], int | None]
- _parse_ssh_submit_ack · function · L537-L555 — def _parse_ssh_submit_ack(stdout: str) -> tuple[str, str]
- _ssh_cancel_script · function · L558-L620 — def _ssh_cancel_script(pgid: str, pid: str = "") -> str
- _BoundedSink · class · L623-L676 — class _BoundedSink
- init · method · L638-L643 — def init(self, cap: int, *, keep: str) -> None
- feed · method · L645-L657 — def feed(self, chunk: bytes) -> None
- truncated · method · L660-L662 — def truncated(self) -> bool
- value · method · L664-L676 — def value(self, *, annotate: bool = False) -> bytes
- _drain · function · L679-L685 — def _drain(stream: Any, sink: _BoundedSink) -> None
- CappedProcess · class · L688-L703 — class CappedProcess(subprocess.CompletedProcess)
- init · method · L691-L703 — def init( self, args: Any, returncode: int, stdout: bytes, stderr: bytes, *, stdout_truncated: bool = False, stderr_truncated: bool = False, ) -> None
- _run_capped · function · L706-L817 — def _run_capped( argv: list[str], *, timeout: float, input: bytes | None = None, stdout_cap: int | None = None, stderr_cap: int | None = None, ) -> CappedProcess
- _feed_stdin · function · L757-L771 — def _feed_stdin() -> None: # Its own thread: a script larger than the pipe buffer would otherwise # block here while the child is blocked writing output nobody is # reading yet.
- _watchdog · function · L780-L785 — def _watchdog() -> None
- _now_ms · function · L820-L821 — def _now_ms() -> int
- _open_store · function · L824-L837 — def _open_store(cfg: Any)
- _discover_providers · function · L840-L870 — def _discover_providers(skills_dir: Path) -> dict[str, dict]
- _rmtree_at · function · L873-L898 — def _rmtree_at(parent_fd: int, name: str) -> None
- _copytree_at · function · L901-L928 — def _copytree_at(src: Path, parent_fd: int, name: str) -> None
- ComputeManager · class · L931-L3866 — class ComputeManager
- init · method · L949-L1010 — def init(self, cfg: Any, store: Any = None, workspace: Any = None)
- _safe_harvest_dest · method · L1012-L1046 — def _safe_harvest_dest(self, job_id: str) -> Path
- _host_staging_dir · method · L1048-L1056 — def _host_staging_dir(self, job_id: str) -> Path
- _publish_harvest · method · L1058-L1112 — def _publish_harvest(self, staging: Path, dest: Path) -> None
- _rehydrate · method · L1115-L1141 — def _rehydrate(self) -> None
- _from_record · method · L1144-L1160 — def _from_record(record: dict) -> dict
- _persist · method · L1162-L1170 — def _persist(self, job_id: str, **fields: Any) -> None
- _checked_update · method · L1172-L1192 — def _checked_update(self, job_id: str, **fields: Any) -> bool
- _persist_terminal · method · L1194-L1203 — def _persist_terminal(self, job_id: str, **fields: Any) -> bool
- _persist_receipt · method · L1205-L1217 — def _persist_receipt(self, job_id: str, **fields: Any) -> bool
- _degrade_submit_to_indeterminate · method · L1219-L1282 — def _degrade_submit_to_indeterminate( self, job_id: str, *, provider: str, reason: str, sandbox_id: str | None = None, alias: str | None = None, workdir: str | None = None, pid: str | None = None, pgid: str | None = None, extra_return: dict | None = None, ) -> dict
- _commit_terminal · method · L1284-L1340 — def _commit_terminal( self, job: dict, status: str, , event: str | None = None, event_payload: dict | None = None, *fields: Any, ) -> dict | None
- _terminal_conflict_result · method · L1343-L1367 — def _terminal_conflict_result( job: dict, requested: str, row: dict, output_files: list[str], artifact_manifest: list[dict] | None = None, ) -> dict
- _event · method · L1369-L1375 — def _event(self, job_id: str, kind: str, payload: dict | None = None) -> None
- _track_live · method · L1377-L1394 — def _track_live( self, job_id: str, provider: str, status: str, **fields: Any ) -> None
- _fail_submit · method · L1396-L1473 — def _fail_submit( self, job_id: str, exc: BaseException, *, provider: str, sandbox_id: str | None = None, ) -> None
- _claim · method · L1475-L1546 — def _claim( self, provider: str, idempotency_key: str | None, outputs: Any, input_versions: list[str] | None = None, ) -> str
- reconcile · method · L1548-L1595 — def reconcile(self, kw: dict | None = None) -> dict
- job_history · method · L1597-L1621 — def job_history(self, kw: dict) -> dict
- confinement_status · method · L1623-L1644 — def confinement_status(self) -> dict
- _confinement_gate · method · L1646-L1669 — def _confinement_gate(self, pid: str) -> None
- has_any_provider · method · L1672-L1673 — def has_any_provider(self) -> bool
- _has_ssh_skill · method · L1675-L1679 — def _has_ssh_skill(self) -> bool
- provider_caps · method · L1681-L1685 — def provider_caps(self) -> dict
- _resolve_install_id · method · L1688-L1703 — def _resolve_install_id() -> str
- _split · method · L1706-L1716 — def _split(self, provider: str) -> tuple[str, str]
- _named_destination · method · L1718-L1747 — def _named_destination(self, alias: str) -> str
- _ssh_argv · method · L1749-L1756 — def _ssh_argv(self, alias: str, *rest: str) -> list[str]
- _scp_argv · method · L1758-L1768 — def _scp_argv( self, alias: str, *, remote: str, local: str, upload: bool ) -> list[str]
- _byoc · method · L1770-L1778 — def _byoc(self, pid: str) -> dict
- _live_count · method · L1781-L1785 — def _live_count(self) -> int: #
states.is_live rather than a local tuple: this list and the one the # rehydrating SQL used disagreed about staging, so a row left there # by a crash was reported by reconcile forever while occupying no slot.
- set_concurrency · method · L1787-L1790 — def set_concurrency(self, kw: dict) -> dict
- status · method · L1792-L1798 — def status(self, kw: dict) -> dict
- _run_helper · method · L1801-L1952 — def _run_helper( self, prov: dict, op: str, req: dict, creds: dict, stage: Path, expect_confined: bool | None = None, timeout: float | None = None, ) -> dict
- _spawn_helper · method · L1954-L1994 — def _spawn_helper( self, argv: list[str], creds: dict, env: dict, deadline: float, op: str, stage: Path, ) -> Any
- _helper_error · method · L1997-L2019 — def _helper_error( stage: Path, msg: str, kind: str, *, indeterminate: bool ) -> ComputeError
- _provider_creds · method · L2021-L2026 — def _provider_creds(self, prov: dict) -> dict
- submit · method · L2029-L2057 — def submit( self, kw: dict, *, trusted_version_paths: dict[str, str] | None = None, ) -> dict
- _stage_inputs · method · L2059-L2119 — def _stage_inputs( self, stage: Path, inputs: list | None, command: str, timeout_s: int, *, trusted_version_paths: dict[str, str] | None = None, ) -> Path
- _submit_byoc · method · L2121-L2239 — def _submit_byoc( self, pid: str, kw: dict, *, trusted_version_paths: dict[str, str] | None = None, ) -> dict
- _submit_ssh · method · L2242-L2466 — def _submit_ssh(self, alias: str, kw: dict) -> dict
- result · method · L2469-L2491 — def result(self, kw: dict) -> dict
- _result_byoc · method · L2493-L2658 — def _result_byoc(self, job: dict) -> dict: # Before the provider is dispatched at all, exactly as the ssh path # does. A byoc sandbox is warm and reused: submitting job B wipes # /work, so re-polling job A after B ran would harvest B's phase and # archive, publish those bytes under A's job id, and replace A's durable # manifest, digest and terminal timestamp with them.
wait is also not # free — it blocks on the provider for a job that already ended.
- _harvest · method · L2660-L2688 — def _harvest(self, job_id: str, stage: Path) -> tuple[list[dict], Path | None]
- _stored_terminal_result · method · L2690-L2736 — def _stored_terminal_result( self, job: dict, *, left_on_remote: bool = True ) -> dict | None
- _result_ssh · method · L2738-L2935 — def _result_ssh(self, job: dict) -> dict: # Already terminal: return the recorded evidence rather than re-harvest # and overwrite it. The recorded outcome is authoritative. Asked of the # ledger unconditionally, not gated on the in-memory status, because the # in-memory copy is the thing that can be stale.
- _harvest_pending · method · L2937-L3000 — def _harvest_pending( self, job: dict, exit_code: int, reason: str, workdir: str ) -> dict | None
- _ssh_unknown · method · L3002-L3023 — def _ssh_unknown(self, job: dict, reason: str) -> dict
- _harvest_ssh · method · L3025-L3162 — def _harvest_ssh( self, alias: str, workdir: str, dest: Path, exclude_patterns: list[str] | None = None, ) -> tuple[str | None, list[str], list[str], bool]
- _fetch_archive_capped · method · L3164-L3283 — def _fetch_archive_capped( self, alias: str, workdir: str, local: Path, cap: int, timeout: float = 300.0, ) -> None
- _drain_stderr · function · L3204-L3215 — def _drain_stderr() -> None
- _watchdog · function · L3221-L3226 — def _watchdog() -> None
- _cleanup_remote_archive · method · L3288-L3296 — def _cleanup_remote_archive(self, alias: str, workdir: str) -> None
- _terminate_ssh_job · method · L3299-L3337 — def _terminate_ssh_job(self, job: dict) -> None
- _terminate_sandbox · method · L3339-L3349 — def _terminate_sandbox(self, pid: str, sandbox_id: str) -> None
- _cancel_failure · method · L3351-L3381 — def _cancel_failure(self, error: ComputeError) -> ComputeError
- _record_unconfirmed_cancel · method · L3383-L3413 — def _record_unconfirmed_cancel(self, job: dict, error: ComputeError) -> None
- cancel · method · L3415-L3502 — def cancel(self, kw: dict) -> dict
- close · method · L3504-L3661 — def close(self, kw: dict) -> dict
- _release_sandbox · function · L3540-L3547 — def _release_sandbox(sandbox_id: str) -> BaseException | None
- _live_jobs_on_sandbox · method · L3663-L3677 — def _live_jobs_on_sandbox(self, sandbox_id: str, exclude: set[str]) -> list[dict]
- _sandbox_ids_for · method · L3679-L3698 — def _sandbox_ids_for(self, provider_id: str) -> list[str]
- ssh · method · L3700-L3751 — def ssh(self, kw: dict) -> dict
- scp · method · L3753-L3793 — def scp(self, kw: dict) -> dict
- _safe_local_path · method · L3795-L3824 — def _safe_local_path( self, value: Any, *, label: str, must_exist: bool = False ) -> Path
- _enforce_transfer_cap · method · L3827-L3837 — def _enforce_transfer_cap(path: Path) -> None
- _audit · method · L3839-L3846 — def _audit(self, event: str, **fields: Any) -> None
- _run_scp · method · L3849-L3866 — def _run_scp(argv: list[str], what: str) -> None