class CryptoWorkers(threading.Thread): def __init__(self, workers_cmd, num_workers, working_dir, env, **kw): threading.Thread.__init__(self) self.workers = Workers(workers_cmd, num_workers=num_workers, working_dir=working_dir, env=env, **kw) def run(self): logger.debug('Starting powerhose workers') self.workers.run() def stop(self): logger.debug('Stopping powerhose workers') self.workers.stop() self.join()
def __init__(self, workers_cmd, num_workers, working_dir, env, controller, pubsub_endpoint, **kw): threading.Thread.__init__(self) pid = str(thread.get_ident()) # XXX will want to set up a tcp port for the circus controller self.workers = Workers(workers_cmd, num_workers=num_workers, working_dir=working_dir, env=env, **kw)
class CryptoWorkers(threading.Thread): """Class to spawn powerhose worker in a separate thread""" def __init__(self, workers_cmd, num_workers, working_dir, env, controller, pubsub_endpoint, **kw): threading.Thread.__init__(self) pid = str(thread.get_ident()) # XXX will want to set up a tcp port for the circus controller self.workers = Workers(workers_cmd, num_workers=num_workers, working_dir=working_dir, env=env, **kw) def run(self): logger.debug('Starting powerhose workers') self.workers.run() logger.debug('Powerhose workers ended') def stop(self): logger.debug('Stopping powerhose workers') self.workers.stop() self.join()
from powerhose.client.workers import Workers import sys cmd = '%s examples/square_worker.py ipc://worker-routing-$WID.ipc' workers = Workers(cmd % sys.executable) try: workers.run() except KeyboardInterrupt: workers.stop()
from powerhose.client.workers import Workers import sys if len(sys.argv) != 2: raise Exception('Bad number of args for workers - %s' % str(sys.argv)) workers = Workers(sys.argv[1]) try: workers.run() except KeyboardInterrupt: workers.stop()
def __init__(self, workers_cmd, num_workers, working_dir, env, **kw): threading.Thread.__init__(self) self.workers = Workers(workers_cmd, num_workers=num_workers, working_dir=working_dir, env=env, **kw)