def perform(self): """Runs the job calling all the job signals as appropriate""" self.run_event("job_prerun") try: if "job_wrapper" in self.events: result = with_nested_contexts(self.events["job_wrapper"], self.func, [self], self.kwargs) else: result = self.func(**self.kwargs) self.run_event("job_postrun", result=result) return True except Exception, exc: self.run_event("job_failure", exc=exc) return False
def perform(self): """Runs the job calling all the job signals as appropriate""" self.run_event('job_prerun') try: if 'job_wrapper' in self.events: result = with_nested_contexts(self.events['job_wrapper'], self.func, [self], self.kwargs) else: result = self.func(**self.kwargs) self.run_event('job_postrun', result=result) return True except Exception, exc: self.run_event('job_failure', exc=exc) return False
def _call_with_contexts(self, ctx_managers, func, kwargs): from retools.util import with_nested_contexts return with_nested_contexts(ctx_managers, func, [], kwargs)