42 lines
891 B
Python
42 lines
891 B
Python
"""Base worker adapter contract."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import abc
|
|
|
|
|
|
class WorkerAdapter(abc.ABC):
|
|
worker_name = "base"
|
|
|
|
@abc.abstractmethod
|
|
def capabilities(self) -> list[str]:
|
|
raise NotImplementedError
|
|
|
|
@abc.abstractmethod
|
|
def claim(self, task):
|
|
raise NotImplementedError
|
|
|
|
@abc.abstractmethod
|
|
def execute(self, task, claim):
|
|
raise NotImplementedError
|
|
|
|
@abc.abstractmethod
|
|
def heartbeat(self, claim):
|
|
raise NotImplementedError
|
|
|
|
@abc.abstractmethod
|
|
def report_progress(self, claim, progress):
|
|
raise NotImplementedError
|
|
|
|
@abc.abstractmethod
|
|
def probe(self, claim):
|
|
raise NotImplementedError
|
|
|
|
@abc.abstractmethod
|
|
def cancel(self, claim):
|
|
raise NotImplementedError
|
|
|
|
@abc.abstractmethod
|
|
def collect_result(self, claim):
|
|
raise NotImplementedError
|