Five Stars

TALEND JOB SCHEDULING

Hi,

I would like to know how to go about scheduling a job on Talend using the open source studio.

The job would run periodically. i.e i want Talend to run automatically at a particular time scheduled.

 

Kindly assist with the steps to take.

 

Thanks.

11 REPLIES
Nine Stars

Re: TALEND JOB SCHEDULING

For community version, you could export the job as standalone program and make a schedule from window task scheduler. 

Reference - https://www.talendbyexample.com/talend-job-deployment-reference.html

Nine Stars

Re: TALEND JOB SCHEDULING

Check this:
https://community.talend.com/t5/Migration-Configuration-and/Exporting-a-Job-script-and-executing-it-...

 

The job you want to schedule, trigger it from like crontab or a different scheduler.

if you want to pass on parameters you have to define context variables in this particular job... cronEndDate and cronStartDate

From (unix) command line you could run it like this in background and return to prompt, redirect stdout and errors to a log file.

 

nohup sh CRONTAB_TALENDJOBS_run.sh --context_param cronStartDate='2018-07-10' --context_param cronEndDate='2018-07-12' > /data/log/CRON.log 2>&1 </dev/null &

 

Five Stars

Re: TALEND JOB SCHEDULING

Thank you very much. It works.

 

But the how do i change the output file name for every time the job runs?

Remember we cannot generate two output files with the names.

 

Please help. Thanks

 

Nine Stars

Re: TALEND JOB SCHEDULING

@daescada - what kind of output file?

Just for illustration purpose let's take an example using tJava.

You derive with your logic on what filename you would like to achieve using Java code and assign the same to global variable - 

globalMap.put("NewFilename", <derived filename>);

And then in your subsequent tFileOutputXXXXX component reuse this variable as the filename using this expression:

((String)globalMap.get("NewFilename"))

Ex: to get current date timestamp you could use this code and then append the same to your filename prefix/suffix if any:

TalendDate.formatDate("yyyyMMddHHmmss",TalendDate.getCurrentDate())
Five Stars

Re: TALEND JOB SCHEDULING

tFileOuputExcel is the output file that the name needs to be changed each time the scheduled job runs.

 

please help.

Nine Stars

Re: TALEND JOB SCHEDULING

A fairly simple scenario explained - 

Have a global variable using tSetGlobalVar, use the same in tJavaRow to put your dynamic excel filename using your required logic. Once done use the same global variable in tFileOutputExcel component "File Name"

tSetGlobalVar-1.JPGtSetGlobalVar-2.JPGtSetGlobalVar-3.JPG

Nine Stars

Re: TALEND JOB SCHEDULING

Easy.... tFileOuputExcel where you put the file name make sure you add pid variable to its name:

TalendDate.getCurrentDate("yyyyMMddHHmmssSSS")+"_" + pid + "_" + "your readable name.xlsx"

pid = process id, is also used in logging components like tLogCatcher.

I always put this in my dynamic file generation so I can simply find corresponding files, think about clearing / archiving ... finding corresponding files by date-time is a mess when running your job x times.

 

 

 

Six Stars

Re: TALEND JOB SCHEDULING

If date/time is not sufficiently unique, you can use java.util.UUID. Something like this:

 

java.util.UUID.randomUUID().toString() + "_your_readable_name.xlsx"
Five Stars

Re: TALEND JOB SCHEDULING

Thanks for this.

where in the talend open studio do i input the  code. i.e 

 

TalendDate.getCurrentDate("yyyyMMddHHmmssSSS")+"_" + pid + "_" + "your readable name.xlsx"

 

 

Nine Stars

Re: TALEND JOB SCHEDULING

look for "File Name" property in tFileOutputExcel component, that is where you put your configurable code.

Five Stars

Re: TALEND JOB SCHEDULING

Where would the destination file path now be?