apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
36.42k stars 14.11k forks source link

Show schedule_interval/timetable description for schedule cron expression in Airflow UI #16692

Closed pateash closed 2 years ago

pateash commented 3 years ago

Description

Users should be able to see a short description of the cron expression when hovering over the expression in a tooltip.

image

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

uranusjr commented 3 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.

ashb commented 3 years ago

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

uranusjr commented 3 years ago

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.

pateash commented 3 years ago

I have used cronstrue previously in my projects. I will prefer to use that or may be something else.

uranusjr commented 3 years ago

Let’s try it out then! We can carry on with the details in the PR thread.

uranusjr commented 3 years ago

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.

lucas-garcia-rubio commented 3 years ago

Cronstrue in Python: https://github.com/Salamek/cron-descriptor