master: fix asyncio exception handling

Follow Python 3.8.
This commit is contained in:
Sébastien Bourdeauducq 2024-02-28 12:48:07 +08:00
parent 3e8a853e53
commit 18f55bb196
2 changed files with 4 additions and 4 deletions

View File

@ -239,7 +239,7 @@ class PrepareStage(TaskObject):
try: try:
await run.build() await run.build()
await run.prepare() await run.prepare()
except: except Exception:
logger.error("got worker exception in prepare stage, " logger.error("got worker exception in prepare stage, "
"deleting RID %d", run.rid) "deleting RID %d", run.rid)
log_worker_exception() log_worker_exception()
@ -289,7 +289,7 @@ class RunStage(TaskObject):
else: else:
run.status = RunStatus.running run.status = RunStatus.running
completed = await run.run() completed = await run.run()
except: except Exception:
logger.error("got worker exception in run stage, " logger.error("got worker exception in run stage, "
"deleting RID %d", run.rid) "deleting RID %d", run.rid)
log_worker_exception() log_worker_exception()
@ -326,7 +326,7 @@ class AnalyzeStage(TaskObject):
run.status = RunStatus.analyzing run.status = RunStatus.analyzing
try: try:
await run.analyze() await run.analyze()
except: except Exception:
logger.error("got worker exception in analyze stage of RID %d.", logger.error("got worker exception in analyze stage of RID %d.",
run.rid) run.rid)
log_worker_exception() log_worker_exception()

View File

@ -234,7 +234,7 @@ class Worker:
if asyncio.iscoroutine(data): if asyncio.iscoroutine(data):
data = await data data = await data
reply = {"status": "ok", "data": data} reply = {"status": "ok", "data": data}
except: except Exception:
reply = { reply = {
"status": "failed", "status": "failed",
"exception": current_exc_packed() "exception": current_exc_packed()