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`.
We sort of rely on the dataset not being flushed yet in order to bypass
the security check for tagging post job actions, so this fixes:
```
ItemOwnershipException: User does not own item.
File "galaxy/workflow/run.py", line 233, in invoke
incomplete_or_none = self._invoke_step(workflow_invocation_step)
File "galaxy/workflow/run.py", line 309, in _invoke_step
incomplete_or_none = invocation_step.workflow_step.module.execute(
File "galaxy/workflow/modules.py", line 2274, in execute
workflow_invocation_uuid=invocation.uuid.hex,
File "galaxy/tools/execute.py", line 169, in execute
execute_single_job(execution_slice, completed_jobs[i], skip=skip)
File "galaxy/tools/execute.py", line 116, in execute_single_job
job, result = tool.handle_single_execution(
File "galaxy/tools/__init__.py", line 1957, in handle_single_execution
execution_cache=execution_cache,
File "galaxy/tools/__init__.py", line 1937, in handle_single_execution
execution_slice,
File "galaxy/tools/__init__.py", line 2034, in execute
args[key] = model.User.expand_user_properties(trans.user, param.value)
File "galaxy/tools/actions/model_operations.py", line 102, in execute
job_callback(job)
File "galaxy/workflow/modules.py", line 2284, in <lambda>
complete = True
File "galaxy/workflow/modules.py", line 2351, in _handle_post_job_actions
self.trans.sa_session.add(pjaa)
File "galaxy/job_execution/actions/post.py", line 575, in execute
ActionBox.actions[pja.action_type].execute(
File "galaxy/job_execution/actions/post.py", line 473, in execute
cls._execute(tag_handler, job.user, dataset_assoc.dataset, tags)
File "galaxy/job_execution/actions/post.py", line 481, in _execute
tag_handler.add_tags_from_list(user, output, tags, flush=False)
File "galaxy/model/tags.py", line 74, in add_tags_from_list
return self.set_tags_from_list(user, item, new_tags_set, flush=flush)
File "galaxy/model/tags.py", line 92, in set_tags_from_list
self.delete_item_tags(user, item)
File "galaxy/model/tags.py", line 165, in delete_item_tags
self._ensure_user_owns_item(user, item)
File "galaxy/model/tags.py", line 193, in _ensure_user_owns_item
raise ItemOwnershipException("User does not own item.")
```
(once again).
From https://sentry.galaxyproject.org/share/issue/5b44d1ec20094a2ebe8331b1ef6e58a8/
I think that in the tool evaluation context we don't actually need the
cached_id performance tweak: we batch flushes now on map over creation
... which in fact breaks the assumption that we're setting the user id
here.
Should fix warning for built-in tools in run form.
Also makes the check more strict by checking that the version requested
in the module is actually in the safe range.