Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix worker updates #2131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/fishtest/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
according to the route/URL mapping defined in `__init__.py`.
"""

WORKER_VERSION = 241
WORKER_VERSION = 242


@exception_view_config(HTTPException)
Expand Down
2 changes: 1 addition & 1 deletion worker/sri.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"__version": 241, "updater.py": "Mg+pWOgGA0gSo2TuXuuLCWLzwGwH91rsW1W3ixg3jYauHQpRMtNdGnCfuD1GqOhV", "worker.py": "BMuQUpxZAKF0aP6ByTZY1r06MfPoIbdG2xraTrDQQRKgvhzJo6CKmeX2P8vX/QDm", "games.py": "9dFaa914vpqT7q4LLx2LlDdYwK6QFVX3h7+XRt18ATX0lt737rvFeBIiqakkttNC"}
{"__version": 242, "updater.py": "Mg+pWOgGA0gSo2TuXuuLCWLzwGwH91rsW1W3ixg3jYauHQpRMtNdGnCfuD1GqOhV", "worker.py": "26jTXaNVh+1WI3Y7UrVGvmG55/IoiEoy4DzSYHTQApPFmpttGqH0FZXRk3AKI59S", "games.py": "9dFaa914vpqT7q4LLx2LlDdYwK6QFVX3h7+XRt18ATX0lt737rvFeBIiqakkttNC"}
16 changes: 12 additions & 4 deletions worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
MIN_CLANG_MAJOR = 8
MIN_CLANG_MINOR = 0

WORKER_VERSION = 241
WORKER_VERSION = 242
FILE_LIST = ["updater.py", "worker.py", "games.py"]
HTTP_TIMEOUT = 30.0
INITIAL_RETRY_TIME = 15.0
Expand Down Expand Up @@ -1238,7 +1238,7 @@ def utcoffset():
return "{}{:02d}:{:02d}".format("+" if utcoffset >= 0 else "-", hh, mm)


def verify_worker_version(remote, username, password):
def verify_worker_version(remote, username, password, worker_lock):
# Returns:
# True: we are the right version and have the correct credentials
# False: incorrect credentials (the user may have been blocked in the meantime)
Expand All @@ -1257,6 +1257,7 @@ def verify_worker_version(remote, username, password):
print("Updating worker version to {}".format(req["version"]))
backup_log()
try:
worker_lock.release()
update()
except Exception as e:
print(
Expand All @@ -1277,6 +1278,7 @@ def fetch_and_handle_task(
current_state,
clear_binaries,
global_cache,
worker_lock,
):
# This function should normally not raise exceptions.
# Unusual conditions are handled by returning False.
Expand All @@ -1291,7 +1293,7 @@ def fetch_and_handle_task(
)

# Check the worker version and upgrade if necessary
ret = verify_worker_version(remote, worker_info["username"], password)
ret = verify_worker_version(remote, worker_info["username"], password, worker_lock)
if ret is False:
current_state["alive"] = False
if not ret:
Expand Down Expand Up @@ -1506,7 +1508,12 @@ def worker():

# Check the worker version and upgrade if necessary
try:
if verify_worker_version(remote, options.username, options.password) is False:
if (
verify_worker_version(
remote, options.username, options.password, worker_lock
)
is False
):
return 1
except Exception as e:
print("Exception verifying worker version:\n", e, sep="", file=sys.stderr)
Expand Down Expand Up @@ -1592,6 +1599,7 @@ def worker():
current_state,
clear_binaries,
options.global_cache,
worker_lock,
)
if not current_state["alive"]: # the user may have pressed Ctrl-C...
break
Expand Down
Loading