Skip to content

Commit

Permalink
Fix bug and sort queries descendingly
Browse files Browse the repository at this point in the history
  • Loading branch information
dostuffthatmatters committed Dec 27, 2023
1 parent edb9d4f commit a872eba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/profiles/generate_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,4 @@ def generate_download_queries(
) for tp in compute_time_periods(dates)
])

return sorted(download_queries, key=lambda q: q.from_date)
return sorted(download_queries, key=lambda q: q.from_date, reverse=True)
6 changes: 4 additions & 2 deletions src/profiles/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def run() -> None:
cache = profiles.cache.DownloadQueryCache.load()
running_queries = cache.get_active_queries(version)
print(f"Found {len(running_queries)} already requested queries")
still_running_query_count = len(running_queries)
if len(running_queries) > 0:
print(f"Trying to download {len(running_queries)} queries")
fulfilled_queries = profiles.download_logic.download_data(
Expand All @@ -38,9 +39,9 @@ def run() -> None:
cache.remove_queries(version, fulfilled_queries)
cache.dump()
print("Updated cache")
still_running_query_count = len(running_queries
) - len(fulfilled_queries)

still_running_query_count = len(running_queries
) - len(fulfilled_queries)
open_query_count = config.profiles.server.max_parallel_requests - still_running_query_count

print(f"{still_running_query_count} queries are still running")
Expand Down Expand Up @@ -71,6 +72,7 @@ def run() -> None:
missing_queries = sorted(
set(missing_queries).difference(set(fulfilled_queries)),
key=lambda q: q.from_date,
reverse=True,
)
print(
f"Successfully downloaded {len(fulfilled_queries)} queries"
Expand Down

0 comments on commit a872eba

Please sign in to comment.