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

Always set ``exit_code_file`` on JobState

Subclasses can still overwrite this and we don't have to remember doing
this whenever instantiating a JobState instance (in the runner code or
in integration tests).
parent f139d29f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -656,6 +656,7 @@ class JobState:
        self.job_wrapper = job_wrapper
        self.job_destination = job_destination
        self.runner_state = None
        self.exit_code_file = default_exit_code_file(job_wrapper.working_directory, job_wrapper.get_id_tag())

        self.redact_email_in_job_name = True
        if self.job_wrapper:
@@ -670,7 +671,6 @@ class JobState:
                self.job_file = JobState.default_job_file(files_dir, id_tag)
                self.output_file = os.path.join(files_dir, f"galaxy_{id_tag}.o")
                self.error_file = os.path.join(files_dir, f"galaxy_{id_tag}.e")
                self.exit_code_file = default_exit_code_file(files_dir, id_tag)
            job_name = f"g{id_tag}"
            if self.job_wrapper.tool.old_id:
                job_name += f"_{self.job_wrapper.tool.old_id}"
@@ -730,6 +730,7 @@ class AsynchronousJobState(JobState):
        self.job_file = job_file
        self.output_file = output_file
        self.error_file = error_file
        if exit_code_file:
            self.exit_code_file = exit_code_file
        self.job_name = job_name

+6 −4
Original line number Diff line number Diff line
@@ -180,11 +180,13 @@ class ChronosJobRunner(AsynchronousJobRunner):
    def recover(self, job, job_wrapper):
        msg = "(name!r/runner!r) is still in {state!s} state, adding to" " the runner monitor queue"
        job_id = job.get_job_runner_external_id()
        ajs = AsynchronousJobState(files_dir=job_wrapper.working_directory, job_wrapper=job_wrapper)
        ajs.job_id = self.JOB_NAME_PREFIX + str(job_id)
        ajs = AsynchronousJobState(
            files_dir=job_wrapper.working_directory,
            job_wrapper=job_wrapper,
            job_id=self.JOB_NAME_PREFIX + str(job_id),
            job_destination=job_wrapper.job_destination,
        )
        ajs.command_line = job.command_line
        ajs.job_wrapper = job_wrapper
        ajs.job_destination = job_wrapper.job_destination
        if job.state in (model.Job.states.RUNNING, model.Job.states.STOPPED):
            LOGGER.debug(msg.format(name=job.id, runner=job.job_runner_external_id, state=job.state))
            ajs.old_state = model.Job.states.RUNNING
+6 −4
Original line number Diff line number Diff line
@@ -259,11 +259,13 @@ class ShellJobRunner(AsynchronousJobRunner):
        if job_id is None:
            self.put(job_wrapper)
            return
        ajs = AsynchronousJobState(files_dir=job_wrapper.working_directory, job_wrapper=job_wrapper)
        ajs.job_id = str(job_id)
        ajs = AsynchronousJobState(
            files_dir=job_wrapper.working_directory,
            job_wrapper=job_wrapper,
            job_id=job_id,
            job_destination=job_wrapper.job_destination,
        )
        ajs.command_line = job.command_line
        ajs.job_wrapper = job_wrapper
        ajs.job_destination = job_wrapper.job_destination
        if job.state in (model.Job.states.RUNNING, model.Job.states.STOPPED):
            log.debug(
                f"({job.id}/{job.job_runner_external_id}) is still in {job.state} state, adding to the runner monitor queue"
+6 −4
Original line number Diff line number Diff line
@@ -397,11 +397,13 @@ class DRMAAJobRunner(AsynchronousJobRunner):
        if job_id is None:
            self.put(job_wrapper)
            return
        ajs = AsynchronousJobState(files_dir=job_wrapper.working_directory, job_wrapper=job_wrapper)
        ajs.job_id = str(job_id)
        ajs = AsynchronousJobState(
            files_dir=job_wrapper.working_directory,
            job_wrapper=job_wrapper,
            job_id=job_id,
            job_destination=job_wrapper.job_destination,
        )
        ajs.command_line = job.get_command_line()
        ajs.job_wrapper = job_wrapper
        ajs.job_destination = job_wrapper.job_destination
        if job.state in (model.Job.states.RUNNING, model.Job.states.STOPPED):
            log.debug(
                f"({job.id}/{job.get_job_runner_external_id()}) is still in {job.state} state, adding to the DRM queue"
+6 −4
Original line number Diff line number Diff line
@@ -253,11 +253,13 @@ class GodockerJobRunner(AsynchronousJobRunner):
        # Jobs in Running & Queued state in galaxy are put in the monitor_queue
        # by creating an AsynchronousJobState object
        job_id = job_wrapper.job_id
        ajs = AsynchronousJobState(files_dir=job_wrapper.working_directory, job_wrapper=job_wrapper)
        ajs.job_id = str(job_id)
        ajs.job_destination = job_wrapper.job_destination
        ajs = AsynchronousJobState(
            files_dir=job_wrapper.working_directory,
            job_wrapper=job_wrapper,
            job_id=job_id,
            job_destination=job_wrapper.job_destination,
        )
        job_wrapper.command_line = job.command_line
        ajs.job_wrapper = job_wrapper
        if job.state in (model.Job.states.RUNNING, model.Job.states.STOPPED):
            log.debug(
                f"({job.id}/{job.get_job_runner_external_id()}) is still in {job.state} state, adding to the god queue"
Loading