main: Check workers in list
All checks were successful
Build Docker / Build Bot (push) Successful in 20s
Build Docker / Build Master (push) Successful in 25s

This commit is contained in:
Nathan Woodburn 2023-08-24 12:03:20 +10:00
parent bfb5cae308
commit 021ff27570
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -155,12 +155,13 @@ def list_workers():
# Check if there are any workers (by seeing if there are any :) # Check if there are any workers (by seeing if there are any :)
if len(workers) == 0: if len(workers) == 0:
return jsonify({'error': 'No workers available', 'success': 'false'}) return jsonify({'error': 'No workers available', 'success': 'false'})
if not workers.contains(':'):
return jsonify({'error': 'No workers available', 'success': 'false'})
worker_list = [] worker_list = []
for worker in workers: for worker in workers:
# Check worker status # Check worker status
if not worker.__contains__(':'):
return jsonify({'error': 'No workers available', 'success': 'false'})
online=True online=True
resp=requests.get("http://"+worker.split(':')[1].strip('\n') + ":5000/status",timeout=2) resp=requests.get("http://"+worker.split(':')[1].strip('\n') + ":5000/status",timeout=2)
if (resp.status_code != 200): if (resp.status_code != 200):