Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit b869403

Browse files
authored
fix(cancellation): adding failure processing (#228)
* adding failure processing * pylint fix --------- Signed-off-by: Stanislav Protasov <[email protected]>
1 parent 99890bb commit b869403

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

aqueductcore/backend/services/task_executor.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,10 @@ def run_executable( # pylint: disable=unused-argument
9696
extension_process = proc
9797
out, err = proc.communicate(timeout=None)
9898
code = proc.returncode
99-
return (
100-
code,
101-
out.decode("utf-8"),
102-
err.decode("utf-8"),
103-
)
99+
args = (code, out.decode("utf-8"), err.decode("utf-8"))
100+
if code != 0:
101+
raise ChildProcessError(args)
102+
return args
104103

105104

106105
async def _update_task_info(task_id: str, wait=False) -> TaskProcessExecutionResult:
@@ -120,7 +119,14 @@ async def _update_task_info(task_id: str, wait=False) -> TaskProcessExecutionRes
120119

121120
if task_result is not None:
122121
known_exceptions = (FileNotFoundError, KeyboardInterrupt, TaskRevokedError, Exception)
123-
if isinstance(task_result, known_exceptions):
122+
if isinstance(task_result, ChildProcessError):
123+
if task_result.args is not None and len(task_result.args) > 0:
124+
if len(task_result.args[0]) == 3:
125+
code, out, err = task_result.args[0]
126+
task_info.result_code = code
127+
task_info.std_out = out
128+
task_info.std_err = err
129+
elif isinstance(task_result, known_exceptions):
124130
task_info.std_err = str(task_result)
125131
elif task.ready():
126132
# in case the result format is incorrect

0 commit comments

Comments
 (0)