def custom_exp_backoff(*args, **kwargs): if max_repeat: kwargs["max_repeat"] = max_repeat if get_cache_value(uid=task_uid, attribute="status", model_name="ExportTaskRecord") == TaskState.CANCELED.value: logger.error(f"The task uid: {task_uid} was canceled. Exiting...") raise Exception("The task was canceled.") exp_backoff(*args, **kwargs)
def work_loop(self): while True: tiles = self.tiles_queue.get() if tiles is None: return with self.tile_mgr.session(): exp_backoff(self.tile_mgr.load_tile_coords, args=(tiles,), exceptions=(SourceError, IOError), ignore_exceptions=(LockTimeout, ))
def work_loop(self): while True: tiles = self.tiles_queue.get() if tiles is None: return with self.tile_mgr.session(): exp_backoff(self.tile_mgr.load_tile_coords, args=(tiles,), max_repeat=100, max_backoff=600, exceptions=(SourceError, IOError), ignore_exceptions=(LockTimeout, ))
def custom_exp_backoff(*args, **kwargs): if max_repeat: kwargs['max_repeat'] = max_repeat exp_backoff(*args, **kwargs)