I am having an autosys box job- auto_task_box which have 3 child jobs
: auto_task1_wd - runs in every 5 mins monday to friday
: auto_task2_dly - runs on 02:00 on every day
: auto_task3_sa - runs at 03:00 on every saturday
Issue is after scheduling is after the Ist run of auto_task1_wd, the box will wait for completion of auto_task2_dly and auto_task3_sa so the next iteration of auto_task1_wd ie after 5 mins won't happen.
How would I tackle this issue?
I am using autosys R11 in linux.
It sounds like the three jobs should run independent from each other. In this case I would not use a box at all, but just three separate tasks, as I always tend to think of boxes as a way of ensuring relationships between tasks.
I agree with the first answer, these jobs should not be grouped into the same box. Boxes are container for jobs with like starting conditions. It is a very bad idea to have date time conditions for jobs in a box. You will have some unexpected runs that way.
Related
I’m considering pg-boss for running and distributing event-based jobs between the instances of the same service. One of my use cases, apart from event-based, is scheduled jobs. Some of them can take a while and continue running until it’s time to trigger the next invocation - e.g. a job is set to run every 5 minutes but it can take e.g. 8 to complete. In such case I need the system to realize that the previous run is still in progress and not trigger the same job while the previous invocation of it is still in progress, using the example of every 5 minutes and a job taking 8 minutes - I’d like sth like the following to happen:
13:00 job triggered
13:05 job still runs, system sees it and doesn’t trigger once more even though it’s time
13:08 job done
13:10 next job run triggered
Is there an elegant way to achieve it with pg-boss without implementing my own locking mechanism?
We have read https://developer.shopware.com/docs/guides/plugins/plugins/plugin-fundamentals/add-scheduled-task which described how to define a scheduled tasks which runs every x minutes.
Is it also possible to specific the execution time, for example each midnight or every day a 2 am, like in a crontab?
There is no such possibility in Shopware 6. It is easier to accomplish this with a CLI command and crontab. But if you have to use Shopware's scheduled task then you can trick it by setting the nextExecutionTime to the time you want to execute the task.
For example if today's date is 10.03.2022 and you want to execute the scheduled task every day at 2 am then set the nextExecutionTime to 2022-03-11 00:02:00.000 (use future date) and runInterval to 86400 (24h). This way Shopware will start the task at 2 am and then set the nextExecutionTime to the next day at 2 am (+- couple of minutes from my experience).
I'm not aware of such a feature in Shopware core.
The probably most straightforward way would be to add a "real" cronjob like you mentioned, which triggers a CLI-command.
You can encapsulate the logic of the task in it's own service, so that the scheduled task and cli-command both can just use the service (if you want to keep both).
I have a Map/Reduce script running in every 15 minutes. While I check the schedule status, it seems few times the execution skips. I have set the priority to "High", Concurrency limit to "2". Please see the screenshot for reference. I am not getting why this skips for few cases. Can anyone please help me on this? Thanks in advance.
From the above example, the script skips to execute on 3/16/2021 5:01.42 pm
You can try listing all your scheduled and map/reduce scripts. It is likely that some other scheduled or map/reduce script was running at that time. Netsuite will not interrupt a running task so if something else was running through the next slot Netsuite won't have run it.
The other thing I've seen is scripts scheduled for near midnight California time are often skipped or terminated. I haven't looked at this lately so they may have fixed this but if that time is midnight California then that's likely the reason.
(I apologize in advance for bad formulation of my problem, please consider english is not my first language).
I have several processes (crons) and I want to "optimize" the schedule when to launch them.
For example, cron c1 starts every 3 minutes, cron c1 starts every 7 minutes and cron c3 starts every 18 minutes. Assume they last only a few seconds before stopping.
The unit of time here is 1 minute.
Now, what I want is that these crons are distributed so that we don't have a moment where many of them start and then long time interval with no cron at all. For example, if c1 and c3 both start at time 0, then they will start again together every 18 minutes. It would be better to start cron c1 at time 0 and then c3 at time 1, so that they are never launched together.
So the idea is, given a list of crons with periodicity, to plan a schedule, so that there is as much time between each cron as possible and as few as possible moments when two crons start together.
Are there some well-known algorithms about such problems?
The real-life application of this problem is: ~ 200 crons. Some of them are launched every 5 or ~10 or ~30 minutes and last very short (few seconds), some (~20 - 25) are launched every 2 hours and last a few minutes. So the idea is also that the big crons are not launched at the same time.
I am a mathematician myself and not a computer scientist, so I asked this question on https://math.stackexchange.com/, since I consider this being a "nice" question for mathematicians too.
I think you should consider the ressources used by each of your crons and then schedule your jobs from that.
I don't think there is a particular algorithm for that.
I have 3 different jobs set up in crontab (call them jobA, jobB, jobC) that run at different intervals and start at different times during the day. For example, jobA runs once per hour at 5 mins past the hour, jobB runs every 30 mins at 9 and 39 mins past the hour, and jobC runs every 15 mins. They are not dependent on each other, but for various reasons they can NOT be running at the same time.
The problem is that sometimes one of the jobs takes a long time to run and another one starts before the first one is done, causing issues.
Is there some way to queue or spool these jobs so that one will not start until the current running one has finished? I tried using this solution but this does not guarantee that the pending jobs will resume in the same order they were supposed to start. A queue would be best, but I cannot find anything about how to do this.
You can't do that using cron. Cron is used to run a specific command at specific time. You can do it by the solution you proposed, but that adds a lot more complexity.
I suggest, writing/coding the requirement in high level language like java and use a mutil-thread program to achieve what you need.
Control-m is another scheduling software, with a lot of other features as well. You would be able to integrate the above use-case in it.