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

Function start_backend

ui/easydiffusion/backend_manager.py:74–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72
73
74def start_backend():
75 global backend, curr_backend_name
76
77 from easydiffusion.app import getConfig, ROOT_DIR
78
79 curr_dir = os.path.dirname(__file__)
80
81 backends = find_valid_backends(curr_dir)
82 plugin_backends = find_valid_backends(ROOT_DIR)
83 backends.update(plugin_backends)
84
85 config = getConfig()
86 backend_name = config["backend"]
87
88 if backend_name not in backends:
89 raise RuntimeError(
90 f"Couldn't find the backend configured in config.yaml: {backend_name}. Please check the name!"
91 )
92
93 if backend is not None and backend_name != curr_backend_name:
94 try:
95 backend.stop_backend()
96 except:
97 log.exception(traceback.format_exc())
98
99 log.info(f"Loading backend: {backend_name}")
100 backend = load_backend_module(backend_name, backends)
101
102 try:
103 backend.start_backend()
104 except:
105 log.exception(traceback.format_exc())

Callers

nothing calls this directly

Calls 4

getConfigFunction · 0.90
find_valid_backendsFunction · 0.85
load_backend_moduleFunction · 0.85
exceptionMethod · 0.80

Tested by

no test coverage detected