I am looking schedule some function to be execute at a specific time,
@Duradundi_hadimani @DaizyModi @rmehta
Looking for a help
Thanks In advance.
I am looking schedule some function to be execute at a specific time,
@Duradundi_hadimani @DaizyModi @rmehta
Looking for a help
Thanks In advance.
Try Scheduler events in hooks.py
https://docs.frappe.io/framework/user/en/api/background_jobs
You can put in a custom time of day using CRON format as well.
One option is to set scheduler for specific time. And from python create empty flag file .alreadyran that will skip run after that file flag is created. Other, cleaner option, is to use ‘at’ command from linux.
Hi @nikkothari22 , Thanks for Reply
frappe.enqueue
I tried using this but cant specify the day or time of execution and hooks is not possible in my case as I want it to create dynamically.
Hi @MrKovalski , Thanks for Reply
setting scheduler is not a proper solution for me , can you please provide some reference for at command from Linux and how can I use it.
Check rq-scheduler. You will need to start it as a process. One more service for rqscheduler
will have to run along with other bench services.
In brief it will be:
./env/bin/rqscheduler --url=$(jq -r ".redis_queue" sites/common_site_config.json)
scheduler.enqueue_in(timedelta(minutes=10), count_retweets, tweet_id)
bench scheduler
just like existing command bench worker
, refer frappe/commands/scheduler.py
and start_worker
from frappe/utils/background_jobs.py