DataSync scheduler, is it possible to predict hours of execution?
pounard - August 21, 2009 - 09:39
| Project: | DataSync |
| Version: | 6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Jump to:
Description
Hi, I need to schedule a massive job, each night at a regular hour. I see we can tell DataSync scheduler to run a job once a day, but is it possible to make it run at an arbitrary hour? (I known this is depending of the cron, but it's not a big thing to make cron hit each 5 minutes, for example).

#1
It isn't a feature of datasync_scheduler right now. This is a tougher problem that I've avoided because we want to make sure the creation of a job is always asynchronous from its running. But it is possible to do something like this: maybe by creating the job on cron and then moving it to the top of the queue. Why do you need the job to run at a certain window of time?
#2
I do some massive operations which needs to put the site in maintenance mode, I can't let this happen at day time, it has to happen in the middle of the night.
This is a really particular use case, if DataSync scheduler do not handle this, I'll try to see if I can script it with system cron and Drush.
#3
That makes sense. It sounds like you'd want to stop all other jobs and run this one. This sounds like would be a good case for hook_datasync_post_jobs(). Which runs regardless of the queue. See datasync_run.php for how that works
#4
Ok thanks for the tip, I'll look this way, if really I can't, I'll just do some Drush scripting.
#5
This is how I would implement it: implement hook_datasync_post_jobs() (this hook runs every time datasync makes a loop (at least every 20 seconds or so). Check the time and if it is a certain time create a job and set the timestamp to an old date so it gets moved to the top of the queue
#6
let me know if you need more help or if you come up with something the community can use :)
#7
I think for this one I'm not going to contribute :/ Not I don't want to, it's because I don't have any idea how to do a generic codebase here.
EDIT: arrh and time is missing to do clean code right now!
#8
I couldn't spend the time solving this problem either :) No worries