main: Check workers in list
This commit is contained in:
parent
bfb5cae308
commit
021ff27570
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user