class Server(Thread): def __init__(self, verbosity): super(Server, self).__init__() self.verbosity = verbosity def run(self): if self.verbosity > 0: logging.info("Starting server") self.server = GearmanServer(settings.GEARMAN_SERVERS[0]) self.server.start()
def start_server(self): self.server_pid = os.fork() if not self.server_pid: server = GearmanServer() server.start() sys.exit() connection = GearmanConnection(job_servers[0]) for i in range(10): try: connection.connect() except GearmanConnection.ConnectionError: time.sleep(0.5) else: break connection.close()
def run(self): if self.verbosity > 0: logging.info("Starting server") self.server = GearmanServer(settings.GEARMAN_SERVERS[0]) self.server.start()