[resolved] OnSubjobOk is not working as expected

One Star

[resolved] OnSubjobOk is not working as expected

Hi All,
I have multiple subjobs with the components tFixedFlowInput, tFlowtoIterate & tRunJob.
When I use OnSubJobOk on tFixedFlowInput to another tFixedFlowInput of another subjob, it is not working as expected. The other jobs are running fine though the subjob is throwing an error.
FYI, I have selected "Die on child error" option in tRunJobOk component.

Thanks,
Siva
Moderator

Re: [resolved] OnSubjobOk is not working as expected

Hi,
Would you mind uploading your current job design screenshots into forum so that we can see if your workflow is correct in logic.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

Re: [resolved] OnSubjobOk is not working as expected

Hi Sabrina,
PFA the screenshot of talend job.

Thanks,
Siva
Community Manager

Re: [resolved] OnSubjobOk is not working as expected

Hi Siva
What's the error message you get on the console?
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: [resolved] OnSubjobOk is not working as expected

Hi Shong,
In the subjob, I have one context.variable as status variable and I'm the providing the values as SUCCESS/FAILED. If, it contains value as FAILED then I have used tDie Component to stop the complete job.
Error message is something like "Child job has failed" as it has status as FAILED.
Here my concern is, If the subjob has failed with any kind of issue, then the other subjob having OnSubjobOk won't run right. Correct me If I'm wrong with it.

Thanks,
Siva
Community Manager

Re: [resolved] OnSubjobOk is not working as expected

Hi
It depends on the 'die on error' option on tRunJob even though the child job has an error:
if 'die on error' option is checked, the exception will be thrown out to the main job, the main job will die and stop to run, the subjob linked with onsubjobok will not be fired.
if 'die on error' option is not checked, the exception will be captured and handled by program, the main job will continue to run, the subjob linked with onsubjobok will be fired.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: [resolved] OnSubjobOk is not working as expected

Hi Shong,
FYI, I have selected the "Die on child error" on tRunJob component. But Still the subjob having onSubjobOk is running.

Thanks,
Siva
Community Manager

Re: [resolved] OnSubjobOk is not working as expected

Hi Shong,
FYI, I have selected the "Die on child error" on tRunJob component. But Still the subjob having onSubjobOk is running.

Thanks,
Siva

If the subjob linked with onsubjobok is still running, means there is no error/exception occurs in the child job. If the child job really has an error/exception, and the 'die on child error' box is checked, you will see an error message as read below on the console when running the main job.
the end is near
Exception in component tRunJob_1
java.lang.RuntimeException: Child job running failed
at

Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: [resolved] OnSubjobOk is not working as expected

Hi Shong,
I have got the following exception:
Exception in component tRunJob_2
java.lang.RuntimeException: Child job running failed
at ......
But Still the remaining process is continued.
PFA the screenshot of the talend job.
Thanks,
Siva
Community Manager

Re: [resolved] OnSubjobOk is not working as expected

Hi Siva
Which version are you using? I have tried to reproduce this problem in v5.4.1, but it can't be reproduced, it works as expected. If you are using an older version, try to download the newest version and test it again.

Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: [resolved] OnSubjobOk is not working as expected

Hi Shong,
Thanks for your time.
I'm using the v5.3.1.
Is there any way to work it in the above mentioned version. It would be really helpful to me if you provide the way to work it in the v5.3.1.

Regards,
Siva
Community Manager

Re: [resolved] OnSubjobOk is not working as expected

Hi Siva
I have tested this problem in the v5.3.1 and I got the same problem, it was a bug which only occurs when 'Enable parallel execution' box is checked on iterate link, it works normal if this box is not checked. So, you can resolve this issue with one of the following ways:
- Disable parallel execution on the iterate link.
- Upgrade to the new release if you are using community version, or open a ticket in our support portal to request a patch if you are using Talend enterprise product.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: [resolved] OnSubjobOk is not working as expected

Hi Shong,
Thanks for your response.
I can't disable the parallel execution on the iterate link as it is one of the most important part in my business process.
I have tried few things to get the same behavior of OnSubjobOk. But those are working in some scenarios & failed in some other scenarios.
Is there any possibility to have a Skype Call/ Web Call with you ? It would be really helpful to me.

Thanks
Siva
Community Manager

Re: [resolved] OnSubjobOk is not working as expected

Hi Siva
If you don't plan to upgrade your studio to a new release, you have to redesign the job to avoid this issue, the workaround can be:
- Define a flag in the child job to indicate the job runs fine or failure.
- Read this flag in the main job, and use runIf connector instead of onsubjobok, to fire other processing based on the condition.
Refer to this KB article:
Can I define a variable that is accessible from multiple Jobs?
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: [resolved] OnSubjobOk is not working as expected

Hi Shong,
Thanks for your response.
I already implemented the same flag kind of idea by creating one global variable. It's working fine.

Regards,
Siva
Community Manager

Re: [resolved] OnSubjobOk is not working as expected

Hi Shong,
Thanks for your response.
I already implemented the same flag kind of idea by creating one global variable. It's working fine.
Regards,
Siva

Great! Thanks for your feedback, this topic can be marked as resolved now.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business