Four Stars

Restart Job if error

I have a job where sometimes a database error occurs: "Java.sql.SQLException: Could not do a physical-order read to fetch next row." I need, whenever this error occurs, to restart the job, but I do not know how to do it in a simple way. Is there any form or component that does this? Thanks a lot for the help.
  • Data Integration
1 ACCEPTED SOLUTION

Accepted Solutions
Seven Stars TRF
Seven Stars

Re: Restart Job if error

Hi,

Using Community (TOS) or Entreprise version?

If Community version, maybe having a parent job then, depending on the child job return code, the parent could decide to start the child again.

In such a case, you also need to limit the max number of retry.

If Enterprise version, you should have a look to this document.


TRF
4 REPLIES
Seven Stars TRF
Seven Stars

Re: Restart Job if error

Hi,

Using Community (TOS) or Entreprise version?

If Community version, maybe having a parent job then, depending on the child job return code, the parent could decide to start the child again.

In such a case, you also need to limit the max number of retry.

If Enterprise version, you should have a look to this document.


TRF
Ten Stars

Re: Restart Job if error

The easiest way to implement this is to keep a log table of all of your jobs. Assume that each run of a job is considered a "batch". Assign a batch number to all of your tables. Now on completion (or failure) of a job you assign a success or failure stamp on the log table for the batch. You can set a variety of statuses depending on the functionality you require. Then, if you want to rerun a batch, your back-end DB will see the batch has already tried to run and you will be able to use the logged data to see how far you got. If you have a series a of stage tables (table1, table2, table3) to move your data through, you can use your log to work out which table you got to and the last one you successfully completed. You can then delete any data that got added to your next (incomplete) table and start the process from there. This means that you do not have to re-run so much and you can safely restart in the middle of a process.

 

This is a very high level description, but is entirely possible with all varieties of Talend.

Rilhia Solutions
Six Stars

Re: Restart Job if error

Hi,

you can use tloop functionality in Open Studio 

1. create a context variable as integer set the default value to 2

2. under tloop use this variable for To

3. Create a flow tloop -> trunjob

4. From trunjob onsubjob error use tjava to increment the number

5. once it is successful set the context variable to zero using tjava So that it will come out of the loop.

 

Four Stars

Re: Restart Job if error

Thanks a lot for the help, all these options are good and I will test them all.