Unverified Commit e29f927f authored by mvdbeek's avatar mvdbeek
Browse files

Write exit code file when when setting metadata outside of pulsar

We need this to figure out the right stdout/stderr and job state with
the `check_output` function.
parent 8019207d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -646,6 +646,11 @@ class PulsarJobRunner(AsynchronousJobRunner):
            log.exception("failure finishing job %d", job_wrapper.job_id)
            return
        if not PulsarJobRunner.__remote_metadata(client):
            # we need an actual exit code file in the job working directory to detect job errors in the metadata script
            with open(
                os.path.join(job_wrapper.working_directory, f"galaxy_{job_wrapper.job_id}.ec"), "w"
            ) as exit_code_file:
                exit_code_file.write(str(exit_code))
            self._handle_metadata_externally(job_wrapper, resolve_requirements=True)
        # Finish the job
        try:
+12 −12
Original line number Diff line number Diff line
@@ -283,7 +283,7 @@ def set_metadata_portable(
        import_model_store = None

    tool_script_file = tool_job_working_directory / "tool_script.sh"
    job = None
    job: Optional[Job] = None
    if import_model_store and export_store:
        job = next(iter(import_model_store.sa_session.objects[Job].values()))

@@ -328,7 +328,7 @@ def set_metadata_portable(
            final_job_state = Job.states.ERROR
            job_messages.append(str(e))
        if job:
            job.job_messages = job_messages
            job.set_streams(tool_stdout=tool_stdout, tool_stderr=tool_stderr, job_messages=job_messages)
            job.state = final_job_state
            if os.path.exists(tool_script_file):
                with open(tool_script_file) as command_fh: