Zeroconf reports system properties (#59)

* Zeroconf.found_clients() now returns dicts of clients, not just hostnames

* Adjustments to distributed_job_manager.py

* Undo config change

* Report system metrics (cpu, os, etc) via zeroconf_server.py

* Zeroconf.found_clients() now returns dicts of clients, not just hostnames

* Adjustments to distributed_job_manager.py

* Undo config change

* Zeroconf.found_clients() now returns dicts of clients, not just hostnames

* Adjustments to distributed_job_manager.py

* Undo config change

* Adjustments to distributed_job_manager.py

* Undo config change

* Rename ZeroconfServer.found_clients() to found_hostnames()
This commit is contained in:
2023-11-04 20:46:27 -05:00
committed by GitHub
parent d3b84c6212
commit 06a613fcc4
9 changed files with 38 additions and 33 deletions

View File

@@ -220,10 +220,10 @@ class DistributedJobManager:
time.sleep(5)
@classmethod
def split_into_subjobs(cls, worker, job_data, project_path):
def split_into_subjobs(cls, worker, job_data, project_path, system_os=None):
# Check availability
available_servers = cls.find_available_servers(worker.renderer)
available_servers = cls.find_available_servers(worker.renderer, system_os)
logger.debug(f"Splitting into subjobs - Available servers: {available_servers}")
subjob_servers = cls.distribute_server_work(worker.start_frame, worker.end_frame, available_servers)
local_hostname = socket.gethostname()
@@ -353,17 +353,20 @@ class DistributedJobManager:
return server_breakdown
@staticmethod
def find_available_servers(engine_name):
def find_available_servers(engine_name, system_os=None):
"""
Scan the Zeroconf network for currently available render servers supporting a specific engine.
:param engine_name: str, The engine type to search for
:param system_os: str, Restrict results to servers running a specific OS
:return: A list of dictionaries with each dict containing hostname and cpu_count of available servers
"""
available_servers = []
for hostname in ZeroconfServer.found_clients():
response = RenderServerProxy(hostname).is_engine_available(engine_name)
if response and response.get('available', False):
available_servers.append(response)
for hostname in ZeroconfServer.found_hostnames():
host_properties = ZeroconfServer.get_hostname_properties(hostname)
if not system_os or (system_os and system_os == host_properties.get('system_os')):
response = RenderServerProxy(hostname).is_engine_available(engine_name)
if response and response.get('available', False):
available_servers.append(response)
return available_servers