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:
+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