Closed pateash closed 2 years ago
Sounds like a nice feature to me. How do you plan to geenrate the description? I know there are some online services but am not aware of a Python or JavaScript package for this. And it seems a bit weird to implement it directly in Airflow’s code base.
https://github.com/azza-bazoo/prettycron might do the job? We should check it supports at least everything croniter does.
Oh, LGPLv3 -- we can't use that.
Other option https://www.npmjs.com/package/cronstrue
croniter actually “supports” some weird (invalid?) cron formats, for example 10 * * * * *
(six sgements!) can be parsed by it. I saw a report on it just yesteday but can’t find the thread now. So we either need to do some additional validation (to reject those currently-allowed formats) or be bug-to-bug compatible with croniter.
I have used cronstrue previously in my projects. I will prefer to use that or may be something else.
Let’s try it out then! We can carry on with the details in the PR thread.
Found the discussion on croniter formats: https://github.com/apache/airflow/issues/16107#issuecomment-869559200. It was not a separate issue but only mentioned in-passing, no wonder I couldn’t locate it before…
Although the six-segment format is valid (TIL), croniter’s current behaviour is not standard, so I think we should do some additional validation to exclude that explicitly.
Cronstrue in Python: https://github.com/Salamek/cron-descriptor
Description
Users should be able to see a short description of the cron expression when hovering over the expression in a tooltip.
In the above case, the user should see description like At 09:30 PM, only on Friday
Use case / motivation It will be really easy to get schedule information for the users who are not really great at reading CRON, even for the experience users CRON can be really complicated at times.
We will create a tooltip component which will evaluate underlying cron and show the description.
Are you willing to submit a PR? YES
Related Issues NONE