def __init__( self, func: Callable, *, app: app.App, # task naming name: Optional[str] = None, aliases: Optional[List[str]] = None, # task specific settings retry: retry_module.RetryValue = False, pass_context: bool = False, # default defer arguments queue: str, lock: Optional[str] = None, queueing_lock: Optional[str] = None, ): self.queue = queue self.app = app self.func: Callable = func self.aliases = aliases if aliases else [] self.retry_strategy = retry_module.get_retry_strategy(retry) self.name: str = name if name else self.full_path self.pass_context = pass_context self.lock = lock self.queueing_lock = queueing_lock
def __init__( self, func: Callable, *, app: app.App, queue: str, name: Optional[str] = None, retry: retry_module.RetryValue = False, pass_context: bool = False, ): self.queue = queue self.app = app self.func: Callable = func self.retry_strategy = retry_module.get_retry_strategy(retry) self.name: str = name if name else self.full_path self.pass_context = pass_context
def __init__( self, func: Callable, *, app: app.App, queue: str, name: Optional[str] = None, retry: retry_module.RetryValue = False, ): self.queue = queue self.app = app self.func: Callable = func self.retry_strategy = retry_module.get_retry_strategy(retry) self.name: str if name: self.name = name else: self.name = self.full_path if name: try: full_path = self.full_path except AttributeError: # Can happen for functools.partial for example full_path = "" if full_path and name != full_path: logger.warning( f"Task {name} at {self.full_path} has a name that doesn't match " "its import path. Please make sure its module path is provided in " "the worker's import_paths, or it won't run.", extra={ "action": "task_name_differ_from_path", "task_name": name, "task_path": self.full_path, }, )
def test_get_retry_strategy(retry, expected_strategy): assert expected_strategy == retry_module.get_retry_strategy(retry)