-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Enforce quota and hard cap for monthly execution minutes #1284
Conversation
a2a94de
to
d5cca67
Compare
764a867
to
9949676
Compare
@Shrinks99 Assigned you for a copy and docs check :) |
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.
Have left a few suggestions for fixes, copy mostly good!
Once the above is dealt with, looks good to me! :D
Excited to flesh out the billing page in the future!
@Shrinks99 ready for re-review :) |
Change tab title from "Billing" to "Org Limits" for now until we sort out / add more billing features to the app. |
Handled similarly to storage quotas in backend and frontend, except execution minutes quotas are tracked and enforced monthly. Almost surely is buggy at this stage, and there is no soft/hard cap distinction yet.
Thanks for this! The keeping track of current running exec time is neat but has two potential issues:
I've attempted to refactor this a bit to instead force increments in short intervals to avoid tracking uncommitted exec time altogether. |
This adds an slight refactor to #1284 to ensure execution minutes are updated incrementally while a crawl is running. The execution minutes are updated on the org and on the crawl if: - 60 seconds elapsed from last update - any pod has newly exited - crawl has been canceled (compute to current time) - if month has changed This should ensure that the execution time quota is accurate within 1 minute, and also that crawls running at the end of the month properly count towards old and new month quotas (a bit of an edge case yes, but bound to happen!) other cleanup: - add background tasks to a set to avoid premature garbage collection (see: https://stackoverflow.com/a/74059981) - use dt_now() consistently instead of datetime.utcnow() to store second-rounded dates
With #1314 merged in, I think we might be finally go to go on this one! |
489d8b2
to
d268922
Compare
- Remove user-set overage - Just have a 'single execution minutes' quota, rename hard cap to be the quota (for now) - have backend compute storage and exec minutes quotas, report to frontend (will eventually involve additional variables)
081ee64
to
cee0c85
Compare
Co-authored-by: Tessa Walsh <[email protected]>
@ikreymer @Shrinks99 Pulled in the org dashboard execution time meter into this PR, should all be ready for a last review together now |
- Cap display of execution time usage at 100% - Remove extraneous tooltip
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.
Tested: Meter updating, crawl stopping gracefully after limit reached, frontend behaves properly after limit reached (crawl workflow switch included!)
LGTM! 🚀
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.
At long last, I think this is good to go!
Fixes #1261 Closes #1092
The quota for monthly execution minutes is treated as a hard cap. Once it is exceeded, an alert indicating that an org has exceeded its monthly execution minutes will display and the user will be unable to start new crawls. Any running crawls will be stopped once the quota is exceeded.
An execution minutes meter bar is also added in the Org Dashboard and displayed if a quota is set. More detail in #1305, which was merged into this branch.
Changes
execution_minutes_quota_reached
detail in backend from crawl config/run
endpoint, and don't run new workflows on creation (similar to storage quota)To test
Manually
Org Monthly Execution Minutes Quota
to a low number of minuteshttps://webrecorder.net
with extra hops enabled and no page limit)Nightly tests
To run the nightly tests locally (requires pytest):
pytest backend/test_nightly/test_execution_minutes_quota.py
These tests may take 5 or so minutes to complete.