mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Add multi-farm support to the main script
This commit is contained in:
@@ -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):
|
||||
|
||||
+5
-4
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user