kaffein
kaffein

Reputation: 1766

Can not override Talend job context parameters when launching from the command-line

I am currently trying to run a Talend job from the command line. Since my production environment parameters are different from what I have on my local workstation, I have to provide context parameters when launching the job on the target server:

kaffein@coffeeshop:~$ ./job_run.sh --context_param port=1234 --context_param server=myserver

When I exported the job though, Talend Open Studio (for data integration) generated Default.properties files for all my subjob folders. These files contain my local default context parameters.

Launching my job with the production parameters (like shown above) then fails because it seems that the "local" parameters cannot be overriden by the command-line parameters (--context_param arguments) provided.

Can someone help me on this issue please ?

Upvotes: 3

Views: 6132

Answers (3)

Rob
Rob

Reputation: 11

I had a similar problem, had also selected the check box for propagating, but then found this

Passing parameters to sub-jobs

In structured applications a Job can call another Job and it's necessary to transmit parameters to sub-jobs. In Talend Open Studio this task is easy. When you create a sub job (that is a job who calls another job) simply click its Component tab and make sure Transmit whole context is checked.

Note that the Component Tag exists in the parent JOB.

I found the solution here http://www.robertomarchetto.com/how_to_parameter_values_talend_job_command_line

Worked for me.

Rob

Upvotes: 1

Governator
Governator

Reputation: 11

If you have groups of contexts such as DEV,UAT,PROD etc you can set this param inside your shell script - so if you wanted PROD you would add this param to your shell

--context=PROD

This will load your PROD parameters from your PROD context properties file, on each build we have modified all our shell scripts to add a check to determine what environment it's on and then passes in the correct context.

Upvotes: 1

ydaetskcoR
ydaetskcoR

Reputation: 56849

It may be easier to use Implicit context load under Job Settings in the Project Settings.

Here you can define a file (such as a CSV) of environment parameters such as connection settings and as long as they share the same file path you can then just put the different context variables in the file on the different environments and have Talend load them as part of the job.

Now when you run the job it should use the environment specific context variables as they are loaded from the file.

Upvotes: 2

Related Questions