def wrapper(*args, **kwargs): logging.info('Running %s' % getattr(f, '__name__', repr(f))) start = time.time() res = f(Context(), *args, **kwargs) end = time.time() finished = 'Finished %s (%0.3fs)' % (getattr(f, '__name__', repr(f)), end - start) notify(finished) logging.info(finished) return res
def inner_wrapper(*args, **kwargs): logging.info('Running %s' % getattr(f, '__name__', repr(f))) t = ThreadPool(remote_limit) for host in hosts: ctx = Context(remote_kwargs=remote_kwargs) ctx.set_host(host) t.add_func(f, ctx, *args, **kwargs) start = time.time() t.run_all() end = time.time() finished = ('Finished %s (%0.3fs)' % (getattr(f, '__name__', repr(f)), end - start)) notify(finished) logging.info(finished)