diff --git a/lib/galaxy/web/stack/__init__.py b/lib/galaxy/web/stack/__init__.py index 44a58b882d4..ab7976b2526 100644 --- a/lib/galaxy/web/stack/__init__.py +++ b/lib/galaxy/web/stack/__init__.py @@ -255,7 +255,7 @@ class UWSGIApplicationStack(MessageApplicationStack): # Does a generalized `is_worker` attribute make sense? Hard to say w/o other stack paradigms. if self._is_mule and self._farm_name: # used by main.py to send a shutdown message on termination - os.environ['_GALAXY_UWSGI_FARM_NAME'] = self._farm_name + os.environ['_GALAXY_UWSGI_FARM_NAMES'] = ','.join(self._farms) super(UWSGIApplicationStack, self).start() def has_pool(self, pool_name): diff --git a/scripts/galaxy-main b/scripts/galaxy-main index b42b4e5225f..9cb5b7da345 100755 --- a/scripts/galaxy-main +++ b/scripts/galaxy-main @@ -62,7 +62,7 @@ DEFAULT_VERBOSE = True DESCRIPTION = "Daemonized entry point for Galaxy." SHUTDOWN_MSG = '__SHUTDOWN__' -UWSGI_FARM_VAR = '_GALAXY_UWSGI_FARM_NAME' +UWSGI_FARMS_VAR = '_GALAXY_UWSGI_FARM_NAMES' exit = threading.Event() @@ -103,9 +103,10 @@ def load_galaxy_app( def handle_signal(signum, frame): log.info('Received signal %d, exiting', signum) if uwsgi and 'mule_id' in dir(uwsgi) and uwsgi.mule_id() > 0: - farm = os.environ.get(UWSGI_FARM_VAR, None) - if farm: - uwsgi.farm_msg(farm, SHUTDOWN_MSG) + farms = os.environ.get(UWSGI_FARMS_VAR, None) + if farms: + for farm in farms.split(','): + uwsgi.farm_msg(farm, SHUTDOWN_MSG) else: uwsgi.mule_msg(SHUTDOWN_MSG, uwsgi.mule_id()) exit.set()