Skip to content

Commit

Permalink
Switch to job protocol
Browse files Browse the repository at this point in the history
This is really just for MyPy, it was triggering python/mypy#5485
  • Loading branch information
Hovercross committed May 3, 2022
1 parent 9a07721 commit d33d563
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion job_runner/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from structlog import get_logger
from job_runner.environment import TrackerEnv, get_environments

from job_runner.tracker import RegisteredJob, RunEnv
from job_runner.tracker import RegisteredJob

logger = get_logger(__name__)

Expand Down
8 changes: 5 additions & 3 deletions job_runner/tracker.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
"""Tracking utils for job runner"""

from threading import Event
from typing import Callable, List, Optional, Union
from typing import List, Protocol
from datetime import timedelta
from dataclasses import dataclass
from threading import Lock

from .environment import RunEnv
from .time import AutoTime, read_auto_time

Job = Callable[[RunEnv], None]

class Job(Protocol):
def __call__(self, env: RunEnv) -> None:
"""Call a job with the environment"""


@dataclass(frozen=True)
Expand Down

0 comments on commit d33d563

Please sign in to comment.