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

andrewlevine’s picture

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?

pounard’s picture

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.

andrewlevine’s picture

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

pounard’s picture

Ok thanks for the tip, I'll look this way, if really I can't, I'll just do some Drush scripting.

andrewlevine’s picture

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

andrewlevine’s picture

Status: Active » Closed (won't fix)

let me know if you need more help or if you come up with something the community can use :)

pounard’s picture

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!

andrewlevine’s picture

I couldn't spend the time solving this problem either :) No worries