Skip to content

Commit fe97f8e

Browse files
committed
fix: could not raise exception
1 parent 892f258 commit fe97f8e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pydra/engine/workers.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -911,9 +911,7 @@ def make_spec(self, cmd=None, arg=None):
911911
spec = self.psij.JobSpec()
912912
spec.executable = cmd
913913
spec.arguments = arg
914-
spec.stdout_path = "demo.stdout"
915-
spec.stderr_path = "demo.stderr"
916-
914+
917915
return spec
918916

919917
def make_job(self, spec, attributes):
@@ -960,10 +958,18 @@ async def exec_psij(self, runnable, rerun=False):
960958
],
961959
)
962960

961+
spec.stdout_path = os.path.join(cache_dir, "demo.stdout")
962+
spec.stderr_path = os.path.join(cache_dir, "demo.stderr")
963+
963964
job = self.make_job(spec, None)
964965
jex.submit(job)
965966
job.wait()
966967

968+
if os.path.getsize(spec.stderr_path) > 0:
969+
with open(spec.stderr_path, "r") as stderr_file:
970+
stderr_contents = stderr_file.read()
971+
raise Exception(f"stderr_path '{spec.stderr_path}' is not empty. Contents:\n{stderr_contents}")
972+
967973
return
968974

969975
def close(self):

0 commit comments

Comments
 (0)