Skip to content

Commit e34282b

Browse files
committed
Make Job an abstract base class
1 parent c4466d3 commit e34282b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

plain-jobs/plain/jobs/jobs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import datetime
44
import inspect
55
import logging
6+
from abc import ABCMeta, abstractmethod
67
from typing import TYPE_CHECKING, Any
78

89
from opentelemetry import trace
@@ -33,7 +34,7 @@
3334
tracer = trace.get_tracer("plain.jobs")
3435

3536

36-
class JobType(type):
37+
class JobType(ABCMeta):
3738
"""
3839
Metaclass allows us to capture the original args/kwargs
3940
used to instantiate the job, so we can store them in the database
@@ -48,8 +49,9 @@ def __call__(self, *args: Any, **kwargs: Any) -> Job:
4849

4950

5051
class Job(metaclass=JobType):
52+
@abstractmethod
5153
def run(self) -> None:
52-
raise NotImplementedError
54+
pass
5355

5456
def run_in_worker(
5557
self,

0 commit comments

Comments
 (0)