"""Runner interface for Applio job execution.""" from __future__ import annotations import abc import threading from ..jobs.models import Job class Runner(abc.ABC): """Abstract base for job runners.""" @abc.abstractmethod def execute(self, job: Job, cancel_event: threading.Event) -> None: """Execute the job. Must update job status/phase/log as it progresses. The runner is responsible for: - Setting phases and progress - Checking cancel_event periodically - Marking the job as success/failed/cancelled - Verifying expected output artifacts exist before marking success """ ... @abc.abstractmethod def name(self) -> str: """Human-readable runner name.""" ... @abc.abstractmethod def is_available(self) -> bool: """Check if the runner's backend is reachable.""" ...