|
|
@ -176,13 +176,6 @@ class Worker:
|
|
|
|
|
|
|
|
|
|
|
|
self.redis_server_version = None
|
|
|
|
self.redis_server_version = None
|
|
|
|
|
|
|
|
|
|
|
|
if prepare_for_work:
|
|
|
|
|
|
|
|
self.hostname = socket.gethostname()
|
|
|
|
|
|
|
|
self.pid = os.getpid()
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.hostname = None
|
|
|
|
|
|
|
|
self.pid = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.job_class = backend_class(self, 'job_class', override=job_class)
|
|
|
|
self.job_class = backend_class(self, 'job_class', override=job_class)
|
|
|
|
self.queue_class = backend_class(self, 'queue_class', override=queue_class)
|
|
|
|
self.queue_class = backend_class(self, 'queue_class', override=queue_class)
|
|
|
|
self.version = VERSION
|
|
|
|
self.version = VERSION
|
|
|
@ -225,6 +218,16 @@ class Worker:
|
|
|
|
|
|
|
|
|
|
|
|
self.disable_default_exception_handler = disable_default_exception_handler
|
|
|
|
self.disable_default_exception_handler = disable_default_exception_handler
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if prepare_for_work:
|
|
|
|
|
|
|
|
self.hostname = socket.gethostname()
|
|
|
|
|
|
|
|
self.pid = os.getpid()
|
|
|
|
|
|
|
|
connection.client_setname(self.name)
|
|
|
|
|
|
|
|
self.ip_address = [client['addr'] for client in connection.client_list() if client['name'] == self.name][0]
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.hostname = None
|
|
|
|
|
|
|
|
self.pid = None
|
|
|
|
|
|
|
|
self.ip_address = None
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(exception_handlers, (list, tuple)):
|
|
|
|
if isinstance(exception_handlers, (list, tuple)):
|
|
|
|
for handler in exception_handlers:
|
|
|
|
for handler in exception_handlers:
|
|
|
|
self.push_exc_handler(handler)
|
|
|
|
self.push_exc_handler(handler)
|
|
|
@ -301,6 +304,7 @@ class Worker:
|
|
|
|
'queues': queues,
|
|
|
|
'queues': queues,
|
|
|
|
'pid': self.pid,
|
|
|
|
'pid': self.pid,
|
|
|
|
'hostname': self.hostname,
|
|
|
|
'hostname': self.hostname,
|
|
|
|
|
|
|
|
'ip_address': self.ip_address,
|
|
|
|
'version': self.version,
|
|
|
|
'version': self.version,
|
|
|
|
'python_version': self.python_version,
|
|
|
|
'python_version': self.python_version,
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -704,13 +708,15 @@ class Worker:
|
|
|
|
def refresh(self):
|
|
|
|
def refresh(self):
|
|
|
|
data = self.connection.hmget(
|
|
|
|
data = self.connection.hmget(
|
|
|
|
self.key, 'queues', 'state', 'current_job', 'last_heartbeat',
|
|
|
|
self.key, 'queues', 'state', 'current_job', 'last_heartbeat',
|
|
|
|
'birth', 'failed_job_count', 'successful_job_count',
|
|
|
|
'birth', 'failed_job_count', 'successful_job_count', 'total_working_time',
|
|
|
|
'total_working_time', 'current_job_working_time', 'hostname', 'pid', 'version', 'python_version',
|
|
|
|
'current_job_working_time', 'hostname', 'ip_address', 'pid', 'version', 'python_version',
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(queues, state, job_id, last_heartbeat, birth, failed_job_count,
|
|
|
|
(queues, state, job_id, last_heartbeat, birth, failed_job_count,
|
|
|
|
successful_job_count, total_working_time, current_job_working_time, hostname, pid, version, python_version) = data
|
|
|
|
successful_job_count, total_working_time, current_job_working_time,
|
|
|
|
|
|
|
|
hostname, ip_address, pid, version, python_version) = data
|
|
|
|
queues = as_text(queues)
|
|
|
|
queues = as_text(queues)
|
|
|
|
self.hostname = as_text(hostname)
|
|
|
|
self.hostname = as_text(hostname)
|
|
|
|
|
|
|
|
self.ip_address = as_text(ip_address)
|
|
|
|
self.pid = int(pid) if pid else None
|
|
|
|
self.pid = int(pid) if pid else None
|
|
|
|
self.version = as_text(version)
|
|
|
|
self.version = as_text(version)
|
|
|
|
self.python_version = as_text(python_version)
|
|
|
|
self.python_version = as_text(python_version)
|
|
|
|