From: Lucian Ursu Date: Fri, 22 Feb 2013 15:30:07 +0000 (+0200) Subject: Using a single, more general function to manage supervisor-managed processes. X-Git-Tag: release-20150131~498^2~2^2~10 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2e20cdeca163e9677c02126ec85870a27f953108;p=oweals%2Fkarmaworld.git Using a single, more general function to manage supervisor-managed processes. --- diff --git a/fabfile.py b/fabfile.py index a0c37ab..e6b6ce0 100755 --- a/fabfile.py +++ b/fabfile.py @@ -149,9 +149,14 @@ def update_code(): env.run('git pull && git checkout %s' % env.branch) -def manage_celeryd(action): +def manage_supervisor_proc(proc, action): + """ + Takes as arguments the name of the process as is + defined in supervisord.conf and the action that should + be performed on it: start|stop|restart. + """ supervisor_conf = os.path.join(env.confs, 'supervisord.conf') - env.run('supervisorctl -c %s celeryd %s' % (supervisor_conf, action)) + env.run('supervisorctl -c %s %s %s' % (supervisor_conf, proc, action)) @task @@ -159,7 +164,7 @@ def start_celeryd(): """ Starts the celeryd process """ - manage_celeryd('start') + manage_supervisor_proc('celeryd', 'start') @task @@ -167,7 +172,7 @@ def stop_celeryd(): """ Stops the celeryd process """ - manage_celeryd('stop') + manage_supervisor_proc('celeryd', 'stop') @task @@ -175,7 +180,7 @@ def restart_celery(): """ Restarts the celeryd process """ - manage_celeryd('restart') + manage_supervisor_proc('celeryd', 'restart') @task