-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: create cache rollup cron task #857
Conversation
this commit does 2 things: - creates the cache test rollups task which runs the test rollups aggregation SQL and updates the redis cache with the results in pyarrow ipc format for that specific branch and interval. For the default branch of the repo then that cache entry won't be expired else it will be expired after 3 days. - triggers this task in the test results finisher - adds tests for the above
this commit switches the cache test rollups task to using polars instead of pyarrow. It seems polars uses pyarrow internally anyways but we want to use polars in the api for additional filtering and ordering of the results we calculate and store in the cache task, so for parity with the api we use polars here as well.
we want to have an async task that will get the cached rollup aggregates from GCS and put them in redis for an hour. the reason this is async is because we don't want to spend too much time uploading to redis in the API call
this is a task that runs nightly and queues up cache test rollups tasks based on the content of the last_rollup_date table. basically if a rollup exists that was valid yesterday, we want to recalculate the aggregates for the next day. Eventually the branch's rollups become so out of date that we don't care about recalculating the aggregates anymore
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: tasks/test_results_finisher.py
Did you find this useful? React with a 👍 or 👎 |
This PR includes changes to |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #857 +/- ##
==========================================
- Coverage 98.06% 98.01% -0.05%
==========================================
Files 444 446 +2
Lines 35474 35608 +134
==========================================
+ Hits 34786 34902 +116
- Misses 688 706 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
📢 Thoughts on this report? Let us know! |
❌ 12 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time. ❌ Failed Test Results:Completed 12 tests with View the full list of failed testspytest
|
✅ All tests successful. No failed tests were found. 📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
tasks/cache_test_rollups.py
Outdated
@@ -163,6 +166,16 @@ def run_impl_within_lock(self, repoid, branch): | |||
) | |||
|
|||
serialized_table = df.write_ipc(None) | |||
|
|||
storage_service.write_file("codecov", storage_key, serialized_table) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you already call write_file
down below, so I’m pretty sure this is misplaced. also you hardcode the codecov
bucket which is wrong.
tasks/cache_rollup_cron_task.py
Outdated
self.app.tasks[cache_test_rollups_task_name].create_signature( | ||
args=None, | ||
kwargs=dict(repoid=repo.repoid, branch=branch, update_date=False), | ||
).apply_async() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.app.tasks[cache_test_rollups_task_name].create_signature( | |
args=None, | |
kwargs=dict(repoid=repo.repoid, branch=branch, update_date=False), | |
).apply_async() | |
self.app.tasks[cache_test_rollups_task_name].s(repoid=repo.repoid, branch=branch, update_date=False).apply_async() |
TBH, its really weird how celery names this function just s
, but its the version of the function where you give the arguments just as you would, without explicitly spelling out the kwargs
.
use celery s function instead of create_signature and remove unnecessary write_file call
this is a task that runs nightly and queues up cache test rollups tasks
based on the content of the last_rollup_date table.
basically if a rollup exists that was valid yesterday, we want to
recalculate the aggregates for the next day. Eventually the branch's
rollups become so out of date that we don't care about recalculating
the aggregates anymore
depends on: #821