Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Galaxy job handlers may crash during startup #17079

Closed
kysrpex opened this issue Nov 24, 2023 · 12 comments
Closed

Galaxy job handlers may crash during startup #17079

kysrpex opened this issue Nov 24, 2023 · 12 comments
Labels

Comments

@kysrpex
Copy link
Contributor

kysrpex commented Nov 24, 2023

Describe the bug
Jobs from @hexylena crash Galaxy job handlers during startup on usegalaxy.eu.

Whenever a job submitted by @hexylena is assigned to a handler (e.g. handler_sn06_0), the handler fails to start with the following error message:

Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: galaxy.jobs.handler DEBUG 2023-11-24 14:41:09,386 [pN:handler_sn06_0,p:475786,tN:MainThread] recovering job ******** in condor_secondary runner
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: galaxy.jobs.mapper ERROR 2023-11-24 14:41:09,392 [pN:handler_sn06_0,p:475786,tN:MainThread] Caught unhandled exception while attempting to cache job destination:
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: Traceback (most recent call last):
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 215, in __handle_rule
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     job_destination = self.__invoke_expand_function(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 94, in __invoke_expand_function
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     user = job.user
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 487, in __get__
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.impl.get(state, dict_)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 959, in get
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     value = self._fire_loader_callables(state, key, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 995, in _fire_loader_callables
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.callable_(state, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 912, in _load_for_state
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self._emit_lazyload(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 996, in _emit_lazyload
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return loading.load_on_pk_identity(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/loading.py", line 530, in load_on_pk_identity
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     session.execute(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1711, in execute
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     conn = self._connection_for_bind(bind, close_with_result=True)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1552, in _connection_for_bind
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     TransactionalContext._trans_ctx_check(self)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/engine/util.py", line 199, in _trans_ctx_check
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise exc.InvalidRequestError(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: During handling of the above exception, another exception occurred:
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: Traceback (most recent call last):
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 258, in __cache_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.cached_job_destination = self.__determine_job_destination(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 242, in __determine_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     job_destination = self.__handle_dynamic_job_destination(raw_job_destination)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 205, in __handle_dynamic_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.__handle_rule(expand_function, destination)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 220, in __handle_rule
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise e
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 209, in __handle_rule
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     job_destination = self.__invoke_expand_function(rule_function, destination)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 94, in __invoke_expand_function
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     user = job.user
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 487, in __get__
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.impl.get(state, dict_)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 959, in get
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     value = self._fire_loader_callables(state, key, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 995, in _fire_loader_callables
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.callable_(state, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 912, in _load_for_state
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self._emit_lazyload(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 996, in _emit_lazyload
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return loading.load_on_pk_identity(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/loading.py", line 530, in load_on_pk_identity
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     session.execute(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1711, in execute
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     conn = self._connection_for_bind(bind, close_with_result=True)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1552, in _connection_for_bind
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     TransactionalContext._trans_ctx_check(self)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/engine/util.py", line 199, in _trans_ctx_check
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise exc.InvalidRequestError(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: Failed to initialize Galaxy application
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: Traceback (most recent call last):
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 215, in __handle_rule
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     job_destination = self.__invoke_expand_function(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 94, in __invoke_expand_function
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     user = job.user
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 487, in __get__
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.impl.get(state, dict_)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 959, in get
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     value = self._fire_loader_callables(state, key, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 995, in _fire_loader_callables
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.callable_(state, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 912, in _load_for_state
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self._emit_lazyload(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 996, in _emit_lazyload
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return loading.load_on_pk_identity(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/loading.py", line 530, in load_on_pk_identity
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     session.execute(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1711, in execute
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     conn = self._connection_for_bind(bind, close_with_result=True)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1552, in _connection_for_bind
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     TransactionalContext._trans_ctx_check(self)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/engine/util.py", line 199, in _trans_ctx_check
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise exc.InvalidRequestError(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: During handling of the above exception, another exception occurred:
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: Traceback (most recent call last):
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 258, in __cache_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.cached_job_destination = self.__determine_job_destination(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 242, in __determine_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     job_destination = self.__handle_dynamic_job_destination(raw_job_destination)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 205, in __handle_dynamic_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.__handle_rule(expand_function, destination)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 220, in __handle_rule
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise e
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 209, in __handle_rule
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     job_destination = self.__invoke_expand_function(rule_function, destination)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 94, in __invoke_expand_function
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     user = job.user
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 487, in __get__
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.impl.get(state, dict_)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 959, in get
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     value = self._fire_loader_callables(state, key, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 995, in _fire_loader_callables
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.callable_(state, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 912, in _load_for_state
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self._emit_lazyload(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 996, in _emit_lazyload
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return loading.load_on_pk_identity(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/loading.py", line 530, in load_on_pk_identity
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     session.execute(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1711, in execute
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     conn = self._connection_for_bind(bind, close_with_result=True)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1552, in _connection_for_bind
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     TransactionalContext._trans_ctx_check(self)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/engine/util.py", line 199, in _trans_ctx_check
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise exc.InvalidRequestError(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: During handling of the above exception, another exception occurred:
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: Traceback (most recent call last):
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/./scripts/galaxy-main", line 112, in app_loop
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     galaxy_app = load_galaxy_app(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                  ^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/./scripts/galaxy-main", line 91, in load_galaxy_app
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     app = UniverseApplication(global_conf=config_builder.global_conf(), attach_to_pools=attach_to_pools, **kwds)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/app.py", line 730, in __init__
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.application_stack.register_postfork_function(self.job_manager.start)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/web_stack/__init__.py", line 48, in register_postfork_function
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     f(*args, **kwargs)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/manager.py", line 41, in start
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.job_handler.start()
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 94, in start
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.job_queue.start()
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 257, in start
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.__check_jobs_at_startup()
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 280, in __check_jobs_at_startup
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self._check_job_at_startup(job)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 305, in _check_job_at_startup
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.dispatcher.recover(job, job_wrapper)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 1265, in recover
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     runner = self.get_job_runner(job_wrapper)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 1213, in get_job_runner
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     runner_name = job_wrapper.job_destination.runner
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/__init__.py", line 2537, in job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.job_runner_mapper.get_job_destination(self.params)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 277, in get_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.__cache_job_destination(params)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 267, in __cache_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise JobMappingException(ERROR_MESSAGE_RULE_EXCEPTION)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: galaxy.jobs.mapper.JobMappingException: Encountered an unhandled exception while caching job destination dynamic rule.
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: Traceback (most recent call last):
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 215, in __handle_rule
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     job_destination = self.__invoke_expand_function(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 94, in __invoke_expand_function
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     user = job.user
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 487, in __get__
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.impl.get(state, dict_)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 959, in get
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     value = self._fire_loader_callables(state, key, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 995, in _fire_loader_callables
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.callable_(state, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 912, in _load_for_state
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self._emit_lazyload(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 996, in _emit_lazyload
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return loading.load_on_pk_identity(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/loading.py", line 530, in load_on_pk_identity
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     session.execute(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1711, in execute
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     conn = self._connection_for_bind(bind, close_with_result=True)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1552, in _connection_for_bind
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     TransactionalContext._trans_ctx_check(self)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/engine/util.py", line 199, in _trans_ctx_check
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise exc.InvalidRequestError(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: During handling of the above exception, another exception occurred:
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: Traceback (most recent call last):
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 258, in __cache_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.cached_job_destination = self.__determine_job_destination(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 242, in __determine_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     job_destination = self.__handle_dynamic_job_destination(raw_job_destination)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 205, in __handle_dynamic_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.__handle_rule(expand_function, destination)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 220, in __handle_rule
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise e
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 209, in __handle_rule
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     job_destination = self.__invoke_expand_function(rule_function, destination)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 94, in __invoke_expand_function
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     user = job.user
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 487, in __get__
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.impl.get(state, dict_)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 959, in get
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     value = self._fire_loader_callables(state, key, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/attributes.py", line 995, in _fire_loader_callables
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.callable_(state, passive)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 912, in _load_for_state
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self._emit_lazyload(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/strategies.py", line 996, in _emit_lazyload
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return loading.load_on_pk_identity(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/loading.py", line 530, in load_on_pk_identity
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     session.execute(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1711, in execute
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     conn = self._connection_for_bind(bind, close_with_result=True)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1552, in _connection_for_bind
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     TransactionalContext._trans_ctx_check(self)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/venv/lib/python3.11/site-packages/sqlalchemy/engine/util.py", line 199, in _trans_ctx_check
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise exc.InvalidRequestError(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: During handling of the above exception, another exception occurred:
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: Traceback (most recent call last):
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/./scripts/galaxy-main", line 259, in <module>
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     main()
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/./scripts/galaxy-main", line 255, in main
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     func(args, log)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/./scripts/galaxy-main", line 112, in app_loop
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     galaxy_app = load_galaxy_app(
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                  ^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/./scripts/galaxy-main", line 91, in load_galaxy_app
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     app = UniverseApplication(global_conf=config_builder.global_conf(), attach_to_pools=attach_to_pools, **kwds)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/app.py", line 730, in __init__
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.application_stack.register_postfork_function(self.job_manager.start)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/web_stack/__init__.py", line 48, in register_postfork_function
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     f(*args, **kwargs)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/manager.py", line 41, in start
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.job_handler.start()
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 94, in start
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.job_queue.start()
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 257, in start
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.__check_jobs_at_startup()
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 280, in __check_jobs_at_startup
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self._check_job_at_startup(job)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 305, in _check_job_at_startup
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     self.dispatcher.recover(job, job_wrapper)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 1265, in recover
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     runner = self.get_job_runner(job_wrapper)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/handler.py", line 1213, in get_job_runner
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     runner_name = job_wrapper.job_destination.runner
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/__init__.py", line 2537, in job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.job_runner_mapper.get_job_destination(self.params)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 277, in get_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     return self.__cache_job_destination(params)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:   File "/opt/galaxy/server/lib/galaxy/jobs/mapper.py", line 267, in __cache_job_destination
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]:     raise JobMappingException(ERROR_MESSAGE_RULE_EXCEPTION)
Nov 24 14:41:09 sn06.galaxyproject.eu python[475786]: galaxy.jobs.mapper.JobMappingException: Encountered an unhandled exception while caching job destination dynamic rule.

Reassigning the jobs to a handler that is already running (like this for job in "${jobs[@]}"; do gxadmin mutate restart-jobs --commit $job && gxadmin mutate reassign-job-to-handler $job handler_sn06_1 --commit; done) does not cause any problems, the jobs just run normally.

Galaxy Version and/or server at which you observed the bug
Galaxy Version: 23.1 (minor 2.dev0)
Commit: e22e87a4c0aa35255e7605ef5a33ca82346b23a (from the usegalaxy-eu/galaxy fork)

To Reproduce
Steps to reproduce the behavior:

  1. Have any of @hexylena's jobs assigned to a handler.
  2. systemctl restart galaxy-handler@x

Expected behavior
Job handlers start normally regardless of which user's jobs they grab.

Screenshots
N/A

Additional context
@hexylena if you believe something related to your account can have an influence edit this section and add the information.

@hexylena wrote:

The jobs I'm currently trying to run are supposed to re-use existing jobs if possible. That's the main setting I've changed and am manually enabling on starting my workflow. (Please feel free to cancel all of my jobs if it helps.)

@hexylena
Copy link
Member

wow I feel very proud, my jobs are so bad they alone crash a handler :D
(or y'all's tpv rules can't handle my awesome jobs, one of the two :p)

if you believe something related to your account can have an influence edit this section and add the information.

The jobs I'm currently trying to run are supposed to re-use existing jobs if possible. That's the main setting I've changed and am manually enabling on starting my workflow. (Please feel free to cancel all of my jobs if it helps.)

@kysrpex
Copy link
Contributor Author

kysrpex commented Nov 24, 2023

@bgruening @sanjaysrikakulam @mira-miracoli If you need to restart a handler, then you will have to evict @hexylena's jobs from it. This is a huge problem: since @hexylena's jobs can go to any handler, Jenkins cannot run, and we also have a cron job that restarts the handlers from time to time that needs to stay disabled (use crontab -e as root).

@kysrpex
Copy link
Contributor Author

kysrpex commented Nov 24, 2023

wow I feel very proud, my jobs are so bad they alone crash a handler :D (or y'all's tpv rules can't handle my awesome jobs, one of the two :p)

if you believe something related to your account can have an influence edit this section and add the information.

The jobs I'm currently trying to run are supposed to re-use existing jobs if possible. That's the main setting I've changed and am manually enabling on starting my workflow. (Please feel free to cancel all of my jobs if it helps.)

If you don't mind, I am disabling job re-use for you to see what happens.

@kysrpex
Copy link
Contributor Author

kysrpex commented Nov 24, 2023

@hexylena Congratulations 🎉, you found the bug! Disabling job reuse fixes the problem.

@bgruening @sanjaysrikakulam @mira-miracoli which means, we have to disable this feature for everyone somehow.

kysrpex added a commit to kysrpex/usegalaxy-eu-ansible that referenced this issue Nov 24, 2023
Using the job cache can cause job handlers to crash during startup, see galaxyproject/galaxy#17079.
@bgruening
Copy link
Member

Just to clarify, with job-reuse you mean the job-cache feature?

@kysrpex
Copy link
Contributor Author

kysrpex commented Nov 24, 2023

Just to clarify, with job-reuse you mean the job-cache feature?

Exactly.

@kysrpex kysrpex changed the title @hexylena's jobs crash Galaxy job handlers during startup on usegalaxy.eu Galaxy job handlers may crash during startup when the job cache is enabled Nov 24, 2023
@mvdbeek
Copy link
Member

mvdbeek commented Nov 24, 2023

I don't think that's the job cache's fault, the problem is with the transaction getting closed in another thread. This would happen with any other job that crashes because of a bad TPV rule.

@mvdbeek
Copy link
Member

mvdbeek commented Nov 24, 2023

This might be the actual problem:

ObjectNotFound: objectstore, _call_method failed: _get_filename on <galaxy.model.Job(64984589) at 0x7fd7341cd490>, kwargs: {'base_dir': 'job_work', 'dir_only': True, 'obj_dir': True}
  File "galaxy/jobs/handler.py", line 1267, in recover
    runner.recover(job, job_wrapper)
  File "galaxy/jobs/runners/condor.py", line 297, in recover
    cjs = CondorJobState(job_wrapper=job_wrapper, files_dir=job_wrapper.working_directory)
  File "galaxy/jobs/__init__.py", line 1314, in working_directory
    self.__working_directory = self.app.object_store.get_filename(
  File "galaxy/objectstore/__init__.py", line 437, in get_filename
    return self._invoke("get_filename", obj, **kwargs)
  File "galaxy/objectstore/__init__.py", line 413, in _invoke
    return self.__getattribute__(f"_{delegate}")(obj=obj, **kwargs)
  File "galaxy/objectstore/__init__.py", line 953, in _get_filename
    return self._call_method("_get_filename", obj, ObjectNotFound, True, **kwargs)
  File "galaxy/objectstore/__init__.py", line 1190, in _call_method
    raise default(
InvalidRequestError: Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.
  File "galaxy-main", line 112, in app_loop
    galaxy_app = load_galaxy_app(
  File "galaxy-main", line 91, in load_galaxy_app
    app = UniverseApplication(global_conf=config_builder.global_conf(), attach_to_pools=attach_to_pools, **kwds)
  File "galaxy/app.py", line 730, in __init__
    self.application_stack.register_postfork_function(self.job_manager.start)
  File "galaxy/web_stack/__init__.py", line 48, in register_postfork_function
    f(*args, **kwargs)
  File "galaxy/jobs/manager.py", line 41, in start
    self.job_handler.start()
  File "galaxy/jobs/handler.py", line 94, in start
    self.job_queue.start()
  File "galaxy/jobs/handler.py", line 257, in start
    self.__check_jobs_at_startup()
  File "galaxy/jobs/handler.py", line 280, in __check_jobs_at_startup
    self._check_job_at_startup(job)
  File "galaxy/jobs/handler.py", line 319, in _check_job_at_startup
    self.dispatcher.recover(job, job_wrapper)
  File "galaxy/jobs/handler.py", line 1271, in recover
    job_wrapper.fail(msg)
  File "galaxy/jobs/__init__.py", line 1446, in fail
    for dep_job_assoc in dataset.dependent_jobs:
  File "sqlalchemy/orm/attributes.py", line 487, in __get__
    return self.impl.get(state, dict_)
  File "sqlalchemy/orm/attributes.py", line 959, in get
    value = self._fire_loader_callables(state, key, passive)
  File "sqlalchemy/orm/attributes.py", line 995, in _fire_loader_callables
    return self.callable_(state, passive)
  File "sqlalchemy/orm/strategies.py", line 912, in _load_for_state
    return self._emit_lazyload(
  File "sqlalchemy/orm/strategies.py", line 1046, in _emit_lazyload
    result = session.execute(
  File "sqlalchemy/orm/session.py", line 1711, in execute
    conn = self._connection_for_bind(bind, close_with_result=True)
  File "sqlalchemy/orm/session.py", line 1552, in _connection_for_bind
    TransactionalContext._trans_ctx_check(self)
  File "sqlalchemy/engine/util.py", line 199, in _trans_ctx_check
    raise exc.InvalidRequestError(

from https://sentry.galaxyproject.org/share/issue/da111795b80240cb90069cbd314b22b2/

@mvdbeek
Copy link
Member

mvdbeek commented Nov 24, 2023

and the transaction error should've been fixed in https://github.com/galaxyproject/galaxy/pull/16687/files. Can you confirm you got that commit on the handler that failed ?

@mvdbeek mvdbeek changed the title Galaxy job handlers may crash during startup when the job cache is enabled Galaxy job handlers may crash during startup Nov 24, 2023
mvdbeek added a commit to mvdbeek/galaxy that referenced this issue Nov 24, 2023
This avoids committing the transaction and then have it fail on the next
iteration. Should fix the app startup failing in galaxyproject#17079
mvdbeek added a commit to mvdbeek/galaxy that referenced this issue Nov 26, 2023
I think the premise that we want to do a rollback on exceptions in this
method is wrong (it **may** be correct apprach in other places in the
codebase e.g. in
`Tool.handle_single_execution()`). Here it prevents us from comitting
anything inside the with statement (as the job_wrapper.fail method
does).
Here's the simplified issue:

```shell
❯ python -i scripts/db_shell.py -c config/galaxy.yml
>>> with sa_session() as session, session.begin():
...      sa_session.execute(update(Job).where(Job.id == 1).values(state="error"))
...      sa_session.commit()
...      sa_session.execute(update(Job).where(Job.id == 1).values(state="ok"))
...      sa_session.commit()
...
<sqlalchemy.engine.cursor.LegacyCursorResult object at 0x11f1be350>
Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "<string>", line 2, in execute
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1711, in execute
    conn = self._connection_for_bind(bind, close_with_result=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1552, in _connection_for_bind
    TransactionalContext._trans_ctx_check(self)
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/engine/util.py", line 199, in _trans_ctx_check
    raise exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.
```

It is probably still worthwhile to have the job recovery be minimal and
do things such as calling the job wrapper fail method that does actual
work to the job handler as in
galaxyproject#17083, but that's
refactoring that can be done on the dev branch and it still seems risky
in the sense that we then need to be very careful in ensuring we don't
commit anywhere else inside the scope of the begin() statement.

Finally I don't think it makes sense that the startup check should
ever cause the boot process to fail. This isn't a misconfiguration
or even anything catastrophic for the remaining jobs and places
unnecessary stress on admins and can basically break at any time
and shouldn't cause a complete service failure.

Fixes galaxyproject#17079
mvdbeek added a commit to mvdbeek/galaxy that referenced this issue Nov 27, 2023
I think the premise that we want to do a rollback on exceptions in this
method is wrong (it **may** be correct apprach in other places in the
codebase e.g. in
`Tool.handle_single_execution()`). Here it prevents us from comitting
anything inside the with statement (as the job_wrapper.fail method
does).
Here's the simplified issue:

```shell
❯ python -i scripts/db_shell.py -c config/galaxy.yml
>>> with sa_session() as session, session.begin():
...      sa_session.execute(update(Job).where(Job.id == 1).values(state="error"))
...      sa_session.commit()
...      sa_session.execute(update(Job).where(Job.id == 1).values(state="ok"))
...      sa_session.commit()
...
<sqlalchemy.engine.cursor.LegacyCursorResult object at 0x11f1be350>
Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "<string>", line 2, in execute
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1711, in execute
    conn = self._connection_for_bind(bind, close_with_result=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 1552, in _connection_for_bind
    TransactionalContext._trans_ctx_check(self)
  File "/Users/mvandenb/src/galaxy/.venv/lib/python3.11/site-packages/sqlalchemy/engine/util.py", line 199, in _trans_ctx_check
    raise exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.
```

It is probably still worthwhile to have the job recovery be minimal and
do things such as calling the job wrapper fail method that does actual
work to the job handler as in
galaxyproject#17083, but that's
refactoring that can be done on the dev branch and it still seems risky
in the sense that we then need to be very careful in ensuring we don't
commit anywhere else inside the scope of the begin() statement.

Finally I don't think it makes sense that the startup check should
ever cause the boot process to fail. This isn't a misconfiguration
or even anything catastrophic for the remaining jobs and places
unnecessary stress on admins and can basically break at any time
and shouldn't cause a complete service failure.

Fixes galaxyproject#17079
@kysrpex
Copy link
Contributor Author

kysrpex commented Nov 27, 2023

and the transaction error should've been fixed in https://github.com/galaxyproject/galaxy/pull/16687/files. Can you confirm you got that commit on the handler that failed ?

We have that commit.

$ git branch --contains aedbb393e9fc6a3282cd020fe9e0786c10ca8937 | grep release_23.1_europe
* release_23.1_europe

I guess #17083 and #17085 are meant to fix the issue?

@mvdbeek
Copy link
Member

mvdbeek commented Nov 27, 2023

yes

@kysrpex
Copy link
Contributor Author

kysrpex commented Dec 1, 2023

Thanks @mvdbeek btw, this is working :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants