Closed (won't fix)
Project:
DataSync
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Aug 2009 at 09:39 UTC
Updated:
28 Aug 2009 at 11:58 UTC
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).
Comments
Comment #1
andrewlevine commentedIt 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?
Comment #2
pounardI 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.
Comment #3
andrewlevine commentedThat 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
Comment #4
pounardOk thanks for the tip, I'll look this way, if really I can't, I'll just do some Drush scripting.
Comment #5
andrewlevine commentedThis 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
Comment #6
andrewlevine commentedlet me know if you need more help or if you come up with something the community can use :)
Comment #7
pounardI 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!
Comment #8
andrewlevine commentedI couldn't spend the time solving this problem either :) No worries