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

Eliminate some more unsynchronized changes to the run object. #2186

Merged
merged 1 commit into from
Jan 25, 2025
Merged
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
29 changes: 16 additions & 13 deletions server/fishtest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,7 @@ def tests_modify(request):
request.session.flash("Unable to modify another user's run!", "error")
return home(request)

run_id = run["_id"]
is_approver = request.has_permission("approve_run")
if (
not is_approver
Expand All @@ -1262,20 +1263,22 @@ def tests_modify(request):
)
):
request.actiondb.approve_run(username=userid, run=run, message="unapproved")
run["approved"] = False
run["approver"] = ""
with request.rundb.active_run_lock(run_id):
run["approved"] = False
run["approver"] = ""

before = del_tasks(run)
run["args"]["num_games"] = int(request.POST["num-games"])
run["args"]["priority"] = int(request.POST["priority"])
run["args"]["throughput"] = int(request.POST["throughput"])
run["args"]["auto_purge"] = True if request.POST.get("auto_purge") else False
if (
is_same_user(request, run)
and "info" in request.POST
and request.POST["info"].strip() != ""
):
run["args"]["info"] = request.POST["info"].strip()
with request.rundb.active_run_lock(run_id):
run["args"]["num_games"] = int(request.POST["num-games"])
run["args"]["priority"] = int(request.POST["priority"])
run["args"]["throughput"] = int(request.POST["throughput"])
run["args"]["auto_purge"] = True if request.POST.get("auto_purge") else False
if (
is_same_user(request, run)
and "info" in request.POST
and request.POST["info"].strip() != ""
):
run["args"]["info"] = request.POST["info"].strip()
request.rundb.set_active_run(run)

after = del_tasks(run)
Expand Down Expand Up @@ -1304,7 +1307,7 @@ def tests_modify(request):
if run["approved"]:
cached_flash(request, "Run successfully modified!")
else:
cached_flash(request, "Run successfully modified!, please wait for approval.")
cached_flash(request, "Run successfully modified! Please wait for approval.")
return home(request)


Expand Down
Loading