Commits

Johannes Köster committed f1c3796

Show the output and a proper error when the jobscript fails.

  • Participants
  • Parent commits 4a0c8ef

Comments (0)

Files changed (1)

snakemake/executors.py

 
         deps = " ".join(self.external_jobid[f] for f in job.input if f in self.external_jobid)
         submitcmd = job.format_wildcards(self.submitcmd, dependencies=deps)
-        ext_jobid = subprocess.check_output(
-            '{submitcmd} "{jobscript}"'.format(
-                submitcmd=submitcmd,
-                jobscript=jobscript),
-            shell=True).decode().split("\n")
+        try:
+            ext_jobid = subprocess.check_output(
+                '{submitcmd} "{jobscript}"'.format(
+                    submitcmd=submitcmd,
+                    jobscript=jobscript),
+                shell=True).decode().split("\n")
+        except subprocess.CalledProcessError as ex:
+            raise WorkflowError("Error executing jobscript (exit code {}):\n{}".format(ex.returncode, ex.output.decode()), rule=job.rule)
         if ext_jobid and ext_jobid[0]:
             ext_jobid = ext_jobid[0]
             self.external_jobid.update((f, ext_jobid) for f in job.output)