From 12207363f1eb24d827bedc63e974ac4f0b64c433 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Tue, 29 Jun 2010 13:06:27 -0400 Subject: [PATCH] Remove the rest of the memory_usage debugging module since all of its calls were removed from controller methods. --- lib/galaxy/app.py | 4 --- lib/galaxy/config.py | 1 - lib/galaxy/util/memory_usage.py | 44 --------------------------------- 3 files changed, 49 deletions(-) delete mode 100644 lib/galaxy/util/memory_usage.py diff --git a/lib/galaxy/app.py b/lib/galaxy/app.py index aa281072528..6314ca7754a 100644 --- a/lib/galaxy/app.py +++ b/lib/galaxy/app.py @@ -64,10 +64,6 @@ class UniverseApplication( object ): from galaxy.util import memdump if memdump.Memdump: self.memdump = memdump.Memdump() - # Enable memory_usage logging if configured - if self.config.log_memory_usage: - from galaxy.util import memory_usage - self.memory_usage = memory_usage # Start the job queue self.job_manager = jobs.JobManager( self ) # FIXME: These are exposed directly for backward compatibility diff --git a/lib/galaxy/config.py b/lib/galaxy/config.py index 0c021193125..cad48ecc4b3 100644 --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -80,7 +80,6 @@ class Configuration( object ): self.pbs_stage_path = kwargs.get('pbs_stage_path', "" ) self.use_heartbeat = string_as_bool( kwargs.get( 'use_heartbeat', 'False' ) ) self.use_memdump = string_as_bool( kwargs.get( 'use_memdump', 'False' ) ) - self.log_memory_usage = string_as_bool( kwargs.get( 'log_memory_usage', 'False' ) ) self.log_actions = string_as_bool( kwargs.get( 'log_actions', 'False' ) ) self.log_events = string_as_bool( kwargs.get( 'log_events', 'False' ) ) self.ucsc_display_sites = kwargs.get( 'ucsc_display_sites', "main,test,archaea,ucla" ).lower().split(",") diff --git a/lib/galaxy/util/memory_usage.py b/lib/galaxy/util/memory_usage.py deleted file mode 100644 index a77f6f52b00..00000000000 --- a/lib/galaxy/util/memory_usage.py +++ /dev/null @@ -1,44 +0,0 @@ -import os, platform, logging -from galaxy.datatypes.data import nice_size - -log = logging.getLogger( __name__ ) - -_proc_status = '/proc/%d/status' % os.getpid() - -_scale = { 'kB': 1024.0, 'mB': 1024.0*1024.0, 'KB': 1024.0, 'MB': 1024.0*1024.0 } - -def _VmB( VmKey ): - '''Private. - ''' - global _proc_status, _scale - # get pseudo file /proc//status - try: - t = open( _proc_status ) - v = t.read() - t.close() - except: - log.debug("memory_usage is currently supported only on Linux, your platform is %s %s" % ( platform.system(), platform.release() ) ) - return 0.0 # non-Linux? - # get VmKey line e.g. 'VmRSS: 9999 kB\n ...' - i = v.index( VmKey ) - v = v[ i: ].split( None, 3 ) # whitespace - if len( v ) < 3: - return 0.0 # invalid format? - # convert Vm value to bytes - return float( v[ 1 ] ) * _scale[ v[ 2 ] ] -def memory( since=0.0, pretty=False ): - '''Return memory usage in bytes. - ''' - size = _VmB( 'VmSize:' ) - since - if pretty: - return nice_size( size ) - else: - return size -def resident( since=0.0 ): - '''Return resident memory usage in bytes. - ''' - return _VmB( 'VmRSS:' ) - since -def stacksize( since=0.0 ): - '''Return stack size in bytes. - ''' - return _VmB( 'VmStk:' ) - since