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

[24.1] Raise MessageException instead of assertions on rerun problems #18858

Open
wants to merge 1 commit into
base: release_24.1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions lib/galaxy/tools/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from galaxy import model
from galaxy.exceptions import (
AuthenticationRequired,
ItemAccessibilityException,
RequestParameterInvalidException,
)
Expand Down Expand Up @@ -758,19 +759,22 @@ def _remap_job_on_rerun(self, trans, galaxy_session, rerun_remap_job_id, current
try:
old_job = trans.sa_session.get(Job, rerun_remap_job_id)
assert old_job is not None, f"({rerun_remap_job_id}/{current_job.id}): Old job id is invalid"
assert (
old_job.tool_id == current_job.tool_id
), f"({old_job.id}/{current_job.id}): Old tool id ({old_job.tool_id}) does not match rerun tool id ({current_job.tool_id})"
if old_job.old_id != current_job.old_id:
raise RequestParameterInvalidException(
f"Old tool id ({old_job.tool_id}) does not match rerun tool id ({current_job.tool_id})"
)
if trans.user is not None:
assert (
old_job.user_id == trans.user.id
), f"({old_job.id}/{current_job.id}): Old user id ({old_job.user_id}) does not match rerun user id ({trans.user.id})"
if old_job.user_id != trans.user.id:
raise RequestParameterInvalidException(
"Cannot remap job dependencies for job not created by current user."
)
elif trans.user is None and isinstance(galaxy_session, trans.model.GalaxySession):
assert (
old_job.session_id == galaxy_session.id
), f"({old_job.id}/{current_job.id}): Old session id ({old_job.session_id}) does not match rerun session id ({galaxy_session.id})"
if old_job.session_id != galaxy_session.id:
raise RequestParameterInvalidException(
"Cannot remap job dependencies for job not created by current user."
)
else:
raise Exception(f"({old_job.id}/{current_job.id}): Remapping via the API is not (yet) supported")
raise AuthenticationRequired("Authentication required to remap job dependencies")
# Start by hiding current job outputs before taking over the old job's (implicit) outputs.
current_job.hide_outputs(flush=False)
# Duplicate PJAs before remap.
Expand Down
Loading