Run a Job daily, a job monthly and a job weekly

Five Stars

Run a Job daily, a job monthly and a job weekly

Dear all, i have a Job which send a flow daily, a flow every week and a flow every month. 

actually i have divided the job in 3 jobs as they are different, but they have the same DB of input (what changes is the period of exctraction in the starting query DB2).

i would like to find a way to Run the Job daily and the system have to understand alone to run also the weekly job 1 times a week and the job monthly 1 time a month.

how can i make it in the same Job?

thanks in advance

Forteen Stars TRF
Forteen Stars

Re: Run a Job daily, a job monthly and a job weekly

You may have 2 context variables (weekly and monthly) updated at each runtime.

The weekly variable starts with the value of 1 and is incremented at each runtime.

When it is equal to 1, the weekly job starts.

When it is equal to 7, it is reset to 1 (for next runtime).

Same for monthly variable with the interval of 1 to 31 (1 to 4 with increment when the weekly job is launched).

 

See this link for an example of how to change a context variable at runtime and save it for next runtime https://community.talend.com/t5/Design-and-Development/Retain-value-of-sequence-generator/m-p/120064


TRF
Five Stars

Re: Run a Job daily, a job monthly and a job weekly

i understand the concept of sequence (from 1 to 7 for the week and from 1 to 31 for the month) but in sequence, what components i have to use? and how i can create the sequence?

Forteen Stars TRF
Forteen Stars

Re: Run a Job daily, a job monthly and a job weekly

You don't need a sequence as it cannot persist from one execution to another as it's a in memory variable.

What you need is a context variable you can store somewhere.

You get it at job startup, you change its value (+1 or reset to 1), and you store it into your context file (see the link).


TRF