commit/galaxy-central: 4 new changesets
4 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/ec3b5956130f/ changeset: ec3b5956130f user: jmchilton date: 2012-10-31 18:18:55 summary: Fix small bug in exception handler in lib/galaxy/jobs/handler.py. The bug was preventing exceptions in dynamic job runner methods from being percolated up into the logs. affected #: 1 file diff -r 4ceab232dc02a5a99eca0b24c0038c490d49a392 -r ec3b5956130f767d6f5d9c07c6a64dafd128351f lib/galaxy/jobs/handler.py --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -397,6 +397,11 @@ def put( self, job_wrapper ): try: runner_name = self.__get_runner_name( job_wrapper ) + except Exception: + log.exception( 'Failed to generate job runner name' ) + job_wrapper.fail( 'Unable to run job due to a misconfiguration of the Galaxy job running system. Please contact a site administrator.' ) + return + try: if self.app.config.use_tasked_jobs and job_wrapper.tool.parallelism is not None and isinstance(job_wrapper, TaskWrapper): #DBTODO Refactor log.debug( "dispatching task %s, of job %d, to %s runner" %( job_wrapper.task_id, job_wrapper.job_id, runner_name ) ) https://bitbucket.org/galaxy/galaxy-central/changeset/0206d3a8a4d0/ changeset: 0206d3a8a4d0 user: jmchilton date: 2012-10-31 21:04:33 summary: Allow dynamic job runner rules to pass error messages back to users via job failure message. To do this simply raise galaxy.jobs.mapper.JobMappingException(user_messsage) from a rule method where user_message is the desired message. affected #: 2 files diff -r ec3b5956130f767d6f5d9c07c6a64dafd128351f -r 0206d3a8a4d03b2447ab1ef09cd2a2015ce4c3ae lib/galaxy/jobs/handler.py --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -17,6 +17,7 @@ # States for running a job. These are NOT the same as data states JOB_WAIT, JOB_ERROR, JOB_INPUT_ERROR, JOB_INPUT_DELETED, JOB_READY, JOB_DELETED, JOB_ADMIN_DELETED = 'wait', 'error', 'input_error', 'input_deleted', 'ready', 'deleted', 'admin_deleted' +DEFAULT_JOB_PUT_FAILURE_MESSAGE = 'Unable to run job due to a misconfiguration of the Galaxy job running system. Please contact a site administrator.' class JobHandler( object ): """ @@ -41,6 +42,7 @@ a JobRunner. """ STOP_SIGNAL = object() + def __init__( self, app, dispatcher ): """Start the job manager""" self.app = app @@ -397,9 +399,13 @@ def put( self, job_wrapper ): try: runner_name = self.__get_runner_name( job_wrapper ) - except Exception: - log.exception( 'Failed to generate job runner name' ) - job_wrapper.fail( 'Unable to run job due to a misconfiguration of the Galaxy job running system. Please contact a site administrator.' ) + except Exception, e: + failure_message = getattr(e, 'failure_message', DEFAULT_JOB_PUT_FAILURE_MESSAGE ) + if failure_message == DEFAULT_JOB_PUT_FAILURE_MESSAGE: + log.exception( 'Failed to generate job runner name' ) + else: + log.debug( "Intentionally failing job with message (%s)" % failure_message ) + job_wrapper.fail( failure_message ) return try: if self.app.config.use_tasked_jobs and job_wrapper.tool.parallelism is not None and isinstance(job_wrapper, TaskWrapper): @@ -410,7 +416,7 @@ self.job_runners[runner_name].put( job_wrapper ) except KeyError: log.error( 'put(): (%s) Invalid job runner: %s' % ( job_wrapper.job_id, runner_name ) ) - job_wrapper.fail( 'Unable to run job due to a misconfiguration of the Galaxy job running system. Please contact a site administrator.' ) + job_wrapper.fail( DEFAULT_JOB_PUT_FAILURE_MESSAGE ) def stop( self, job ): """ @@ -452,7 +458,7 @@ self.job_runners[runner_name].recover( job, job_wrapper ) except KeyError: log.error( 'recover(): (%s) Invalid job runner: %s' % ( job_wrapper.job_id, runner_name ) ) - job_wrapper.fail( 'Unable to run job due to a misconfiguration of the Galaxy job running system. Please contact a site administrator.' ) + job_wrapper.fail( DEFAULT_JOB_PUT_FAILURE_MESSAGE ) def shutdown( self ): for runner in self.job_runners.itervalues(): diff -r ec3b5956130f767d6f5d9c07c6a64dafd128351f -r 0206d3a8a4d03b2447ab1ef09cd2a2015ce4c3ae lib/galaxy/jobs/mapper.py --- a/lib/galaxy/jobs/mapper.py +++ b/lib/galaxy/jobs/mapper.py @@ -8,6 +8,12 @@ DYNAMIC_RUNNER_PREFIX = "dynamic:///" +class JobMappingException( Exception ): + + def __init__( self, failure_message ): + self.failure_message = failure_message + + class JobRunnerMapper( object ): """ This class is responsible to managing the mapping of jobs https://bitbucket.org/galaxy/galaxy-central/changeset/6f3b4e88fc21/ changeset: 6f3b4e88fc21 user: jmchilton date: 2012-11-15 05:23:19 summary: Merge latest galaxy-central to resolve conflict introdcued with 73e05bc. affected #: 227 files Diff too large to display. https://bitbucket.org/galaxy/galaxy-central/changeset/f03725b8272b/ changeset: f03725b8272b user: natefoo date: 2012-11-26 19:36:09 summary: Merged in jmchilton/galaxy-central-dynamic-job-runner-enhancements (pull request #82) affected #: 2 files diff -r d0e7bd064cf9a2b991f793c1dc7720430906174f -r f03725b8272bd13aa3fc693b9fcb20d2f0f4c28f lib/galaxy/jobs/handler.py --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -17,6 +17,7 @@ # States for running a job. These are NOT the same as data states JOB_WAIT, JOB_ERROR, JOB_INPUT_ERROR, JOB_INPUT_DELETED, JOB_READY, JOB_DELETED, JOB_ADMIN_DELETED, JOB_USER_OVER_QUOTA = 'wait', 'error', 'input_error', 'input_deleted', 'ready', 'deleted', 'admin_deleted', 'user_over_quota' +DEFAULT_JOB_PUT_FAILURE_MESSAGE = 'Unable to run job due to a misconfiguration of the Galaxy job running system. Please contact a site administrator.' class JobHandler( object ): """ @@ -41,6 +42,7 @@ a JobRunner. """ STOP_SIGNAL = object() + def __init__( self, app, dispatcher ): """Start the job manager""" self.app = app @@ -462,6 +464,15 @@ def put( self, job_wrapper ): try: runner_name = self.__get_runner_name( job_wrapper ) + except Exception, e: + failure_message = getattr(e, 'failure_message', DEFAULT_JOB_PUT_FAILURE_MESSAGE ) + if failure_message == DEFAULT_JOB_PUT_FAILURE_MESSAGE: + log.exception( 'Failed to generate job runner name' ) + else: + log.debug( "Intentionally failing job with message (%s)" % failure_message ) + job_wrapper.fail( failure_message ) + return + try: if self.app.config.use_tasked_jobs and job_wrapper.tool.parallelism is not None and isinstance(job_wrapper, TaskWrapper): #DBTODO Refactor log.debug( "dispatching task %s, of job %d, to %s runner" %( job_wrapper.task_id, job_wrapper.job_id, runner_name ) ) @@ -470,7 +481,7 @@ self.job_runners[runner_name].put( job_wrapper ) except KeyError: log.error( 'put(): (%s) Invalid job runner: %s' % ( job_wrapper.job_id, runner_name ) ) - job_wrapper.fail( 'Unable to run job due to a misconfiguration of the Galaxy job running system. Please contact a site administrator.' ) + job_wrapper.fail( DEFAULT_JOB_PUT_FAILURE_MESSAGE ) def stop( self, job ): """ @@ -512,7 +523,7 @@ self.job_runners[runner_name].recover( job, job_wrapper ) except KeyError: log.error( 'recover(): (%s) Invalid job runner: %s' % ( job_wrapper.job_id, runner_name ) ) - job_wrapper.fail( 'Unable to run job due to a misconfiguration of the Galaxy job running system. Please contact a site administrator.' ) + job_wrapper.fail( DEFAULT_JOB_PUT_FAILURE_MESSAGE ) def shutdown( self ): for runner in self.job_runners.itervalues(): diff -r d0e7bd064cf9a2b991f793c1dc7720430906174f -r f03725b8272bd13aa3fc693b9fcb20d2f0f4c28f lib/galaxy/jobs/mapper.py --- a/lib/galaxy/jobs/mapper.py +++ b/lib/galaxy/jobs/mapper.py @@ -8,6 +8,12 @@ DYNAMIC_RUNNER_PREFIX = "dynamic:///" +class JobMappingException( Exception ): + + def __init__( self, failure_message ): + self.failure_message = failure_message + + class JobRunnerMapper( object ): """ This class is responsible to managing the mapping of jobs Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket