One Star

Get job version

Hello,
For some reasons, I need to display the job version during its execution.
Is it possible to get it ? (maybe in the globalMap ?)
I'm using TOS 4.2.0 with Java
Thanks
6 REPLIES
Employee

Re: Get job version

Hi,
I know you can get the job name and project name with the jobName and projectName variables, but I don't think there's anything that allows you to get the job version.
One tricky solution would be to have your job go through the workspace to find the files corresponding to the jobs.
In Talend each version of a job has its own file, for example:
Job1_0.1.item
Job1_0.1.properties
Job1_0.2.item
Job1_0.2.properties
If you get the job Name with the "jobName" variable, you can then use a tFileList component to gets the files that are in the process folder of the workspace (where the jobs are), and use the jobName as the filter for the files returned by the tFileList.
Then you can extract the versions available for this job, and keep only the max one.
I can't think of another solution.
One Star

Re: Get job version

Sure it is tricky !
I was hoping for a cleaner solution.
Thank you
One Star

Re: Get job version

I want almost the same functionality; I want to log the SVN revision number in a table. Anyone some suggestions?
One Star

Re: Get job version

Hi,
I think this is very easy, but correct me if I'm wrong.
As seen in the source produced by Talend the job version is in a variable named jobVersion
It's somewhere in the beginning of the generated code, near jobName and projectName variable.
I think you can reference this variable from anywhere inside the job.
For the SVN revision number Rogier asks about, I don't think this is directly inside the source.
Hope this helps.
Regards,
Arno
Employee

Re: Get job version

	private final String jobVersion = "0.1";
private final String jobName = "deduplicate_customers";
private final String projectName = "INTERNALPROJECTS";

You're right Arno, I can't believe I never saw that!
Well guymage, you have your answer :-)
One Star

Re: Get job version

Sorry, I haven't seen this message before.
Thank you for the answer, it works Smiley Happy