From 021ff275703e4686d0d2bb6e1e5c4b677bcb5284 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Thu, 24 Aug 2023 12:03:20 +1000 Subject: [PATCH] main: Check workers in list --- master/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/master/main.py b/master/main.py index 197283e..975a0c8 100644 --- a/master/main.py +++ b/master/main.py @@ -155,12 +155,13 @@ def list_workers(): # Check if there are any workers (by seeing if there are any :) if len(workers) == 0: return jsonify({'error': 'No workers available', 'success': 'false'}) - if not workers.contains(':'): - return jsonify({'error': 'No workers available', 'success': 'false'}) worker_list = [] for worker in workers: # Check worker status + if not worker.__contains__(':'): + return jsonify({'error': 'No workers available', 'success': 'false'}) + online=True resp=requests.get("http://"+worker.split(':')[1].strip('\n') + ":5000/status",timeout=2) if (resp.status_code != 200):