[resolved] UserRoutines.jar only packs routines used by the job

Hello guys, I'm with a problem that I really expect to have a good solution Smiley Very Happy
Let's begin with an example:
I have a job JobA that uses RoutineA and RoutineCommon and I have a job JobB that uses RoutineB and RoutineCommon.
All these Routines were created by me, they aren't system routines Smiley Wink. Also, both jobs are in the sabe project.
Lets say that I build JobA and put it in production. When I open my lib/UserRoutines.jar I can see RoutineA.class and RoutineCommon.class.
So, then I need to put JobB in production. I build JobB and put in production in the same server that JobA already is (because I'd like to have one lib folder shared through all my jobs, this way I'd avoid having a lot of duplicateds .jar files). 
So the structure of my production server would be something like this:
root
|-- lib
|-- JobA
|-- JobB
Ok, then I go to my lib/UserRoutines.jar just to check that all my classes are there and, for my BIG surprise, only  RoutineB.class and RoutineCommon.class are there. Where is the RoutineA.class?
Then I try to run my JobA and what happens???   it fails to run, saying that RoutineA is missing.
Solutions that I thinked about:
1: declare routine dependencies to All my jobs (this I believe is ridiculous, imagine if I have 100s of jobs, and then I create a new Routine to one new job.....Smiley Surprised...I'd had to add this new Routine dependency to all my 100s of job, because is suddenly I'd need to change one of them, it would broke these new job)
2: create one job (let's call it JobRoot) and set all the dependencies ALWAYS to only it, all the other jobs would have only the dependecies it needs. Doing this, every time I deploy one job  (old or new) I would have to deploy this  JobRoot after, to make sure that all ohter jobs wouldn't break.
3:create one lib for each job (actually, this is not a option for me Smiley Tongue )
So, I really think that it must have some configuration or anything else that would avoid me from any of these solutions (but I don't know it Smiley Very Happy)
I'd like to hear opinions and suggestions Smiley Very Happy.

Thanks in advance Smiley Wink
Gabriel
1 ACCEPTED SOLUTION

Accepted Solutions
Five Stars

Re: [resolved] UserRoutines.jar only packs routines used by the job

From my experience...
If you create a routine and then create a Job, the routine is automatically added.
If you create a Job and then create a routine, you must manually add the routine.
I've also noticed that, at least in some versions, a Job will work in Designer without manually adding the routine (scenario 2); but the routine is not available when you "Build Job".
I think there are some inconsistencies and I can see the issue if you want a common lib file.
There may be a smarter answer; but the idea of periodically creating a "root" Job that should automatically have all routines added may be a workable option.
4 REPLIES
Community Manager

Re: [resolved] UserRoutines.jar only packs routines used by the job

Hi Gabriel 
Ok, then I go to my lib/UserRoutines.jar just to check that all my classes are there and, for my BIG surprise, only  RoutineB.class and RoutineCommon.class are there. Where is the RoutineA.class?

Which version are you using? There might be a bug in the version you are using? I just tested this issue with version 5.5.0 and it works, I can see all of the user routines class in  lib/UserRoutines.jar

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Five Stars

Re: [resolved] UserRoutines.jar only packs routines used by the job

From my experience...
If you create a routine and then create a Job, the routine is automatically added.
If you create a Job and then create a routine, you must manually add the routine.
I've also noticed that, at least in some versions, a Job will work in Designer without manually adding the routine (scenario 2); but the routine is not available when you "Build Job".
I think there are some inconsistencies and I can see the issue if you want a common lib file.
There may be a smarter answer; but the idea of periodically creating a "root" Job that should automatically have all routines added may be a workable option.

Re: [resolved] UserRoutines.jar only packs routines used by the job

Hi Shong
Which version are you using? 

I'm using Talend for ESB 5.5.1 (r118616).
There may be a smarter answer; but the idea of periodically creating a "root" Job that should automatically have all routines added may be a workable option.

I agree tal00000, and I'm hoping there's a smarter answer Smiley Wink
Thanks,
Gabriel
Community Manager

Re: [resolved] UserRoutines.jar only packs routines used by the job

Hi Gabriel 
If you create a routine and then create a Job, the routine is automatically added.
If you create a Job and then create a routine, you must manually add the routine.

As tal0000 said, if the routine class isn't export when you build job, right click on the job and select 'setup routines dependencies' item, and add the user routine manually.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business