Task 007 add agent job admin runner follow-up
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
from pathlib import Path
|
||||
@@ -90,6 +91,34 @@ def run_fake_runner_once(
|
||||
)
|
||||
|
||||
|
||||
def run_fake_runner_loop(
|
||||
*,
|
||||
backend_url: str,
|
||||
workspace_root: Path,
|
||||
poll_interval_seconds: float,
|
||||
) -> None:
|
||||
backend_client = HttpBackendJobClient(backend_url)
|
||||
while True:
|
||||
try:
|
||||
run_fake_runner_once(backend_client, workspace_root=workspace_root)
|
||||
except Exception:
|
||||
pass
|
||||
time.sleep(poll_interval_seconds)
|
||||
|
||||
|
||||
def get_backend_url() -> str:
|
||||
backend_url = os.environ.get("BACKEND_URL")
|
||||
if not backend_url:
|
||||
raise RuntimeError("BACKEND_URL is required for fake runner")
|
||||
return backend_url
|
||||
|
||||
|
||||
def get_workspace_root() -> Path:
|
||||
return Path(
|
||||
os.environ.get("RUNNER_WORKSPACE_ROOT", "/tmp/pipeline-runner-workspaces")
|
||||
)
|
||||
|
||||
|
||||
def materialize_fake_workspace(
|
||||
job: dict[str, Any],
|
||||
*,
|
||||
|
||||
Reference in New Issue
Block a user