Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
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 &
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
@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())
tFileOuputExcel is the output file that the name needs to be changed each time the scheduled job runs.
please help.
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"
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.
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"
Thanks for this.
where in the talend open studio do i input the code. i.e
TalendDate.getCurrentDate("yyyyMMddHHmmssSSS")+"_" + pid + "_" + "your readable name.xlsx"