We've got a problem with stuck triggers in an application using Quartz Scheduler version 1.8.6 when jobs do not complete.
For example, we have jobs with ssh calls or database queries. If these jobs hang (because the ssh call does not terminate or the select statement has a table lock), then I cannot get the jobs to trigger any more. The triggers are stuck until I forcibly restart the scheduler.
I have tried to Scheduler.interrupt(trigger) and Scheduler.rescheduleTrigger(). I have tried removing the trigger and recreating it. I have removed the job and recreated it.
The result is the same: I can restart the job, but the trigger hangs and is not run again.
Please disregard this question. I had problems with my installation which were unrelated to Quartz.
Scheduler.interrupt() is the correct method, and is working perfectly for me now.
Related
There are some jobs scheduled using any trigger either SimpleTrigger or CronTrigger, now want to unschedule and delete the jobs. The job can be in running or already completed its execution state. If a unschedule or already executed job is deleted then there won't be any worst impact but what happen to the running job, if unschedule using unscheduleJob() or deleted directly by deleteJob() methods of the Quartz?
And if the running job is being halted in-between when the unscheduleJob() or deleteJob() is called upon then is there any way to let the job to complete it's current execution before unscheduling or deleting to avoid any malfunctioning or bad data?
Tried to check the conflicting jobs and make use of SchedulerListener also but didn't get any information.
Thanks in Advance!!!
I had developed a Job in Talend and built the job and automated to run the Windows Batch file from the below build
On the Execution of the Job Start Windows Batch file it will invoke the dimtableinsert job and then after it finishes it will invoke fact_dim_combine it is taking just minutes to run in the Talend Open Studio but when I invoke the batch file via the Task Scheduler it is taking hours for the process to finish
Time Taken
Manual -- 5 Minutes
Automation -- 4 hours (on invoking Windows batch file)
Can someone please tell me what is wrong with this Automation Process
The reason of the delay in the execution would be a latency issue. Talend might be installed in the same server where database instance is installed. And so whenever you execute the job in Talend, it will complete as expected. But the scheduler might be installed in the other server, when you call the job through scheduler, it would take some time to insert the data.
Make sure you scheduler and database instance is on the same server
Execute the job directly in the windows terminal and check if you have same issue
The easiest way to know what is taking so much time is to add some logs to your job.
First, add some tWarn at the start and finish of each of the subjobs (dimtableinsert and fact_dim_combine) to know which one is the longest.
Then add more logs before/after the components inside the jobs.
This way you should have a better idea of what is responsible for the slowdown (DB access, writing of some files, etc ...)
I am using Quartz scheduler to execute jobs. But while trying to schedule jobs for a future time, the jobs get triggered at the right time and immediately goes to failed state without displaying anything in the scheduler logs.
Could not find the root cause for this. But the issue was solved by pointing to a freshly created Quartz database.
The reason could be that the database might have got corrupted in some way.
I am working to migrate from Quartz 1.6 to 2.1 and use a JDBCJobStore. Previously, the the jobs were loaded via an xml file when the webapp started. The scheduler is now running using the JDBCJobStore but I don't understand how to add the jobs to the database which need to run on an ongoing basis (not one-off jobs).
My first thought is to create a servlet which runs on startup which adds the jobs to the database. But my concern is that this will be executed every time I need to restart the app and the jobs will get duplicated.
Thanks,
steve
The Jobs wont disappear from the database when you do a restart. So within your servlet, when it starts up before adding any jobs check to see if they already exist. When you create your jobs you can give them identities. Using the identities and some quartz methods you check if they already exist.
It sounds like the memory based scheduler is a better fit for these fixed jobs. You can create more than one scheduler, one memory, one JDBC if that makes sense for your application.
I have a Cron Trigger configured using the JDBCJobStore since we will be running the app within a clustered environment.
I have the CronTrigger running every 10AM, everything is working great.
How would I programmatically start this Cron Trigger "On-Deman". Any code sample appreciated.
I'm using Quartz 1.6.5 on Tomcat 6.0.
Thanks for any help.
If you know the name and group of the job you wish to run "on demand", and you have programmatic access to the scheduler, you could schedule a new SimpleTrigger to run once and immediately.
http://quartz.sourceforge.net/javadoc/org/quartz/Scheduler.html
Note that this would not start the cron trigger, I am assuming your goal is to actually run the job your cron trigger points to. If you have code that relies on TriggerListeners listening to your cron trigger, this will not help.