on 02-04-2016 1:58 AM
Hi,
I am trying to mark the parent chain to status completed using the post running action. But not able to find the correct method. Advise please.
JobDefinition aJobDef = jcsSession.getJobDefinitionByName(jcsJob.getParentJob().getParentJob().getJobDefinition().getName());
aJobDef.setFinalStatus(JobStatus.Completed);
Thanks,
Chandu
Hi Chandu,
A minor mistake, here:
Job != Job Definition, Job Definition does not have a final state. You need to get a job instead.
Try this:
Job aJob = jcsJob.getParentJob().getParentJob();
aJob.setFinalStatus(JobStatus.Completed);
Regards,
HP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi HP,
When I am trying to save the code, I get the below error.
Caused by: com.redwood.scheduler.persistence.impl.MultipleCauseException: JCS-MULTI: Modification vetoed: JCS-102183: Compile failed for Job definition FI_E538_ECC_LIHEAP_PAYMENT_ROLL action (type=Post Running): FI_E538_ECC_LIHEAP_PAYMENT_ROLL.java:user code 18:4:cannot find symbol symbol : method setFinalStatus(com.redwood.scheduler.api.model.enumeration.JobStatus) location: interface com.redwood.scheduler.api.model.Job aJob.setFinalStatus(JobStatus.Completed);
Gerben, We are trying to mark the parent chain completed, if a string is found in the job log of the job stopping the chain to proceed further.
Regards,
Chandu
Message was edited by: Chandu Bomma
Hi Chanda,
The message is the system telling you the same I did: this is not possible. And there are some reasons for that. Each job can only set it's OWN status before it is in an end status, after that, the job becomes unmodifiable. For all kinds of audit reasons, that is the most straightforward method.
If you want to stop you chain when you find a certain string in an output file you set the current job to Error (jcsPostRunningContext.setFinalStatus(JobStatus.Error)) and let the chain handle the error. By Default the chain will error out. If you want to Complete it, set the final status handler to finish the chain correctly.
Regards Gerben
Hi Chandu,
Yes, I did not really "think about" the actual problem, just, JobStatus of JobDefinition, makes no sense ...
As Gerben pointed out, you cannot simply set a chain to Completed. The setFinalStatus is only relevant for the current process (the one of which the postrunning action is running).
Regards,
HP
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.