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

Set _env_status earlier when updating settings #499

Merged
merged 2 commits into from
Apr 2, 2024
Merged
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
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to this project will be documented here.
## [v2.4.1]
- Fix bug that prevented copies of instructor directories from being deleted (#483)
- Add STACK_ROOT to containers as well as notes in readme (#484)
- Ensure _env_status is updated to "setup" earlier when a request to update test settings is made (#499)

## [v2.4.0]
- Fix bug that prevented test results from being returned when a feedback file could not be found (#458)
Expand Down
10 changes: 9 additions & 1 deletion client/autotest_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from werkzeug.exceptions import HTTPException
import os
import sys
import time
import rq
import json
import io
Expand Down Expand Up @@ -108,6 +109,11 @@ def _update_settings(settings_id, user):
if error:
abort(make_response(jsonify(message=error), 422))

test_settings["_user"] = user
test_settings["_last_access"] = int(time.time())
test_settings["_env_status"] = "setup"
REDIS_CONNECTION.hset("autotest:settings", key=settings_id, value=json.dumps(test_settings))

queue = rq.Queue("settings", connection=REDIS_CONNECTION)
data = {"user": user, "settings_id": settings_id, "test_settings": test_settings, "file_url": file_url}
queue.enqueue_call(
Expand Down Expand Up @@ -198,7 +204,9 @@ def settings(settings_id, **_kw):
@authorize
def create_settings(user):
settings_id = REDIS_CONNECTION.incr("autotest:settings_id")
REDIS_CONNECTION.hset("autotest:settings", key=settings_id, value=json.dumps({"_user": user}))
REDIS_CONNECTION.hset(
"autotest:settings", key=settings_id, value=json.dumps({"_user": user, "_env_status": "setup"})
)
_update_settings(settings_id, user)
return {"settings_id": settings_id}

Expand Down
5 changes: 0 additions & 5 deletions server/autotest_server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,6 @@ def ignore_missing_dir_error(


def update_test_settings(user, settings_id, test_settings, file_url):
test_settings["_user"] = user
test_settings["_last_access"] = int(time.time())
test_settings["_env_status"] = "setup"
redis_connection().hset("autotest:settings", key=settings_id, value=json.dumps(test_settings))

try:
settings_dir = os.path.join(TEST_SCRIPT_DIR, str(settings_id))

Expand Down
Loading