commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/97bf49816c0b/ Changeset: 97bf49816c0b Branch: next-stable User: carlfeberhard Date: 2013-03-28 21:23:51 Summary: history: remove job subquery Affected #: 3 files diff -r 76a1a432fc202cd7f44bf97e0e5d361d3159d2aa -r 97bf49816c0ba82bb47b5846bcce0d067a0a8bf4 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -884,24 +884,15 @@ """ hda_model = trans.model.HistoryDatasetAssociation - # outer join with job output to get job_state or None - job_subq = ( trans.sa_session.query( - trans.model.Job.id.label( 'job_id' ), - trans.model.Job.state.label( 'job_state' ), - trans.model.JobToOutputDatasetAssociation.dataset_id.label( 'hda_id' ) ) - .join( trans.model.JobToOutputDatasetAssociation ) ).subquery() - # get state, name, etc. columns = ( hda_model.name, hda_model.hid, hda_model.id, hda_model.deleted, - trans.model.Dataset.state, - job_subq.c.job_state, job_subq.c.job_id ) - column_keys = [ "name", "hid", "id", "deleted", "state", "job_state", "job_id" ] + trans.model.Dataset.state ) + column_keys = [ "name", "hid", "id", "deleted", "state" ] query = ( trans.sa_session.query( *columns ) .enable_eagerloads( False ) .filter( hda_model.history == history ) .join( trans.model.Dataset ) - .outerjoin(( job_subq, job_subq.c.hda_id == hda_model.id )) .order_by( hda_model.hid ) ) # build dictionaries, adding history id and encoding all ids @@ -969,20 +960,6 @@ return state - def _are_jobs_still_running( self, trans, hda_summary_list ): - """Determine whether any jobs are running from the given - list of hda summary dictionaries. - """ - job_states = trans.model.Job.states - def is_job_running( job_state ): - return ( ( job_state == job_states.NEW ) - or( job_state == job_states.UPLOAD ) - or( job_state == job_states.WAITING ) - or( job_state == job_states.QUEUED ) - or( job_state == job_states.RUNNING ) ) - - return len( filter( lambda hda: is_job_running( hda['job_state'] ), hda_summary_list ) ) - def get_history_dict( self, trans, history ): """Returns history data in the form of a dictionary. """ @@ -1003,8 +980,6 @@ history_dict[ 'state_ids' ] = state_ids history_dict[ 'state' ] = self._get_history_state_from_hdas( trans, history, state_counts ) - history_dict[ 'jobs_running' ] = self._are_jobs_still_running( trans, hda_summaries ) - return history_dict diff -r 76a1a432fc202cd7f44bf97e0e5d361d3159d2aa -r 97bf49816c0ba82bb47b5846bcce0d067a0a8bf4 lib/galaxy/webapps/galaxy/controllers/root.py --- a/lib/galaxy/webapps/galaxy/controllers/root.py +++ b/lib/galaxy/webapps/galaxy/controllers/root.py @@ -172,6 +172,7 @@ show_deleted = show_deleted, show_hidden=show_hidden, over_quota=trans.app.quota_agent.get_percent( trans=trans ) >= 100, + log = log, message=message, status=status ) diff -r 76a1a432fc202cd7f44bf97e0e5d361d3159d2aa -r 97bf49816c0ba82bb47b5846bcce0d067a0a8bf4 templates/webapps/galaxy/root/alternate_history.mako --- a/templates/webapps/galaxy/root/alternate_history.mako +++ b/templates/webapps/galaxy/root/alternate_history.mako @@ -191,7 +191,12 @@ ##TODO: api/web controllers should use common code, and this section should call that code <%def name="get_history( history )"><% - return h.to_json_string( history ) + try: + return h.to_json_string( history ) + except TypeError, type_err: + log.error( 'Could not serialize history' ) + log.debug( 'history data: %s', str( history ) ) + return '{}' %></%def> @@ -206,7 +211,12 @@ <%def name="get_hdas( hdas )"><% - return h.to_json_string( hdas ) + try: + return h.to_json_string( hdas ) + except TypeError, type_err: + log.error( 'Could not serialize hdas for history: %s', history['id'] ) + log.debug( 'hda data: %s', str( hdas ) ) + return '{}' %></%def> https://bitbucket.org/galaxy/galaxy-central/commits/92c8a55a6679/ Changeset: 92c8a55a6679 User: carlfeberhard Date: 2013-03-28 21:24:16 Summary: merge stable Affected #: 3 files diff -r 67f38ca2d9b3fa3721a93542ca9b26d7902d042b -r 92c8a55a6679aeae14431202a04affb7b4f9b701 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -884,24 +884,15 @@ """ hda_model = trans.model.HistoryDatasetAssociation - # outer join with job output to get job_state or None - job_subq = ( trans.sa_session.query( - trans.model.Job.id.label( 'job_id' ), - trans.model.Job.state.label( 'job_state' ), - trans.model.JobToOutputDatasetAssociation.dataset_id.label( 'hda_id' ) ) - .join( trans.model.JobToOutputDatasetAssociation ) ).subquery() - # get state, name, etc. columns = ( hda_model.name, hda_model.hid, hda_model.id, hda_model.deleted, - trans.model.Dataset.state, - job_subq.c.job_state, job_subq.c.job_id ) - column_keys = [ "name", "hid", "id", "deleted", "state", "job_state", "job_id" ] + trans.model.Dataset.state ) + column_keys = [ "name", "hid", "id", "deleted", "state" ] query = ( trans.sa_session.query( *columns ) .enable_eagerloads( False ) .filter( hda_model.history == history ) .join( trans.model.Dataset ) - .outerjoin(( job_subq, job_subq.c.hda_id == hda_model.id )) .order_by( hda_model.hid ) ) # build dictionaries, adding history id and encoding all ids @@ -969,20 +960,6 @@ return state - def _are_jobs_still_running( self, trans, hda_summary_list ): - """Determine whether any jobs are running from the given - list of hda summary dictionaries. - """ - job_states = trans.model.Job.states - def is_job_running( job_state ): - return ( ( job_state == job_states.NEW ) - or( job_state == job_states.UPLOAD ) - or( job_state == job_states.WAITING ) - or( job_state == job_states.QUEUED ) - or( job_state == job_states.RUNNING ) ) - - return len( filter( lambda hda: is_job_running( hda['job_state'] ), hda_summary_list ) ) - def get_history_dict( self, trans, history ): """Returns history data in the form of a dictionary. """ @@ -1003,8 +980,6 @@ history_dict[ 'state_ids' ] = state_ids history_dict[ 'state' ] = self._get_history_state_from_hdas( trans, history, state_counts ) - history_dict[ 'jobs_running' ] = self._are_jobs_still_running( trans, hda_summaries ) - return history_dict diff -r 67f38ca2d9b3fa3721a93542ca9b26d7902d042b -r 92c8a55a6679aeae14431202a04affb7b4f9b701 lib/galaxy/webapps/galaxy/controllers/root.py --- a/lib/galaxy/webapps/galaxy/controllers/root.py +++ b/lib/galaxy/webapps/galaxy/controllers/root.py @@ -172,6 +172,7 @@ show_deleted = show_deleted, show_hidden=show_hidden, over_quota=trans.app.quota_agent.get_percent( trans=trans ) >= 100, + log = log, message=message, status=status ) diff -r 67f38ca2d9b3fa3721a93542ca9b26d7902d042b -r 92c8a55a6679aeae14431202a04affb7b4f9b701 templates/webapps/galaxy/root/alternate_history.mako --- a/templates/webapps/galaxy/root/alternate_history.mako +++ b/templates/webapps/galaxy/root/alternate_history.mako @@ -191,7 +191,12 @@ ##TODO: api/web controllers should use common code, and this section should call that code <%def name="get_history( history )"><% - return h.to_json_string( history ) + try: + return h.to_json_string( history ) + except TypeError, type_err: + log.error( 'Could not serialize history' ) + log.debug( 'history data: %s', str( history ) ) + return '{}' %></%def> @@ -206,7 +211,12 @@ <%def name="get_hdas( hdas )"><% - return h.to_json_string( hdas ) + try: + return h.to_json_string( hdas ) + except TypeError, type_err: + log.error( 'Could not serialize hdas for history: %s', history['id'] ) + log.debug( 'hda data: %s', str( hdas ) ) + return '{}' %></%def> 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)
-
commits-noreply@bitbucket.org