I am writing a kind of start - pause - resume - pause - resume -(at regular intervals) kind of job in Quartz. I am using a SimpleTrigger for initial experimentation.
I would like to how I can find the time a job has been running. I looked at the Scheduler class and there were no methods directly to find it.
Could some one suggest me a way of finding how long a job has been running?
Thanks,
Abi
Call scheduler.getCurrentlyExecutingJobs() to get the set of job's currently executing (or more precisely to get the JobExecutionContext of each).
Then you can call getFireTime() on the JobExecutionContext to see what time the execution started.
Related
How can I send all resource units from a resource pool to maintenance or break whenever another event in another block occurs?
I'm looking for something like: resourcePool.startMainteinance()
and write it inside a "On start" box in some other block of the flowchart. Of course then I would need to end the maintenance with something like resourcePool.stopMainteinance() and resume all the tasks the resource units were executing.
Any idea? or some idea to pause manually all resources from executing their task and then resume them?
Note: suspending the agent that seized in the size block with the code SizeBlock.suspend() and SizeBlock.resume() is not an option because the resources have preparation tasks and those tasks also need to be paused.
Thank you!
You should use the Downtime block that is designed for this setup.
You can control it any way you like. In your case, myDowntimeblock.startTask(someAgent) and stopTask(sameAgent) work.
Also check the example model named "Maintenance of a Coffee machine": It shows all the other ways of using the block.
I have a many human task. After start the process i want to update some process variable value with rest API call that's relates to current task. If anyone knows how to do that commend bellow.
I try with /execute this is only start the task then how to update the process variable for already started process instance?
Based on the documentation
Here is how to do update the process variable. However, this will update an entire process rather than only that specific task.
server/containers/{id}/processes/instances/{pInstanceId}/variables - POST
If you want to update process variable from a task, you should do it during task completion. However, this requires you to have output variables from that task. Otherwise, it won't take any effect.
server/containers/{id}/tasks/{tInstanceId}/states/completed - PUT
Anyway, the full documentation of rest can be viewed in
{localhost}:{port}/kie-server/docs
We're using Quartz 1.8.6 in our app. We are using CronTriggers for hourly and nightly jobs. We would like to set things up such that if there is a misfire, we want to skip the job until the next cron time rolls around.
For simple jobs, it appears you can do a
nightlyTrigger.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT);
However, it appears that this does not work with CronTrigger. What is the Misfire instruction to use in this case?
You want to use CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING.
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT is telling Quartz that, upon one or more misfires, it must:
reschedule the trigger to fire upon the next scheduled date (not firing, i.e. ignoring, missed executions).
Also, set the "repetitions left" counter as if all missed executions had run correctly (not accounting for missed runs either).
So basically this misfire instruction tells Quartz to do nothing at all, smile and keep going like nothing ever happened. The KEEP CALM of misfire instructions.
The equivalent instruction for Cron triggers is much more aptly named: CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING.
Hi I'm new to Quartz Scheduler, i'm implementing it for the first time. I would like to know if the scheduler's start call will even execute the paused jobs? or Paused jobs will only be activated by resume call alone and nothing else. Please help me.
First of all, you can pause a trigger or scheduler, not a job. Do not be confused, that for example IScheduler interface has different pause methods, and one of them for example is PauseJobs(), they all affect triggers:
IScheduler.PauseAll: Pause all triggers - similar to calling PauseTriggers(GroupMatcher) on every group, however, after using this method ResumeAll() must be called to clear the scheduler's state of 'remembering' that all new triggers will be paused as they are added.
IScheduler.PauseTriggers: Pause all of the ITriggers in the groups matching.
IScheduler.PauseJobs: Pause all of the IJobDetails in the matching groups - by pausing all of their ITriggers.
IScheduler.PauseJob: Pause the IJobDetail with the given key - by pausing all of its current ITriggers.
The difference between Pause and StandBy methods may help you to understand what and when will be started:
The Pause methods are used to pause all the existing triggers you have added to scheduler only. This affect existing triggers only, and scheduler is still RUNNING! Any new job/trigger added will still run, and it's not paused! You would have to call Resume to unflag those paused triggers to get them running again.
The Standby is used to place the entire scheduler in "not working" mode, meaning no jobs or triggers will be fire or run, including ones already scheduled, or new ones added. Not until you call Start again.
I am creating a set of tasks in a cluster using the -qsub command.
Inside my matlab code I would like to make a synchronization point to check whether all of my workers are finished execution or not. If all have finished execution I want to assign some other tasks to them.
For e.g.:my function (matlab) is:
function test(taskId)
do_task_1(taskId);
__sync() ----->check whether all the workers have finished the job successfully
do_task_2(taskId);
end
How can I do it?
p.s. I am a beginner to cluster computing.
A little late to the game, but might still be useful to you or others. I doubt you can do this from within matlab. Others with more experience may suggest otherwise. I would split the two tasks into separate matlab programs and use the -sync option with Grid Engine:
qsub -sync y do_task_1.sh
# -sync y makes qsub wait for job to finish
qsub do_task_2.sh
You can put the above commands in a script so you don't have to wait for first task to complete.
Alternatively, you can use '-hold_jobid`:
qsub do_task_1.sh
qsub -hold_jid <job_id_of_task_1> do_task_2.sh