def __call__(self, *args, **kwargs): '''Invoke the task itself''' try: return self._obj(*args, **kwargs) except Exception as exc: logger.exception('Failed to run task %s' % self.name) raise(exc)
def make(cls, obj): '''Given a callable object, return a new callable object''' try: cls._cache.append(Task(obj)) except Exception: logger.exception('Unable to make task for %s' % repr(obj))