Skip to content

Commit

Permalink
Fix unbound runner variable when there is an error in the job config
Browse files Browse the repository at this point in the history
Fixes
```
UnboundLocalError: local variable 'runner' referenced before assignment
  File "galaxy/jobs/handler.py", line 541, in __handle_waiting_jobs
    self.dispatcher.put(self.job_wrappers.pop(job.id))
  File "galaxy/jobs/handler.py", line 1224, in put
    runner = self.get_job_runner(job_wrapper, get_task_runner=True)
  File "galaxy/jobs/handler.py", line 1221, in get_job_runner
    return runner
```
from https://sentry.galaxyproject.org/share/issue/a0a0049feb53487f9c84ede3784624b0/
which followed `(53095435) Invalid job runner: bridges`.
  • Loading branch information
mvdbeek committed Oct 24, 2023
1 parent 3dd88a4 commit 81e9d52
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/galaxy/jobs/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,12 +1216,16 @@ def get_job_runner(self, job_wrapper, get_task_runner=False):
except KeyError:
log.error(f"({job_wrapper.job_id}) Invalid job runner: {runner_name}")
job_wrapper.fail(DEFAULT_JOB_RUNNER_FAILURE_MESSAGE)
return None
if get_task_runner and job_wrapper.can_split() and runner.runner_name != "PulsarJobRunner":
return self.job_runners["tasks"]
return runner

def put(self, job_wrapper):
runner = self.get_job_runner(job_wrapper, get_task_runner=True)
if runner is None:
# Something went wrong, we've already failed the job wrapper
return
if isinstance(job_wrapper, TaskWrapper):
# DBTODO Refactor
log.debug(f"({job_wrapper.job_id}) Dispatching task {job_wrapper.task_id} to task runner")
Expand Down

0 comments on commit 81e9d52

Please sign in to comment.