15
15
from multiprocessing import Process
16
16
from signal import Signals # type: ignore
17
17
18
- from .logs import default_log_config
19
18
from .jobs import Job
19
+ from .logs import default_log_config
20
+ from .main import Actor # noqa
20
21
from .utils import RedisMixin , ellipsis , gen_random , timestamp
21
22
22
23
__all__ = ['BaseWorker' , 'RunWorkerProcess' , 'StopJob' , 'import_string' ]
@@ -42,7 +43,7 @@ class BadJob(ArqError):
42
43
43
44
44
45
class StopJob (ArqError ):
45
- def __init__ (self , reason : str = '- ' , warning : bool = False ):
46
+ def __init__ (self , reason : str = '' , warning : bool = False ) -> None :
46
47
self .warning = warning
47
48
super ().__init__ (reason )
48
49
@@ -97,7 +98,7 @@ def __init__(self, *,
97
98
98
99
self .jobs_complete , self .jobs_failed , self .jobs_timed_out = 0 , 0 , 0
99
100
self ._task_exception = None # type: Exception
100
- self ._shadow_lookup = {} # type: Dict[str, object] # TODO
101
+ self ._shadow_lookup = {} # type: Dict[str, Actor]
101
102
self .start = None # type: float
102
103
self .last_health_check = 0
103
104
self .running = True
@@ -363,10 +364,10 @@ def handle_prepare_exc(self, msg: str):
363
364
@classmethod
364
365
def handle_stop_job (cls , started_at : float , exc : StopJob , j : Job ):
365
366
if exc .warning :
366
- msg , logger = '%-4s ran in%7.3fs . %s: Stopped Warning, %s' , jobs_logger .warning
367
+ msg , logger = '%-4s ran in%7.3fs ■ %s.%s ● Stopped Warning %s' , jobs_logger .warning
367
368
else :
368
- msg , logger = '%-4s ran in%7.3fs . %s: Stopped, %s' , jobs_logger .info
369
- logger (msg , j .queue , timestamp () - started_at , j , exc )
369
+ msg , logger = '%-4s ran in%7.3fs ■ %s.%s ● Stopped %s' , jobs_logger .info
370
+ logger (msg , j .queue , timestamp () - started_at , j . class_name , j . func_name , exc )
370
371
371
372
@classmethod
372
373
def handle_execute_exc (cls , started_at : float , exc : BaseException , j : Job ):
0 commit comments