Comments (9)
i have fixed it in
https://github.com/aohan237/async_cron/tree/test_issue
this branch.
you can test it again, if everything goes smoothly, i will merge to master
from async_cron.
Here is my quick test result.
Passed Cases:
'45,13,*,*,*,*' - Every day at 13:45 -> Worked
'*/2,*,*,*,*,*' - Every 2 minutes -> Worked
'*,*/2,*,*,*,*' - Every 2 hours -> No exception raised, hope it works
'45,13,1,*,*,*' - Every 1st day of month at 13:45 -> No exception raised, hope it works
'45,13,*,*,*,2020' - Only for the year 2020 every day at 13:45 -> No exception raised, hope it works
Failed Cases:
'45,13,*,0,*,*' - Every sunday at 13:45 -> Failed with exception TypeError: 'NoneType' object is not callable
'45,13,*,*,12,*' - Every December all days at 13:45 -> Failed with exception AttributeError: 'NoneType' object has no attribute 'name'
from async_cron.
Note: This comment is not directly related to this PR.
Do you have plans to support cron time format directly by CronJob class. It would be great if there is an direct option like that. I can raise a request if you can implement the feature.
Another issue, log_path
though it is optional. I cannot leave it blank as str method strip is called as part of constructor. Can you please remove this dependency if possible?
Class: JobLoader(log_path='.')
from async_cron.
1、i will test the failed cases.
2、this feature sounds good, but if you need to write the cron job with python code, why dont you use the python code way ,such as this
CronJob(name='weekday').weekday(2).at("11:18").go(tt, (5), age=99)
the linux cron format seems to be useful ,only when you have a cron file.
3、about the log_path, yes.
from async_cron.
Reply to previous comment
You are right, the declarative approach is really good if our requirement is simple.
For eg: In my case
def schedule_jobs(cron_format, callback):
# Create a job as per cron_format
# Trigger the job with given callback
# minute, hour, day, week, month, year
schedule_jobs('*,04,*,1,*,*') - Every Monday morning 4 AM
schedule_jobs('*,17,1,*,*,*') - Every month 1st at 5 PM
schedule_jobs('*,09,*,*,*,*') - Every day at 9 AM
schedule_jobs('*,*/1,*,*,*,*') - Every hour
With the cron format, I can just have one single function handling all the types supported by cron.
Since the package already supports cron time format & is timezone aware.
Giving an extension this way will make it super easy for users and will be standar way I feel.
Right now, I am passing the cron format to job_loader
and getting a job prepared by the parse_cron
. Then customizing the instance variable timezone
.
Later I want to change the default tolerance
or run_total
. I will have to do the modification post job creation.
If the code changes are not major, I am making a request to you to support. Otherwise I would go with approach I found now.
Another question:
I see a difference in the cron format supported by the package. Can you please let me know why this diff?
Cron format supported by async-cron: minute, hour, day, week, month, year
Cron format mentioned in wiki : minute, hour, day, month, week
https://en.wikipedia.org/wiki/Cron
Thanks for the support and great package anyways :-)
from async_cron.
1、at the first time,the cron format is only for my use not that standard as the cron.
it supposed to be support only to every month level, because i think as a cron task, must be running regularly , so the cycle may be small units.
so '45,13,*,*,12,*'
will not gens a new cronjob. '45,13,*,0,*,*'
this one is fixed in the new commit.
this may be enough for now to finish routine jobs.
2、in the next release, i will upgrade the cron format as you suggested the standard cron format.
and will have more clear api and doc. only that , it will not coming too soon.
from async_cron.
Sure thank you for the update. I will wait for your next release. In the meantime will use the declarative APIs.
By the way when can I expect this patch to be released?
from async_cron.
hard to say, at least, a few month later maybe
from async_cron.
make some updates for the standard cron format. you can try it on the latest version
api and doc are still on the way.
close for now
from async_cron.
Related Issues (6)
- From the logs, humanized timestamp should be customizable HOT 1
- Set log level should be removed HOT 1
- [Feature request] Add from() and to() function to define working time HOT 10
- How do you use this with a Tornado application HOT 2
- Scheduling Job at specific time feature is not working properly HOT 1
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 async_cron.