From de6e1e105e37f3a2556e5c76f7854f5963946659 Mon Sep 17 00:00:00 2001 From: aresnow1 <109642806+aresnow1@users.noreply.github.com> Date: Wed, 5 Jul 2023 16:13:44 +0800 Subject: [PATCH] BUG: Modify match words for catching error message (#37) --- python/xoscar/backends/indigen/pool.py | 2 +- python/xoscar/backends/pool.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/python/xoscar/backends/indigen/pool.py b/python/xoscar/backends/indigen/pool.py index f239b58c..0021d3b9 100644 --- a/python/xoscar/backends/indigen/pool.py +++ b/python/xoscar/backends/indigen/pool.py @@ -309,7 +309,7 @@ async def is_sub_pool_alive(self, process: multiprocessing.Process): try: return await asyncio.to_thread(process.is_alive) except RuntimeError as ex: # pragma: no cover - if "cannot schedule new futures after interpreter shutdown" not in str(ex): + if "cannot schedule new futures" not in str(ex): # when atexit is triggered, the default pool might be shutdown # and to_thread will fail raise diff --git a/python/xoscar/backends/pool.py b/python/xoscar/backends/pool.py index b4384e9a..73d89d2a 100644 --- a/python/xoscar/backends/pool.py +++ b/python/xoscar/backends/pool.py @@ -1408,10 +1408,7 @@ async def monitor_sub_pools(self): except asyncio.CancelledError: raise except RuntimeError as ex: # pragma: no cover - if ( - "cannot schedule new futures after interpreter shutdown" - not in str(ex) - ): + if "cannot schedule new futures" not in str(ex): # to silence log when process exit, otherwise it # will raise "RuntimeError: cannot schedule new futures # after interpreter shutdown".