One Star

Joblet cannot use INPUT in conjunction with subjobs

I have a joblet that requires the use of subjobs, but that also takes an input.
Many of my joblets have subjobs (eg open DB connection, read file, write to DB, close DB connection). I can do this using the TRIGGER_INPUT component to start the joblet, and each subjob is connected using a Trigger from the previous one.
However, in a joblet that requires a data input, I need to use the INPUT component, and you cannot set a trigger on this component. If you can't set a trigger, you can't create a second subjob in the joblet.
Essentially in my job, I read an input and send this through a tMap to several tHashOutputs, all linked. I then read in the (now merged) tHashInput and write this to a database.
I know I can use a TRIGGER_OUTPUT and an OUTPUT component in the same joblet because the examples in the documentation say so, but I can't use a TRIGGER_INPUT and an INPUT component in the same joblet because the subjob would then not be the start of a subjob and therefore cannot take a trigger.
How can I create a subjob that takes input, but that also allows me to use subjobs inside it?
3 REPLIES
Moderator

Re: Joblet cannot use INPUT in conjunction with subjobs

Hi,
Is the trunjob set in Joblet working for your case? Is there any expected result screenshot for your workflow?
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.
One Star

Re: Joblet cannot use INPUT in conjunction with subjobs

Hi, sorry, but I don't understand how this would help. I don't understand how using a tRunJob fixes the problem of not being able to receive an input data stream vian an INPUT component *and* using subjobs in the same joblet.
If I define a job with subjobs, how can I define an input of data that the job will receive and process?
If I define an input data flow, eg using the INPUT component, I cannot set up subjobs inside it. Subjobs are mandatory because I have multiple tHashOutputs and a single connected tHashInput in the same job. It is how I take data from fields 100 repeating fields and split it out into 20 records of five fields each.
I'm also not sure what you want me to screenshot.
I can't screenshot the expected output because that requires me to create the job in the first place, and that's what the case is about. All I have are components floating around that I can't join up.
A screenshot of the data is irrelevant to the problem because the joblet has no output data flow, it just loads a database table. It is the *input* that I'm struggling with.

How does a tRunJob help, and what would you like me to screenshot for you?
One Star

Re: Joblet cannot use INPUT in conjunction with subjobs

(Note - again this is mavdo, but talendforge won't let me login properly. I log in but it still has a "Log in" box at the top of the page and forces me to post as a guest. Clicking the "Log in" button shows my username and profile details, but it otherwise acts as if I'm not logged in. Genius(!))
Hi
I have found a solution to this.
Read in the data through an INPUT component and send it to a tHashOutput.
Set an "OnComponentOK" trigger from this tHashOutput and attach it to the next subjob.
Continue with the rest of the joblet as normal, utilising OnSubjobOK triggers between all other subjobs.
End the joblet with an OUTPUT or TRIGGER_OUTPUT component (possibly both).
I have tested this and found it to work very well.
If your first subjob ends with a single component, you could just use this to attach the OnComponentOK trigger. Unfortunately mine had multiple exit points, and although there was an order to them, I wanted to guarantee that they had all completed under all circumstances.
mavdo