commit/galaxy-central: greg: For standardization and clarity, rename Galaxy's UpdateManager to be UpdateRepositoryManager.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/95937a7e51f2/ Changeset: 95937a7e51f2 User: greg Date: 2014-06-17 17:24:33 Summary: For standardization and clarity, rename Galaxy's UpdateManager to be UpdateRepositoryManager. Affected #: 4 files diff -r fa69b6d3cafdc18e2531cfd015676223f33cee67 -r 95937a7e51f20da0ebf0853f9385286d2c70c4eb lib/galaxy/app.py --- a/lib/galaxy/app.py +++ b/lib/galaxy/app.py @@ -82,10 +82,10 @@ self.data_managers = DataManagers( self ) # If enabled, poll respective tool sheds to see if updates are available for any installed tool shed repositories. if self.config.get_bool( 'enable_tool_shed_check', False ): - from tool_shed.galaxy_install import update_manager - self.update_manager = update_manager.UpdateManager( self ) + from tool_shed.galaxy_install import update_repository_manager + self.update_repository_manager = update_repository_manager.UpdateRepositoryManager( self ) else: - self.update_manager = None + self.update_repository_manager = None # Load proprietary datatype converters and display applications. self.installed_repository_manager.load_proprietary_converters_and_display_applications() # Load datatype display applications defined in local datatypes_conf.xml @@ -159,8 +159,8 @@ self.object_store.shutdown() if self.heartbeat: self.heartbeat.shutdown() - if self.update_manager: - self.update_manager.shutdown() + if self.update_repository_manager is not None: + self.update_repository_manager.shutdown() if self.control_worker: self.control_worker.shutdown() try: diff -r fa69b6d3cafdc18e2531cfd015676223f33cee67 -r 95937a7e51f20da0ebf0853f9385286d2c70c4eb lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -887,7 +887,7 @@ """Handle a request from a local Galaxy instance.""" message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) - # If the request originated with the UpdateManager, it will not include a galaxy_url. + # If the request originated with the UpdateRepositoryManager, it will not include a galaxy_url. galaxy_url = common_util.handle_galaxy_url( trans, **kwd ) name = kwd.get( 'name', None ) owner = kwd.get( 'owner', None ) diff -r fa69b6d3cafdc18e2531cfd015676223f33cee67 -r 95937a7e51f20da0ebf0853f9385286d2c70c4eb lib/tool_shed/galaxy_install/update_manager.py --- a/lib/tool_shed/galaxy_install/update_manager.py +++ /dev/null @@ -1,67 +0,0 @@ -""" -Determine if installed tool shed repositories have updates available in their respective tool sheds. -""" -import logging -import threading -from galaxy.util import string_as_bool -import tool_shed.util.shed_util_common as suc -from tool_shed.util import common_util -from galaxy.model.orm import and_ - -log = logging.getLogger( __name__ ) - - -class UpdateManager( object ): - - def __init__( self, app ): - self.app = app - self.context = self.app.install_model.context - # Ideally only one Galaxy server process should be able to check for repository updates. - self.running = True - self.sleeper = Sleeper() - self.restarter = threading.Thread( target=self.__restarter ) - self.restarter.start() - self.seconds_to_sleep = int( app.config.hours_between_check * 3600 ) - - def __restarter( self ): - log.info( 'Update manager restarter starting up...' ) - while self.running: - # Make a call to the tool shed for each installed repository to get the latest status information in the tool shed for the - # repository. This information includes items like newer installable repository revisions, current revision updates, whether - # the repository revision is the latest installable revision, and whether the repository has been deprecated in the tool shed. - for repository in self.context.query( self.app.install_model.ToolShedRepository ) \ - .filter( self.app.install_model.ToolShedRepository.table.c.deleted == False ): - tool_shed_status_dict = suc.get_tool_shed_status_for_installed_repository( self.app, repository ) - if tool_shed_status_dict: - if tool_shed_status_dict != repository.tool_shed_status: - repository.tool_shed_status = tool_shed_status_dict - self.context.flush() - else: - # The received tool_shed_status_dict is an empty dictionary, so coerce to None. - tool_shed_status_dict = None - if tool_shed_status_dict != repository.tool_shed_status: - repository.tool_shed_status = tool_shed_status_dict - self.context.flush() - self.sleeper.sleep( self.seconds_to_sleep ) - log.info( 'Update manager restarter shutting down...' ) - - def shutdown( self ): - self.running = False - self.sleeper.wake() - - -class Sleeper( object ): - """Provides a 'sleep' method that sleeps for a number of seconds *unless* the notify method is called (from a different thread).""" - - def __init__( self ): - self.condition = threading.Condition() - - def sleep( self, seconds ): - self.condition.acquire() - self.condition.wait( seconds ) - self.condition.release() - - def wake( self ): - self.condition.acquire() - self.condition.notify() - self.condition.release() diff -r fa69b6d3cafdc18e2531cfd015676223f33cee67 -r 95937a7e51f20da0ebf0853f9385286d2c70c4eb lib/tool_shed/galaxy_install/update_repository_manager.py --- /dev/null +++ b/lib/tool_shed/galaxy_install/update_repository_manager.py @@ -0,0 +1,69 @@ +""" +Determine if installed tool shed repositories have updates available in their respective tool sheds. +""" +import logging +import threading +import tool_shed.util.shed_util_common as suc + +log = logging.getLogger( __name__ ) + + +class UpdateRepositoryManager( object ): + + def __init__( self, app ): + self.app = app + self.context = self.app.install_model.context + # Ideally only one Galaxy server process should be able to check for repository updates. + self.running = True + self.sleeper = Sleeper() + self.restarter = threading.Thread( target=self.__restarter ) + self.restarter.start() + self.seconds_to_sleep = int( app.config.hours_between_check * 3600 ) + + def __restarter( self ): + log.info( 'Update repository manager restarter starting up...' ) + while self.running: + # Make a call to the Tool Shed for each installed repository to get the latest + # status information in the Tool Shed for the repository. This information includes + # items like newer installable repository revisions, current revision updates, whether + # the repository revision is the latest installable revision, and whether the repository + # has been deprecated in the Tool Shed. + for repository in self.context.query( self.app.install_model.ToolShedRepository ) \ + .filter( self.app.install_model.ToolShedRepository.table.c.deleted == False ): + tool_shed_status_dict = suc.get_tool_shed_status_for_installed_repository( self.app, repository ) + if tool_shed_status_dict: + if tool_shed_status_dict != repository.tool_shed_status: + repository.tool_shed_status = tool_shed_status_dict + self.context.flush() + else: + # The received tool_shed_status_dict is an empty dictionary, so coerce to None. + tool_shed_status_dict = None + if tool_shed_status_dict != repository.tool_shed_status: + repository.tool_shed_status = tool_shed_status_dict + self.context.flush() + self.sleeper.sleep( self.seconds_to_sleep ) + log.info( 'Update repository manager restarter shutting down...' ) + + def shutdown( self ): + self.running = False + self.sleeper.wake() + + +class Sleeper( object ): + """ + Provides a 'sleep' method that sleeps for a number of seconds *unless* the notify method + is called (from a different thread). + """ + + def __init__( self ): + self.condition = threading.Condition() + + def sleep( self, seconds ): + self.condition.acquire() + self.condition.wait( seconds ) + self.condition.release() + + def wake( self ): + self.condition.acquire() + self.condition.notify() + self.condition.release() 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