Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I got to know that we can rerun failed jobs by going through Talend community discussions. However, I did not get how to implement this. Can anyone guide me doing this?
Thanks in advance,
Meghana.
You could use a tLoop. This is very simple to do, but you have to be precise with how you implement it and will have to think about the possibility of continuous loops. A screenshot of my example job can be seen below...
The code in the tJava_1 is below....
globalMap.put("loop", true);
The tLoop is configured with a While loop which has this code in the condition...
((Boolean)globalMap.get("loop"))
The tRunJob is configured NOT to die on child error.
The RunIf is configured with this code....
((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"))==0
The tJava_2 is configured with this code....
globalMap.put("loop", false);
Essentially what I am doing is setting the tRunJob to keep running until it finishes with a return code of 0 (success). You will have to keep in mind that this (as I have shown you) will keep trying forever. To limit the number of retries you could alter the tLoop to be based on the success boolean AND a count of tries.
@MeghanaKottala,you can restart from the node in TAC.
Sorry, I did not get u.
I have my parent where I included some child jobs. I will push my parent job to Talend cloud. I want my child job to re start automatically when it fails.
I have gone through discussions and came to know that we can do this using child job return code value. But I do not know how to implement this in my job.
Thanks.
You could use a tLoop. This is very simple to do, but you have to be precise with how you implement it and will have to think about the possibility of continuous loops. A screenshot of my example job can be seen below...
The code in the tJava_1 is below....
globalMap.put("loop", true);
The tLoop is configured with a While loop which has this code in the condition...
((Boolean)globalMap.get("loop"))
The tRunJob is configured NOT to die on child error.
The RunIf is configured with this code....
((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"))==0
The tJava_2 is configured with this code....
globalMap.put("loop", false);
Essentially what I am doing is setting the tRunJob to keep running until it finishes with a return code of 0 (success). You will have to keep in mind that this (as I have shown you) will keep trying forever. To limit the number of retries you could alter the tLoop to be based on the success boolean AND a count of tries.
Thanks..!!!!
It's working.
Thanks,
Meghana.