David Cupp
10/11/2022, 9:44 PMRRuleSchedule
only takes a "rrule string". It seems easy to convert a single rrule to a string, but as far as I can tell there is no standard implementation to convert an rrule set into an rrule string [3]. Any ideas?
[1] https://docs.prefect.io/api-ref/orion/schemas/schedules/#prefect.orion.schemas.schedules.RRuleSchedule
[2] https://github.com/PrefectHQ/prefect/blob/main/src/prefect/orion/schemas/schedules.py#L322
[3] https://github.com/dateutil/dateutil/issues/856Mason Menges
10/11/2022, 9:50 PMDavid Cupp
10/11/2022, 9:52 PMrrulestr()
converts from an "rrule string" to an rruleset
(as necessary). I need the reverse of that operation. As far as I can tell, there is nothing here that can convert from the rruleset python object to an rrule string.Hedgar
10/11/2022, 10:48 PMDavid Cupp
10/11/2022, 10:51 PMdateutil
library: https://dateutil.readthedocs.io/en/stable/rrule.html#rruleset-examples
I'm confident I know what do to once I have an rrule string, but getting to the string from the rrule set (without writing code that is too hacky) is the challenge.Anna Geller
10/11/2022, 11:26 PMDavid Cupp
10/11/2022, 11:39 PMProprietaryConfig
objects.
So this is not a case where I personally have a schedule in mind, and need help manually writing an rrule string for it. This is about writing a robust, stable conversion.
We already have code that maps from List[ProprietaryConfig]
--> dateutil.rruleset
(our existing scheduler uses the rruleset object directly)
so Prefect's RRuleSchedule
seems like the best fit. But RRuleSchedule
takes a "rrule string", so as far as I know my options are (from best to worst):
1. find some code that can convert dateutil.rruleset
--> "rrule string"
2. find some code that can convert List[dateutil.rrule]
--> "rrule string"
3. implement List[PrioprietaryConfig]
--> "rrule string"
4. find out that we can use multiple RRuleSchedule
objects or something else that I'm missing.
Any of these solutions is possible, but of course I would prefer to avoid doing anything that involves relying on private fields of a python class, or creating our own rrule implmentation.Anna Geller
10/12/2022, 12:10 AMDavid Cupp
10/12/2022, 12:12 AMAnna Geller
10/12/2022, 12:12 AMDavid Cupp
10/12/2022, 12:15 AMcould you give me examples of schedules that you cannot generate using the current RRuleSchedule objectI'm not trying to claim that Prefect is in any way inadequate, and I think that by supporting an rrule string it technically can handle any type of schedule that we have. My problem is simply an impedance mismatch with the data types (one that I blame python's
dateutil
library for). I'm feeling around for answers because, just like you don't want to roll your own crypto, I don't want to roll my own calendar logic/RFC implementations (unless I have to).Anna Geller
10/12/2022, 12:16 AMDavid Cupp
10/12/2022, 12:19 AMdateutil
since each one could break our implementation.dateutil.rruleset
but I am sort of locked into a list of rule objectsAnna Geller
10/12/2022, 12:23 AMDavid Cupp
10/12/2022, 12:26 AM