Integrate task runner into python tools

This commit is contained in:
ajp_anton
2026-08-08 17:21:50 +00:00
parent f8fb1eed75
commit 56d6194324
22 changed files with 1137 additions and 7 deletions
+44
View File
@@ -0,0 +1,44 @@
from __future__ import annotations
import sys
from pathlib import Path
import pytest
from app.config import Settings
from app.discovery import TaskCatalog
from app.runner import RunManager
from app.store import RunStore
@pytest.fixture
def settings(tmp_path: Path) -> Settings:
return Settings(
task_root=tmp_path / "tasks",
state_root=tmp_path / "state",
credentials_root=tmp_path / "credentials",
python_executable=sys.executable,
timezone_name="Etc/UTC",
allowed_proxy_ips=frozenset(),
cancel_grace_seconds=0.1,
)
@pytest.fixture
def manager(settings: Settings) -> RunManager:
settings.task_root.mkdir(parents=True)
store = RunStore(settings.database_path)
store.initialize()
return RunManager(settings, TaskCatalog(settings.task_root), store)
def write_task(
task_root: Path,
group: str,
filename: str,
source: str,
) -> Path:
path = task_root / group / filename
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(source, encoding="utf-8")
return path