commit/galaxy-central: carlfeberhard: History panel: remove profiling methods
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/b9bd309b4b72/ Changeset: b9bd309b4b72 User: carlfeberhard Date: 2013-07-24 17:06:51 Summary: History panel: remove profiling methods Affected #: 3 files diff -r 6fa490b703b062231da599fdd7f169d84eddc930 -r b9bd309b4b72cce4f5bd277cd628b3855934d1f1 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -631,72 +631,6 @@ return trans.security.encode_dict_ids( hda_dict ) - def profile_get_hda_dict( self, trans, hda ): - """Profiles returning full details of this HDA in dictionary form. - """ - from galaxy.util.debugging import SimpleProfiler - profiler = SimpleProfiler() - profiler.start() - - hda_dict = hda.get_api_value( view='element' ) - profiler.report( '\t\t get_api_value' ) - history = hda.history - hda_dict[ 'api_type' ] = "file" - - # Add additional attributes that depend on trans can hence must be added here rather than at the model level. - can_access_hda = trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset ) - can_access_hda = ( trans.user_is_admin() or can_access_hda ) - hda_dict[ 'accessible' ] = can_access_hda - profiler.report( '\t\t accessible' ) - - # ---- return here if deleted AND purged OR can't access - purged = ( hda.purged or hda.dataset.purged ) - if ( hda.deleted and purged ) or not can_access_hda: - #TODO: get_api_value should really go AFTER this - only summary data - return ( profiler, trans.security.encode_dict_ids( hda_dict ) ) - - if trans.user_is_admin() or trans.app.config.expose_dataset_path: - hda_dict[ 'file_name' ] = hda.file_name - profiler.report( '\t\t file_name' ) - - hda_dict[ 'download_url' ] = url_for( 'history_contents_display', - history_id = trans.security.encode_id( history.id ), - history_content_id = trans.security.encode_id( hda.id ) ) - profiler.report( '\t\t download_url' ) - - # indeces, assoc. metadata files, etc. - meta_files = [] - for meta_type in hda.metadata.spec.keys(): - if isinstance( hda.metadata.spec[ meta_type ].param, FileParameter ): - meta_files.append( dict( file_type=meta_type ) ) - if meta_files: - hda_dict[ 'meta_files' ] = meta_files - profiler.report( '\t\t meta_files' ) - - # currently, the viz reg is optional - handle on/off - if trans.app.visualizations_registry: - hda_dict[ 'visualizations' ] = trans.app.visualizations_registry.get_visualizations( trans, hda ) - else: - hda_dict[ 'visualizations' ] = hda.get_visualizations() - profiler.report( '\t\t visualizations' ) - #TODO: it may also be wiser to remove from here and add as API call that loads the visualizations - # when the visualizations button is clicked (instead of preloading/pre-checking) - - # ---- return here if deleted - if hda.deleted and not purged: - return ( profiler, trans.security.encode_dict_ids( hda_dict ) ) - - # if a tool declares 'force_history_refresh' in its xml, when the hda -> ready, reload the history panel - # expensive - if( ( hda.state in [ 'running', 'queued' ] ) - and ( hda.creating_job and hda.creating_job.tool_id ) ): - tool_used = trans.app.toolbox.get_tool( hda.creating_job.tool_id ) - if tool_used and tool_used.force_history_refresh: - hda_dict[ 'force_history_refresh' ] = True - profiler.report( '\t\t force_history_refresh' ) - - return ( profiler, trans.security.encode_dict_ids( hda_dict ) ) - def get_hda_dict_with_error( self, trans, hda, error_msg='' ): return trans.security.encode_dict_ids({ 'id' : hda.id, diff -r 6fa490b703b062231da599fdd7f169d84eddc930 -r b9bd309b4b72cce4f5bd277cd628b3855934d1f1 lib/galaxy/webapps/galaxy/controllers/root.py --- a/lib/galaxy/webapps/galaxy/controllers/root.py +++ b/lib/galaxy/webapps/galaxy/controllers/root.py @@ -157,76 +157,6 @@ history_json = to_json_string( history_dictionary ), hda_json = to_json_string( hda_dictionaries ), show_deleted=show_deleted, show_hidden=show_hidden, hda_id=hda_id, log=log, message=message, status=status ) - @web.expose - def profile_history( self, trans, as_xml=False, show_deleted=None, show_hidden=None, hda_id=None, **kwd ): - """ - Same as above but adds SimpleProfiler to get some - profiling times for the operations done. - """ - if as_xml: - return self.history_as_xml( trans, - show_deleted=string_as_bool( show_deleted ), show_hidden=string_as_bool( show_hidden ) ) - - # get all datasets server-side, client-side will get flags and render appropriately - show_deleted = string_as_bool_or_none( show_deleted ) - show_purged = show_deleted - show_hidden = string_as_bool_or_none( show_hidden ) - params = Params( kwd ) - message = params.get( 'message', '' ) - #TODO: ugh... - message = message if message != 'None' else '' - status = params.get( 'status', 'done' ) - - if trans.app.config.require_login and not trans.user: - return trans.fill_template( '/no_access.mako', message = 'Please log in to access Galaxy histories.' ) - - def err_msg( where=None ): - where = where if where else 'getting the history data from the server' - err_msg = ( 'An error occurred %s. ' - + 'Please contact a Galaxy administrator if the problem persists.' ) %( where ) - return err_msg, 'error' - - profiler = SimpleProfiler() - profiler.start() - - history_dictionary = {} - hda_dictionaries = [] - import pprint - try: - history = trans.get_history( create=True ) - profiler.report( 'trans.get_history' ) - hdas = self.get_history_datasets( trans, history, - show_deleted=True, show_hidden=True, show_purged=True ) - profiler.report( 'get_history_datasets' ) - - for hda in hdas: - try: - ( hda_profiler, hda_dict ) = self.profile_get_hda_dict( trans, hda ) - profiler.reports.extend( hda_profiler.get_reports() ) - profiler.report( '\t hda -> dictionary (%s)' %( hda.name ) ) - hda_dictionaries.append( hda_dict ) - - except Exception, exc: - # don't fail entire list if hda err's, record and move on - log.error( 'Error bootstrapping hda %d: %s', hda.id, str( exc ), exc_info=True ) - hda_dictionaries.append( self.get_hda_dict_with_error( trans, hda, str( exc ) ) ) - profiler.report( 'hdas -> dictionaries' ) - - # re-use the hdas above to get the history data... - history_dictionary = self.get_history_dict( trans, history, hda_dictionaries=hda_dictionaries ) - profiler.report( 'history -> dictionary' ) - - except Exception, exc: - user_id = str( trans.user.id ) if trans.user else '(anonymous)' - log.error( 'Error bootstrapping history for user %s: %s', user_id, str( exc ), exc_info=True ) - message, status = err_msg() - history_dictionary[ 'error' ] = message - - return trans.stream_template_mako( "root/history.mako", - history_json = to_json_string( history_dictionary ), hda_json = to_json_string( hda_dictionaries ), - show_deleted=show_deleted, show_hidden=show_hidden, hda_id=hda_id, log=log, message=message, status=status, - profiling=profiler.get_reports() ) - ## ---- Dataset display / editing ---------------------------------------- @web.expose def display( self, trans, id=None, hid=None, tofile=None, toext=".txt", **kwd ): diff -r 6fa490b703b062231da599fdd7f169d84eddc930 -r b9bd309b4b72cce4f5bd277cd628b3855934d1f1 templates/webapps/galaxy/root/history.mako --- a/templates/webapps/galaxy/root/history.mako +++ b/templates/webapps/galaxy/root/history.mako @@ -213,10 +213,6 @@ galaxyPageSetUp(); // ostensibly, this is the App - %if 'profiling' in self.context.kwargs: - Galaxy.profiling = ${h.to_json_string( profiling )}.join( '\n' ); - %endif - //NOTE: for debugging on non-local instances (main/test) // 1. load history panel in own tab // 2. from console: new PersistantStorage( '__history_panel' ).set( 'debugging', true ) 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