From f97720ac67489dcb49943626c6fcb820a1e967f3 Mon Sep 17 00:00:00 2001 From: Jan Koppe Date: Mon, 27 Apr 2020 10:10:05 +0200 Subject: [PATCH] =?UTF-8?q?fix=20linter=20errors=20=F0=9F=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kill.py | 14 +++++++------- main.py | 7 ++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/kill.py b/kill.py index 5369901..adaafcb 100755 --- a/kill.py +++ b/kill.py @@ -22,15 +22,15 @@ def main(): body = dict([pair.split(":") for pair in body.split(" ")]) if body["groupname"] == "concierge": - try: - pidfile = open('/run/supervisor.pid','r') - pid = int(pidfile.readline()); - os.kill(pid, signal.SIGQUIT) - except Exception as e: - write_stdout('could not kill supervisor: %s\n' % e.strerror) + try: + pidfile = open('/run/supervisor.pid', 'r') + pid = int(pidfile.readline()) + os.kill(pid, signal.SIGQUIT) + except Exception as e: + write_stdout('could not kill supervisor: %s\n' % e.strerror) write_stdout('RESULT 2\nOK') if __name__ == '__main__': - main() + main() diff --git a/main.py b/main.py index 340b8e0..cd8f9e7 100644 --- a/main.py +++ b/main.py @@ -28,11 +28,12 @@ interval = 2 # runtime stuff claims = [] + def svd_update(): try: r = svd.supervisor.reloadConfig() except xmlrpc.client.Fault as e: - if e.faultCode == 6: # SHUTDOWN_STATE + if e.faultCode == 6: # SHUTDOWN_STATE print('svd shutting down') return else: @@ -88,7 +89,7 @@ def stop_task(uuid): file = '/app/tasks.d/%s.conf' % uuid try: os.remove(file) - except: + except: # noqa print('error deleting task configfile', file) # reload supervisord config @@ -104,6 +105,7 @@ def release_task(uuid): stop_task(uuid) + def claim_task(uuid): global claims r = requests.post('%s/claim/%s' % (base_url, uuid)).json() @@ -151,7 +153,6 @@ def loop(config): claim_task(task.get('uuid')) break - time.sleep(interval)