-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Adds MAX_RRULE_LENGTH
#7762
Adds MAX_RRULE_LENGTH
#7762
Conversation
✅ Deploy Preview for prefect-orion ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
I believe this PR will break our primary mechanism for scheduling flow runs. Let's say we need to run a flow according to the french bond trading calendar, or malaysian bank calendar. We know what dates the market is open, but it's infeasible for us to represent those dates as RRULES. With this change it will be impossible for us to provide a custom list of dates to Prefect for scheduling for more than a year. If there are no other alternatives for custom date scheduling, I would propose a max length closer to 5 years so that we don't need to refresh the schedule on all of our flows every 12 months. |
Thank you for bumping, we discussed internally and have some ideas about how to shorten the length as well. We believe we can invert the RRULE to be exclusions rather than inclusions and add some special cases for weekends. They will still be quite long, but probably not the full ~6k characters per year. |
@bphillips-exos that's great to hear! If the type of schedule you've described is able to accomplished via exclusions, I'm honestly inclined to lower it a bit more to something like 12500 |
@jakekaplan give us a few days to look into this and get back to you on roughly how many characters per year we need to build the RRULE string for the more complex calendars. Thanks |
Hi @jakekaplan, we were able to switch to EXDATEs for this. Our RRULEs now cap out at ~500 characters per year. At the moment we generate RRULEs for 30 years out so ~15,000 total characters, but we could easily shorten this if you'd prefer to introduce a limit in the 5,000 - 10,000 character range. Thanks for giving us a chance to review |
@bphillips-exos that's great news! Thanks for looking into it. I'm going to opt to move this back to the original limit of |
@jakekaplan can we get this across the line for today's release? |
@madkinsz updated, sorry that I missed your original comment last week! |
@@ -398,7 +398,7 @@ def validate_rrule_str(cls, v): | |||
raise ValueError(f'Invalid RRule string "{v}": {exc}') | |||
if len(v) > MAX_RRULE_LENGTH: | |||
raise ValueError( | |||
f'Invalid RRule string "{v}"\n' | |||
f'Invalid RRule string "{v[:40] + "..." if len(v) > 40 else v}"\n' |
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.
Don't we know the length is > 40 since we're in this clause?
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.
I think I was thinking that MAX_RRULE_LENGTH
could technically be anything? You're correct though, just simplified it
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.
True but practically speaking 🤷♂️ not sure what's best practice in this case.
…r-builds-release * 'main' of https://github.com/ddelange/prefect: (131 commits) Fix docker-builds.yaml templating syntax (PrefectHQ#8114) Rename Worker pools -> work pools (PrefectHQ#8107) Build multi-arch images for commits on main (PrefectHQ#7900) [Issue PrefectHQ#456] Change example of `infra_override` in docs/concepts/deployment (PrefectHQ#8101) Bump @playwright/test from 1.29.1 to 1.29.2 in /orion-ui (PrefectHQ#8105) Bump @prefecthq/orion-design from 1.1.53 to 1.1.54 in /orion-ui (PrefectHQ#8104) Update deployment docs to include tag and idempotency key (PrefectHQ#7771) Add `BaseWorker` and `ProcessWorker` (PrefectHQ#7996) Add Peyton and Serina as global code owners (PrefectHQ#8098) Add release notes for 2.7.7 (PrefectHQ#8091) Add youtube badge (PrefectHQ#8089) Adds `MAX_RRULE_LENGTH` (PrefectHQ#7762) Limit task run cache key size (PrefectHQ#7275) Add --match flag to work queues documentation (PrefectHQ#7768) Modify disable ssl setting tests to allow any for headers and timeout (PrefectHQ#8086) Add test for allow_failure and quote (PrefectHQ#8055) Adds `experimental_field` decorator (PrefectHQ#8066) add docs on migrating block documents (PrefectHQ#8085) Add Redoc documentation for REST API reference (PrefectHQ#7503) Allow disabling SSL verification (PrefectHQ#7850) ...
…refect into docker-builds-consolidation * 'docker-builds-release' of https://github.com/ddelange/prefect: (131 commits) Fix docker-builds.yaml templating syntax (PrefectHQ#8114) Rename Worker pools -> work pools (PrefectHQ#8107) Build multi-arch images for commits on main (PrefectHQ#7900) [Issue PrefectHQ#456] Change example of `infra_override` in docs/concepts/deployment (PrefectHQ#8101) Bump @playwright/test from 1.29.1 to 1.29.2 in /orion-ui (PrefectHQ#8105) Bump @prefecthq/orion-design from 1.1.53 to 1.1.54 in /orion-ui (PrefectHQ#8104) Update deployment docs to include tag and idempotency key (PrefectHQ#7771) Add `BaseWorker` and `ProcessWorker` (PrefectHQ#7996) Add Peyton and Serina as global code owners (PrefectHQ#8098) Add release notes for 2.7.7 (PrefectHQ#8091) Add youtube badge (PrefectHQ#8089) Adds `MAX_RRULE_LENGTH` (PrefectHQ#7762) Limit task run cache key size (PrefectHQ#7275) Add --match flag to work queues documentation (PrefectHQ#7768) Modify disable ssl setting tests to allow any for headers and timeout (PrefectHQ#8086) Add test for allow_failure and quote (PrefectHQ#8055) Adds `experimental_field` decorator (PrefectHQ#8066) add docs on migrating block documents (PrefectHQ#8085) Add Redoc documentation for REST API reference (PrefectHQ#7503) Allow disabling SSL verification (PrefectHQ#7850) ...
Adds
MAX_RRULE_LENGTH
Currently it is possible to submit an arbitrary length json as an rrule for a
Deployment.schedule
using rdates. This can lead to timeouts as the giant json needs to be serialized multiple times going from the database to the client. While the schedules are technically valid this can be abused past what the server can reasonably support. This provides a "reasonable maximum length" (6210 is approximately a year of rdates + some buffer = 6500) for rrules as a guardrail.closes: https://github.com/PrefectHQ/nebula/issues/2738
Example
Checklist
<link to issue>
"fix
,feature
,enhancement