Added local minimum

This commit is contained in:
Pünkösd Marcell 2020-09-24 16:21:28 +02:00
parent bd62836d9b
commit aa078febc5

View File

@ -55,9 +55,21 @@ def main():
p.start() p.start()
processes.append(p) processes.append(p)
local_best = 1000
while True: while True:
result = outqueue.get() result = outqueue.get()
requests.post(target_url, json=result) result_score = len(result)
if result_score < local_best:
print(f"New local best found: {local_best} -> {result_score}")
local_best = result_score
try:
r = requests.post(target_url, json=result)
r.raise_for_status()
except (ConnectionError, requests.HTTPError) as e:
print(f"Error while posting result: {e}")
if __name__ == '__main__': if __name__ == '__main__':