def work(self): """ Should collect information about all queues and workers per each gearman node In future this information will be used for collecting and grouping informations by running queues (with average load) and running worker processes """ self.log = Log.buffer('gearman') try: # Lazy connection if necessary... self.client = self.client or GearmanAdminClient(['%s:%s' % (self.server.host, self.port)]) # Retrieve status information via socket connection status = self.client.get_status() # Put into log buffer server = {'host': self.server.host, 'port': self.port} self.log.info(StatusLogRecord(status, server=server)) for queue in status: self.log.info(QueueLogRecord(queue, server=server)) except GearmanErrors.ServerUnavailable, e: # Such error can be raised in two cases: # 1. gearmand is not running (stopped by user or crashed with error) # 2. socket client doesn't work normaly, for example cause of network problems # In any case, we can't retrieve more information here, # so you have to resolve this issue manually self.log.error(e)
def work(self): self.log = Log.buffer('ping') # Put into log buffer self.log.info(PingLogRecord(self.ping(4), server={'host': self.server.host}))