MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / update_render_threads

Function update_render_threads

ui/easydiffusion/task_manager.py:466–490  ·  view source on GitHub ↗
(render_devices, active_devices)

Source from the content-addressed store, hash-verified

464
465
466def update_render_threads(render_devices, active_devices):
467 devices_to_start, devices_to_stop = device_manager.get_device_delta(render_devices, active_devices)
468 log.debug(f"devices_to_start: {devices_to_start}")
469 log.debug(f"devices_to_stop: {devices_to_stop}")
470
471 for device in devices_to_stop:
472 if is_alive(device) <= 0:
473 log.debug(f"{device} is not alive")
474 continue
475 if not stop_render_thread(device):
476 log.warn(f"{device} could not stop render thread")
477
478 for device in devices_to_start:
479 if is_alive(device) >= 1:
480 log.debug(f"{device} already registered.")
481 continue
482 if not start_render_thread(device):
483 log.warn(f"{device} failed to start.")
484
485 if is_alive() <= 0: # No running devices, probably invalid user config.
486 raise EnvironmentError(
487 'ERROR: No active render devices! Please verify the "render_devices" value in config.json'
488 )
489
490 log.debug(f"active devices: {get_devices()['active']}")
491
492
493def shutdown_event(): # Signal render thread to close on shutdown

Callers

nothing calls this directly

Calls 4

is_aliveFunction · 0.85
stop_render_threadFunction · 0.85
start_render_threadFunction · 0.85
get_devicesFunction · 0.85

Tested by

no test coverage detected