mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 20:38:32 +02:00
test set_spawn_method and handle exceptions
This commit is contained in:
@@ -60,7 +60,17 @@ def on_worker_init(sender: Any, **kwargs: Any) -> None:
|
||||
all_start_methods: list[str] = multiprocessing.get_all_start_methods()
|
||||
logger.info(f"Multiprocessing all start methods: {all_start_methods}")
|
||||
|
||||
multiprocessing.set_start_method("spawn") # fork is unsafe, set to spawn
|
||||
try:
|
||||
multiprocessing.set_start_method("spawn") # fork is unsafe, set to spawn
|
||||
except Exception:
|
||||
logger.info("multiprocessing.set_start_method exceptioned.")
|
||||
try:
|
||||
multiprocessing.set_start_method(
|
||||
"spawn", force=True
|
||||
) # fork is unsafe, set to spawn
|
||||
except Exception:
|
||||
logger.info("multiprocessing.set_start_method force=True exceptioned.")
|
||||
|
||||
logger.info(
|
||||
f"Multiprocessing selected start method: {multiprocessing.get_start_method()}"
|
||||
)
|
||||
|
Reference in New Issue
Block a user