cancel
Showing results for 
Search instead for 
Did you mean: 

Parent job

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

h_carpenter
Active Contributor
0 Kudos

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

gmblom
Active Contributor
0 Kudos

Note that this cannot be done. The parent job should figure this out himself.

Regards Gerben

Former Member
0 Kudos

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

gmblom
Active Contributor
0 Kudos

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

h_carpenter
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Thank you Gerben/HP for helping me to understand.

Regards,

Chandu

Answers (0)