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

Only validate unfinished cache runs #2046

Merged
merged 1 commit into from
Jun 1, 2024
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
14 changes: 11 additions & 3 deletions server/fishtest/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,21 @@ def schedule_tasks(self):
self.scheduler.add_task(180.0, self.validate_random_run)

def validate_random_run(self):
run_list = list(self.run_cache.values())
# Excess of caution. Another thread may change run_cache
# while we are iterating over it.
with self.run_cache_lock:
run_list = [
cache_entry["run"]
for cache_entry in self.run_cache.values()
if not cache_entry["run"]["finished"]
]
if len(run_list) == 0:
print(
"Validate_random_run: cache empty. No runs to validate...", flush=True
"Validate_random_run: no unfinished cache runs. No runs to validate...",
flush=True,
)
return
run = random.choice(list(run_list))["run"]
run = random.choice(run_list)
run_id = str(run["_id"])
try:
# Make sure that the run object does not change while we are
Expand Down
Loading