Пример #1
0
def _register_worker(redis, worker_uuid):
    redis.hmset(get_worker_hash_key(worker_uuid),
                {
                    'hostname': gethostname(),
                    'pid': os.getpid(),
                    'cpu_cores': psutil.cpu_count(logical=True),
                    'cpu_threads': psutil.cpu_count(logical=False),
                    'virtual-mem': psutil.virtual_memory(),
                    'swap-mem': psutil.swap_memory(),
                    'registered': strftime(datetime.utcnow())
                })
Пример #2
0
def _deregister_worker_with_timeout(worker_uuid, timeout=2):
    redis = create_redis_connection(timeout=timeout)
    redis.delete(get_worker_hash_key(worker_uuid))