Skip to content

Commit 2c67f26

Browse files
vdberghppigazzini
authored andcommitted
Stop task when heartbeat receives an error from server
Very likely the same error will prevent an update later, resulting in wasted compute. The main use case is an external IP address change (e.g. when moving a computer to a different location). Raise worker version to 302 (also server side)
1 parent 48c22a5 commit 2c67f26

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

server/fishtest/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
according to the route/URL mapping defined in `__init__.py`.
3737
"""
3838

39-
WORKER_VERSION = 301
39+
WORKER_VERSION = 302
4040

4141

4242
@exception_view_config(HTTPException)

worker/games.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,8 +1083,8 @@ def shorten_hash(match):
10831083
num_games_updated = 0
10841084
while datetime.now(timezone.utc) < end_time:
10851085
if current_state["task_id"] is None:
1086-
# This task is no longer necessary
1087-
print(finished_task_message)
1086+
# This task is no longer necessary.
1087+
# Error message has already been printed.
10881088
return False
10891089
try:
10901090
line = q.get_nowait().strip()

worker/sri.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"__version": 301, "updater.py": "eDDBPKA/vrTCadgtEJFdL06vSoiysF0JhiHKdEnjQv3zS4kfdOAqnco/DJpDWbvh", "worker.py": "qLWKRuwvwE1M+5MaixgwtAetH02cPCa9rYUkAbjErBCYxBL1hV/8bi6cl2VZtH9r", "games.py": "FvHVZE9/5kDMJ6auavCbMV1CtZ+bJHEg44yjH62/PH6wrUXisp7qGaH57BILpmXf"}
1+
{"__version": 302, "updater.py": "eDDBPKA/vrTCadgtEJFdL06vSoiysF0JhiHKdEnjQv3zS4kfdOAqnco/DJpDWbvh", "worker.py": "IefIjuMpGHFUli5kjkBcnGIZfXyjJY80SryBrlXdM9vFvQmaaRDBfRHj0TcC+q3u", "games.py": "JdAmyr48crzHgGTFGxaE9hg3K1sWfkd2azImdoPD+Pn3pqsApWt2CykBOKaWwIBM"}

worker/worker.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
FASTCHESS_SHA = "47e686f604e6b6f1f872d6e8b2831b4a47d70dae"
7676

77-
WORKER_VERSION = 301
77+
WORKER_VERSION = 302
7878
FILE_LIST = ["updater.py", "worker.py", "games.py"]
7979
HTTP_TIMEOUT = 30.0
8080
INITIAL_RETRY_TIME = 15.0
@@ -1196,8 +1196,15 @@ def heartbeat(worker_info, password, remote, current_state):
11961196
print("(received)")
11971197
task_alive = req.get("task_alive", True)
11981198
if not task_alive:
1199+
print(
1200+
"The server told us that no more games are needed for the current task."
1201+
)
11991202
current_state["task_id"] = None
12001203
current_state["run"] = None
1204+
else:
1205+
# Error message has already been printed.
1206+
current_state["task_id"] = None
1207+
current_state["run"] = None
12011208
else:
12021209
print("Heartbeat stopped.")
12031210

0 commit comments

Comments
 (0)