In Solution Settings I have an On Open Method attached to a global which performs a chron job with the scheduler plugin but it doesn’t seem to run. The idle on the servers Clients page which shows the headless client running the batch process is never updated and I can see in the log it’s never fired.
Weird, can you post the code of the onOpen method?
// ********
// s m h D/M M D/W
// D/M = Day of month (1-31)
// D/W = Day of week (1-7)
// ********
plugins.scheduler.removeJob('PODEMAIL_batchprocessor');
// run every day at every hour from monday to friday
plugins.scheduler.addCronJob('PODEMAIL_batchprocessor' , '0 0 * * * 1-5', forms.open_quotes_snapshot_dates.makeSnapShot );
Would it make a difference if I have another scheduler job running right before the above in the same method?
Would it be possible to try this:
Instead of using the onOpen method, assign the solution settings a First Form, and then use the onLoad method of the First Form to schedule the cron job?
plugins.scheduler.addCronJob(‘PODEMAIL_batchprocessor’ , ‘0 0 * * * 1-5’, forms.open_quotes_snapshot_dates.makeSnapShot );
I am not sure but isn’t it so that you can only fire global methods?
The form does not exist yet when you execute the cron job…
Here is a re-write of my globals method firing the two chron jobs:
// ********
if ( arguments[0] ) {
plugins.scheduler.removeJob('OPEN_QUOTE_batchprocessor');
// run every day at midnightm monday to friday
plugins.scheduler.addCronJob('OPEN_QUOTE_batchprocessor' , '0 0 0 * * 1-5', forms.open_quotes_snapshot_dates.makeSnapShot );
plugins.scheduler.removeJob('PODEMAIL_batchprocessor');
// run every day at every hour from monday to friday
plugins.scheduler.addCronJob('PODEMAIL_batchprocessor' , '0 24 * * * ?', forms.BATCH_fetchPODEmail.POD_fetchEmail );
application.output("PODEMAIL starting batchprocessor");
} else {
application.output("PODEMAIL batchprocessor not started");
}
The first one definitely fires the method: makeSnapShot on the form: open_quotes_snapshot_dates and has for many moons so I would assume that the form, open_quotes_snapshot_dates, does exist as the method does indeed fire.
Providence,
You can use form methods in the scheduler plugin, the form will be loaded if needed when the scheduled method runs.
Why do you use the question mark in the timings string?
‘0 24 * * * ?’
Try this:
‘0 24 * * * *’
Rob
rgansevles:
Providence,You can use form methods in the scheduler plugin, the form will be loaded if needed when the scheduled method runs.
Why do you use the question mark in the timings string?
‘0 24 * * * ?’
Try this:
‘0 24 * * * *’
Rob
Rob,
The questionmark is mentioned in the Servoy 4 Reference Guide.
I think this is because when you use Day of Month (which is *)
that you can’t use Day of Week (so that is why you need to use a ? I guess)
By the way I also use CRON-timings and I got it work like expected.
Martin
[attachment=0]Capture.JPG[/attachment]
IT2Be:
plugins.scheduler.addCronJob(‘PODEMAIL_batchprocessor’ , ‘0 0 * * * 1-5’, forms.open_quotes_snapshot_dates.makeSnapShot );
I am not sure but isn’t it so that you can only fire global methods?
The form does not exist yet when you execute the cron job…
Yes see the syntax. Global Method is required
Hi,
I’m also having a problem starting a CronJob. Here is my call:
plugins.scheduler.addCronJob(fld_job_name, fld_cron_timings, globals[fld_methodname])
Here is the content of the parameters when called:
fld_job_name=po_overdue
fld_cron_timings=0 15 14 * * ?
fld_methodname=SCD_PO_Overdue
globals.SCD_PO_Overdue() exists. No error is raised.
I have done more tests. I call exactly the same function whether the client is a Smart Client or a Headless Client.
function InitApp()
{
var arg0 = arguments[0];
if (application.getApplicationType() == 4) //if Batch User
{
globals.SchedulerSetup();
}else{
globals.SchedulerSetup();
...
With the Smart Client it works normally. With the Headless Client it doesn’t do anything.
I’m just thinking: my method sends an email. Is plugins.mail compatible with the Headless Clients?
Foobrother:
I’m just thinking: my method sends an email. Is plugins.mail compatible with the Headless Clients?
The mail plugin does/should work fine in a batchprocessor/headless client. So it has to be something else.
I have tried to upgrade our Development Server to 5.1 beta2 in order to get more feedbacks from the Batch Processor.
Obviously, it is still not working, but now when I restart the server I get these error in the logs:
2010-01-21 11:41:10,043 ERROR [BatchProcess: EPiC] com.servoy.j2db.util.Debug - Error occured trying to load: C:\Program Files (x86)\Servoy\application_server\plugins\menubar.jar, error: error in opening zip file
2010-01-21 11:41:10,047 ERROR [BatchProcess: EPiC] com.servoy.j2db.util.Debug - Error occured trying to load: C:\Program Files (x86)\Servoy\application_server\plugins\kioskmode.jar, error: error in opening zip file
2010-01-21 11:41:10,052 ERROR [BatchProcess: EPiC] com.servoy.j2db.util.Debug - Error occured trying to load: C:\Program Files (x86)\Servoy\application_server\plugins\popupmenu.jar, error: error in opening zip file
However the Batch Processor is still running but at the scheduled time it doesn’t do anything and no error is raised
i guess those files do have the size 0 ?
you should remove those files they are all replaced by the window.jar (window plugin)
jcompagner:
i guess those files do have the size 0 ?
Yes.
I have deleted them. Now it looks ok (even if the batch user still doesn’t run the job)