tide - exit jvm - on enterprise studio for data integration v5.3.1

One Star

tide - exit jvm - on enterprise studio for data integration v5.3.1

Hi,
I am trying to get a subjob in a main job to exit on a particular condition without throwing an error. That is, on a specific condition in the subjob, i want to exit the whole job without generating an error.
After looking around, it seems like, in the subjob, if the condition is true, I could add a tDie component and pick the 'Exit JVM immediately' option in the advanced settings.
I just want to know what the repercussions of trying this are - would the tomcat server that TAC is deployed on die if I pick the 'Exit JVM immediately' option?
Thanks
Am
Four Stars

Re: tide - exit jvm - on enterprise studio for data integration v5.3.1

Hi Am,
Tomcat server will also die if you select that option. Pl check Shong's response for similar post.
http://www.talendforge.org/forum/viewtopic.php?id=9613
Thanks
Vaibhav
One Star

Re: tide - exit jvm - on enterprise studio for data integration v5.3.1

Vaibhav,
Thanks for your response.
I did look at that post earlier - but I wasn't sure if it is the same situation as mine:
FROM THE POST:
Check 'Exit the jvm immediately' option on tDie component, the Job B will aslo stop once the jvm exits(see pic1), but it will brings an nagative impact, when you export the job and deploy it to tomcat as web Service, it will aslo stop the tomcat server once the jvm exits.
My Questions:
1) We don't export the job and deploy it to tomcat as web service - we just run it from within TAC - is that the same as deploying it to tomcat as a webservice? Would it affect us the same way?
2) Also, in option 2, how do I enforce synchronization between the various subjobs so that Job A completes and kills Job B before Job B starts - as in what if JavaFlex completes and triggers Job B before Job A has had a chance to kill Job B?
Thanks,
Am
One Star

Re: tide - exit jvm - on enterprise studio for data integration v5.3.1

Vaibhav,
Here is what I tried. We have a job server set up for testing purposes and I tried the tDie component with 'Exit JVM immediately' option enabled. It ran as I wanted it to and did not kill the job server.
Does this mean that the job will reliably work like that on production as well?
Thanks,
Am
Four Stars

Re: tide - exit jvm - on enterprise studio for data integration v5.3.1

Thanks Am for this update.
It should work. As per earlier post, if that option is enabled with additional code to kill the thread would lead to killing the tomcat server. Else, if we are not using that thread killing option then it would not exit.
Thanks
Vaibhav
Four Stars

Re: tide - exit jvm - on enterprise studio for data integration v5.3.1

This is how exit JVM means.
Suppose we have a tjava component and written System.exit(1). On subjob Ok if we have another tjava component which prints "Post exit". If we execute the job, the second tJava will not execute at all.
tJava1-->onSubJobOk-->tJava2'
tJava contains - System.exit(1)
Regarding tDie--- Suppose we have tDie in preJob and selected Exit JVM option, then the job will end there itself. This also terminates parent job as well if it called by some other job.
If we don't select that option then tPreJob section will end and the job will go to next subjob.
I think you got the point.
Thanks
Vaibhav
One Star

Re: tide - exit jvm - on enterprise studio for data integration v5.3.1

Vaibhav,
I think i get what you are saying with regard to calling System.exit() from a tjava component being equivalent to what i am trying to accomplish here.
Since you brought it up, I am fuzzy about what the prejob job component is designed to accomplish.
the prejob component to me is nothing more than a label to designate a subjob as 'prejob'.
whether i say prejob -> subjobA -> subjob B or just Subjob A -> Subjob B the jobs run the same.
It really doesn't seem to be very useful - I could be wrong. could you give me a real scenario where it might be used?
Thanks,
Am
One Star

Re: tide - exit jvm - on enterprise studio for data integration v5.3.1

The tPreJob and tPostJob are used to force certain things to happen first or last, this is useful in jobs where you don't force the order with OnSubjobOk, OnSubjobError, etc links. I use them in a joblet where I want to have pre and post conditions met and can just drop the one joblet into a job and it has a tPreJob to handle the preprocessing (i.e. setting context variables) and a tPostJob to handle the cleanup (i.e. write processed date for that table to the database).
In your case, the tDie is the component you're looking for.
Hope that helps clear up the fuzziness.
Four Stars

Re: tide - exit jvm - on enterprise studio for data integration v5.3.1

Hi Am,
IdeallyI divide all of my talend jobs in 4 sections
1) PreJob
2) Main Job Flow
3) PostJob
4) Logging section
As per our discussion, I can put three die component (not with exit JVM) at 1,2,3 places in case of any error close the section. When tPreJob fails, it moves to Main Flow. If MainFlow Fails it moves to third section and when third section fails, it moves to fourth section and close the Job. You can create sample job like this
tPreJob-->tJava- Print prejob
tJava - Print - I am main job
tPostJob-->tJava -- print I am post job
tstatCatcher - tlogrow OnSubJobOk - tjava - print I am logging section..
And play with tdie and exit JVM and calling this by some other job... you will get the concept and use of tPreJob in actual projects.
Thanks
Vaibhav
One Star

Re: tide - exit jvm - on enterprise studio for data integration v5.3.1

@rpbaldwin "this is useful in jobs where you don't force the order with OnSubjobOk, OnSubjobError, etc links" - clears up the use of the pre and post jobs. Thanks.

Am