tLogCatcher not catching child job errors - talend

tLogCatcher is not catching errors coming from a child job.
When a job is run it'll show all of the error messages coming from a child job in the Run Window, but it is not catched by tLogCatcher to email.
If we don't loop the child job, tLogCatcher is catching all error messages and emailing. Is there another way to do this kind of loop, so tLogCather can the error message or is there something in my loop that I need to include?
This is a master job:
tjava--->tloop--->tJavaflex--->tJava--->tRunjob--->tjava
NOTE: tRunjob has Die on child error and Use an independent process to run subjob selected
This is a child job:
tPrejob--->tRestclient--->tjson--->tSetGlobalvar
NOTE: tRestclient and tJson have Die on error selected

We have a tLogCatcher in each and every one of our jobs as a way to catch all child errors the tLogCatcher itself is then linked to a logger Job.

Even with tLogCather we will catch error like Child job has failed to run, but not exact error occured in child job.
To get the exact error occurred in child job.
tRunJob---OnSubJobError--->tjava
in tJava System.out.println(((String)globalMap.get("tRunJob_1_CHILD_EXCEPTION_STACKTRACE")));
then you can get exact error you got in child job.
I hope this will be helpful for you..!!!

Related

is there a way to disable a mega-detailed error message in Rundeck's failed executions?

The message that is posted every time an execution fails is too verbose and creates too much noise. Is there a way to disable or hide it somehow? We have our own error messages within the scripts and don't need a red chunk of extra text displayed in the logs. Adding an error handler that will exit with code 0 is not an option because we still need the job to fail if a step fails.
That message is Rundeck standard output in case of failure (you can manipulate the loglevel but that doesn't affect the NonZeroResultCode last line, just the text from your commands/scripts), you can suggest that here. The rest are just workarounds as you mentioned.
This occurs even using the Quiet output.

Ignore a specific error to display in azure pipeline

My pipeline exits with error code 1 once it completes, though I want to do it but I don't want to get that error message displayed in the error section of pipeline GUI.
Like we use [##vso task.logissue type-error] to get a error message displayed ..can I have something similar to ignore a error code from getting displayed but at the same time my pipeline should exit.

Abort second job activity if first one aborts

I want abort 2nd job activity if 1st job activity aborts due env. issue or manual abortion.
I gone through the triggering option but couldn't get.
Can anyone help me ?
OK, You can't abort a job without running it. So you would need to be able to invoke Job 2 with knowledge of Job 1 status (e.g. from activity variable Job1.$JobStatus). This could be used to cause Job 2 to abort.
The cleanest solution would be a before-job subroutine, which sets its return code to 0 if Job 1's status was DSJS.RUNOK or DSJS.RUNWARN (these are DataStage constants), or to a non-zero value if Job 1's status was DSJS.RUNFATAL or any other value. This is the cleanest approach because the before-job subroutine could write a message to the job log indicating precisely why the job was being aborted.
A less clean way would be to have a parameter in Job 2 of type, say, Integer (anything other than string), and set its value in the Job Activity using an expression such as If Job1.$JobStatus = DSJS.RUNFATAL Then "" Else 1 - setting a non-string parameter to "" will cause the job to abort with DSJE.PARAMBADVALUE error.
You will need to show us exactly what you did. The use of trigger, which I explained earlier, is the correct solution. If you did it correctly, the arrow on the design canvas should be red.
Alternatively you could change your sequence to bypass Job 2 entirely, and instead simply log a message that Job 2 was being bypassed because Job 1 aborted.

Talend ETL - running child job in tLoop

I am trying to run a child job in tLoop. The child job connects to salesforce and downloads "Account" object to local SQL Server table. There are problems with connection to Salesforce, it takes few attempts to connect. Hence, I put the connection stuff in child job and now trying to call the child job in a loop. Below is the image of my parent job.
As you can see in image the tRunJob_1 has error because of Salesforce connection problem in child job. This is correct behaviour.
The setRetryConnect that is connected to OnComponentError has this code: context.retryConnect = true;
The setRetryConnect that is connected to OnComponentOk has this code: context.retryConnect = false;
So, I am tripping this context variable depending on whether child job succeeds or fails.
My tLoop looks as below:
I want the tLoop to run as many times till the condition remains true. That is till the time it continues to error out. However, it just iterates once and then stops. Could anyone please let me know what correction need to be done here to make the tLoop work?
I couldn't re-pro your issue with SalesForce but by looking at your job what I feel is that when you say - "it just iterates once and then stops" is the expected behavior.
As per your job flow after the tRunJob you are using OnComponentOk/OnComponentError trigger which would process and stop the job run as it would have completed the job execution. What it would have ideal was to keep everything in a subjob post tLoop so that it will iterate till the condition is met.
Sample job for explanation -
Here used tSetGlobalVar to define a global variable (in place of your context variable). Then use the globalMap variable as ((Boolean)globalMap.get("tLoop")) in your "Condition" for the tLoop.
And then finally run some code in the tJava component that does something and conditionally sets the global variable to false to mark the ending of loop.
tRunJob provides an Return Code ((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"))
If you're running your child Job a number of times and want your Job to exit with non-Zero if one of these iterations fails, then after each iteration, you should test this return code and store it in your own globalMap Object if it is non-zero
int returnCode = ((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"));
if (returnCode > 0) {
globalMap.put("tLoop", false);
}
else {
System.out.println(returnCode);
};
Found the answer myself, posting it here so that it may help others. It appears like OnComponentError breaks the tLoop. Disabled the OnComponentError flow and un-checked the 'Die on Child Error' checkbox in tRunJob.
The tLoop remains as it is. No changes here.
The retryConnect will use the below code. It uses CHILD_RETURN_CODE to check whether the child job threw error. In case of success, its value is 0. I am tripping the variable when the child job succeeds, so the loop will stop. As you can see, the tLoop shows 2 iterations, it is working as expected now. Thanks.

How to delete execution in camunda workflow

What we want to do is to remove the created jobs when one event is triggered.
We did this with:
wfManagementService.deleteJob(job.getId());
We found this can remove the jobs (Table: camunda.act_ru_job) successfully, but the related executions are still there in table camunda.act_ru_execution.
We tried to call remove() from ExecutionEntity:
Execution execution = wfRuntimeService.createExecutionQuery().executionId(executionId).singleResult();
((ExecutionEntity)execution).remove();
However, it will get NullPointerException on doing so.
java.lang.NullPointerException
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.isExecutionTreePr efetchEnabled(ExecutionEntity.java:810)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.ensureParentInitialized(ExecutionEntity.java:1057)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.remove(ExecutionEntity.java:1154)
Does anyone know how remove the runtime execution?
Thanks!