Fix the use of JobMappingException

This commit is contained in:
Nate Coraor
2019-04-19 14:43:30 -04:00
parent 5f65252d4d
commit 87b7bfd458
+12 -1
View File
@@ -27,7 +27,7 @@ from galaxy import model, util
from galaxy.datatypes import metadata, sniff
from galaxy.exceptions import ObjectInvalid, ObjectNotFound
from galaxy.jobs.actions.post import ActionBox
from galaxy.jobs.mapper import JobRunnerMapper
from galaxy.jobs.mapper import JobMappingException, JobRunnerMapper
from galaxy.jobs.runners import BaseJobRunner, JobState
from galaxy.objectstore import ObjectStorePopulator
from galaxy.util import safe_makedirs, unicodify
@@ -993,6 +993,17 @@ class JobWrapper(HasResourceParameters):
"""
job = self.get_job()
self.sa_session.refresh(job)
# If this fail method is being called because a dynamic rule raised JobMappingException, the call to
# self.get_destination_configuration() below accesses self.job_destination and will just cause
# JobMappingException to be raised again.
try:
self.job_destination
except JobMappingException as exc:
log.debug("(%s) fail(): Job destination raised JobMappingException('%s'), caching fake '__fail__' "
"destination for completion of fail method", self.get_id_tag(), str(exc.failure_message))
self.job_runner_mapper.cached_job_destination = JobDestination(id='__fail__')
# if the job was deleted, don't fail it
if not job.state == job.states.DELETED:
# Check if the failure is due to an exception