1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/a478d3fb1d07/ changeset: a478d3fb1d07 user: natefoo date: 2012-11-15 17:11:23 summary: When a job fails, pause any dependent jobs (and the dependent jobs' outputs). affected #: 5 files diff -r 0074aa873198dc48ae9e8e5f5b7c70a99dc0cf54 -r a478d3fb1d07fd929f22ba55e90ee96a81393cf3 lib/galaxy/jobs/__init__.py --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -245,6 +245,9 @@ # Update (non-library) job output datasets through the object store if dataset not in job.output_library_datasets: self.app.object_store.update_from_file(dataset.dataset, create=True) + # Pause any dependent jobs (and those jobs' outputs) + for dep_job_assoc in dataset.dependent_jobs: + self.pause( dep_job_assoc.job, "Execution of this dataset's job is paused because its input datasets are in an error state." ) self.sa_session.add( dataset ) self.sa_session.flush() job.state = job.states.ERROR @@ -275,6 +278,19 @@ if self.app.config.cleanup_job == 'always' or (self.app.config.cleanup_job == 'onsuccess' and job.state == job.states.DELETED): self.cleanup() + def pause( self, job=None, message=None ): + if job is None: + job = self.get_job() + if message is None: + message = "Execution of this dataset's job is paused" + if job.state == job.states.NEW: + for dataset_assoc in job.output_datasets + job.output_library_datasets: + dataset_assoc.dataset.dataset.state = dataset_assoc.dataset.dataset.states.PAUSED + dataset_assoc.dataset.info = message + self.sa_session.add( dataset_assoc.dataset ) + job.state = job.states.PAUSED + self.sa_session.add( job ) + def change_state( self, state, info = False ): job = self.get_job() self.sa_session.refresh( job ) @@ -437,6 +453,9 @@ log.debug( "setting dataset state to ERROR" ) # TODO: This is where the state is being set to error. Change it! dataset_assoc.dataset.dataset.state = model.Dataset.states.ERROR + # Pause any dependent jobs (and those jobs' outputs) + for dep_job_assoc in dataset_assoc.dataset.dependent_jobs: + self.pause( dep_job_assoc.job, "Execution of this dataset's job is paused because its input datasets are in an error state." ) else: dataset_assoc.dataset.dataset.state = model.Dataset.states.OK # If any of the rest of the finish method below raises an diff -r 0074aa873198dc48ae9e8e5f5b7c70a99dc0cf54 -r a478d3fb1d07fd929f22ba55e90ee96a81393cf3 lib/galaxy/jobs/handler.py --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -193,6 +193,10 @@ elif job_state == JOB_USER_OVER_QUOTA: log.info( "(%d) User (%s) is over quota: job paused" % ( job.id, job.user_id ) ) job.state = model.Job.states.PAUSED + for dataset_assoc in job.output_datasets + job.output_library_datasets: + dataset_assoc.dataset.dataset.state = model.Dataset.states.PAUSED + dataset_assoc.dataset.blurb = "Execution of this dataset's job is paused because you were over your disk quota at the time it was ready to run" + self.sa_session.add( dataset_assoc.dataset.dataset ) self.sa_session.add( job ) else: log.error( "(%d) Job in unknown state '%s'" % ( job.id, job_state ) ) diff -r 0074aa873198dc48ae9e8e5f5b7c70a99dc0cf54 -r a478d3fb1d07fd929f22ba55e90ee96a81393cf3 lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -870,6 +870,7 @@ EMPTY = 'empty', ERROR = 'error', DISCARDED = 'discarded', + PAUSED = 'paused', SETTING_METADATA = 'setting_metadata', FAILED_METADATA = 'failed_metadata' ) permitted_actions = get_permitted_actions( filter='DATASET' ) diff -r 0074aa873198dc48ae9e8e5f5b7c70a99dc0cf54 -r a478d3fb1d07fd929f22ba55e90ee96a81393cf3 lib/galaxy/model/mapping.py --- a/lib/galaxy/model/mapping.py +++ b/lib/galaxy/model/mapping.py @@ -1571,13 +1571,13 @@ ) ) assign_mapper( context, JobToInputDatasetAssociation, JobToInputDatasetAssociation.table, - properties=dict( job=relation( Job ), dataset=relation( HistoryDatasetAssociation, lazy=False ) ) ) + properties=dict( job=relation( Job ), dataset=relation( HistoryDatasetAssociation, lazy=False, backref="dependent_jobs" ) ) ) assign_mapper( context, JobToOutputDatasetAssociation, JobToOutputDatasetAssociation.table, properties=dict( job=relation( Job ), dataset=relation( HistoryDatasetAssociation, lazy=False ) ) ) assign_mapper( context, JobToInputLibraryDatasetAssociation, JobToInputLibraryDatasetAssociation.table, - properties=dict( job=relation( Job ), dataset=relation( LibraryDatasetDatasetAssociation, lazy=False ) ) ) + properties=dict( job=relation( Job ), dataset=relation( LibraryDatasetDatasetAssociation, lazy=False, backref="dependent_jobs" ) ) ) assign_mapper( context, JobToOutputLibraryDatasetAssociation, JobToOutputLibraryDatasetAssociation.table, properties=dict( job=relation( Job ), dataset=relation( LibraryDatasetDatasetAssociation, lazy=False ) ) ) diff -r 0074aa873198dc48ae9e8e5f5b7c70a99dc0cf54 -r a478d3fb1d07fd929f22ba55e90ee96a81393cf3 templates/root/history_common.mako --- a/templates/root/history_common.mako +++ b/templates/root/history_common.mako @@ -153,7 +153,7 @@ </div> %elif data_state == "paused": <div> - ${_('Job is currently paused. Check your quota and parent jobs for failure, use the history menu to resume.')}</div> + ${_('Job is currently paused:')} <i>${data.display_info().strip().rstrip('.')}.</i> ${_('Use the history menu to resume.')}</div><div><a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information tooltip"></a> %if for_editing: 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.