Comments (8)
Umm since when is full day name allowed in CRON expression? Allowed formats are 3 char name (MON) or int 0-6 i have never seen anyone use full name of a day...
from cron-descriptor.
Python-crontab is also using 3 char day names in it's docs...
https://pypi.org/project/python-crontab/
Looks like issue is in celery.schedules.crontab
for some weir reason it accepts monday
as valid day_of_week and then when it generates cron expression it generates invalid cron 0 2 monday * *
correct format is 0 2 * * MON
from cron-descriptor.
Celery supports that (see referenced code). It might not be standard, though...
from cron-descriptor.
@nijel how i now wrote in previous comment, it is issue of celery.schedules.crontab
and when it builds crontab string it passes incorrect value there...
from cron-descriptor.
celery.schedules,crontab
should implement something like to_valid_cron()
:
c = crontab(hour=2, minute=0, day_of_week="monday")
# celery.schedules,crontab converts named days & months to their integer representation, use that instead!
minute, = c.minute
hour, = c.hour
day_of_week, = c.day_of_week
correct_cron = '{} {} {} {} {}'.format(
minute,
hour,
c._orig_day_of_month,
c._orig_month_of_year,
day_of_week
)
print(correct_cron)
Outputs 0 2 * * 1
that is valid cron
(this is put together to only work with your example parameters, do not use in production)
from cron-descriptor.
Yes, it might do a better job. But the way cron-descriptor crashed is not really helpful. I would not mind if it reported invalid input, but instead there is none exception message and the intermediate one contains something about 1DAY what has really nothing to do with the original string.
from cron-descriptor.
Hehe, this is not cron expression validator for sure... :-) Also that 1DAY
is result of 'monday '.upper().replace('MON', '1') on line
But i'll consider adding some kind of validation / better parsing exceptions...
from cron-descriptor.
(Should be) Fixed in downstream...
from cron-descriptor.
Related Issues (20)
- 6 part expression parsing incompatible with parse-crontab HOT 1
- Out-of-range and incorrect values allowed HOT 1
- GitHub vs PyPI HOT 1
- the description of expression "* * * L-10 * ? *" is wrong
- Sunday is not normalized
- Add Go Port to Readme
- Invalid expression are nor throwing FormatException error HOT 1
- Korean Translation missing mo file. HOT 1
- issue with bad cron entries HOT 1
- Update pip version HOT 1
- Schedule "*/10 */1 * * *" translated the same as schedule "*/10 * * * *" HOT 2
- Specific time every day, not showing "Every day" HOT 1
- Missing translation string for spanish language HOT 3
- Calling some functions of ExpressionDescriptor first requires calling get_description. HOT 3
- Deprecation warning with Pip 22.3.1
- Error parsing day-of-month combined with day-of-week HOT 1
- Running setup.py is deprecated in favor of pyproject.toml
- There are errors in the Chinese translation HOT 3
- Description for "0 0-13 * * *" could be improved
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cron-descriptor.