Talend tRunJob CHILD_EXCEPTION_STACKTRACE is empty - talend

I'm trying to catch the error message raised inside a tRunJob subjob. The job tree is minimal:
Main_Job -- execute a subjob and catch the output
> Sub_Job -- do some stuff and can raise an error.
For a test I try to raise an error but the stack trace is empty.
The jobs are made this way:
The Sub_Job contains a tDie to raise the error;
I need to get the error message in the Main_Job, possibly the stack trace, so after the tRunJob I handle the error with a tJava;
The tJava use globalMap to get the stack trace, as following:
System.out.println(
"myLog --->> "+ ((String)globalMap.get("tRunJob_1_ERROR_MESSAGE")));
System.out.println(
"myLog --->> "+ (String)globalMap.get("tRunJob_1_CHILD_EXCEPTION_STACKTRACE")));
The output on console is flat: generic error message and no stack:
myLog --->> Child job running failed.
myLog --->>
[statistics] disconnected
I want CHILD_EXCEPTION_STACKTRACE value, but for a tRunJob seems to be empty. Is there any option I don't see? Have I to load manually the stack trace, from inside Sub_Job? How?
Below are the simple Main_Job and Sub_Job:
Thanks

Related

Argument does not begin with '--' error while executing Apache Beam WordCount example from Eclipse in java

I'm trying to execute the example WordCount(Java code) from Eclipse as specified in
https://cloud.google.com/dataflow/docs/quickstarts/quickstart-java-eclipse#run-the-wordcount-example-pipeline-on-the-cloud-dataflow-service
While executing through RunConfiguration, getting below error in Eclipse console.
Exception in thread "main" java.lang.IllegalArgumentException: Argument '-output=gs://bucket-for-beam/stage-folder/output-file-prefix' does not begin with '--'
at org.apache.beam.repackaged.beam_sdks_java_core.com.google.common.base.Preconditions.checkArgument(Preconditions.java:191)
at org.apache.beam.sdk.option[s.PipelineOptionsFactory.parseCommandLine(PipelineOptionsFactory.java:1423)
at org.apache.beam.sdk.options.PipelineOptionsFactory.access$200(PipelineOptionsFactory.java:110)
at org.apache.beam.sdk.options.PipelineOptionsFactory$Builder.as(PipelineOptionsFactory.java:294)
at com.gcp.dataflow.examples.WordCount.main(WordCount.java:190)][1]
I've created a bucket, named 'bucket-for-beam' folder,named 'stage-folder':
- and -- are different. You have specified the first one on the arguments tab. It expects the second one.
For me it was due to a space in between the different option of the commands

Catch Block for Insert Trigger Not Firing for Error Launching SSA Job

I'm setting up an AFTER INSERT trigger to launch an SSA job which executes a SSIS package to report on an ETL log file after its process completes. The syntax for the TRY...CATCH block appears correct but the error handling doesn't work for the error code when it detects the SSA job it's told to launch is already running.
The trigger is for a user table in a SQL Server 2012 SP4 instance (with SQL 2012 (110) compatibility). I tried handling the one error (#22022) for a SQL job already running but it seems that you can't error trap the execution of a system stored procedure.
CREATE TRIGGER InterfaceSupport.trg_XMLTrigger_Insert
ON [InterfaceSupport].[XMLLogReaderTriggers]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRY
EXEC msdb.dbo.sp_start_job 'Launch job'
END TRY
BEGIN CATCH
IF ERROR_NUMBER()=22022 --Job already running
EXEC msdb.dbo.sp_send_dbmail NULL,'name#domain.org',NULL,NULL,'Interface XML Log Reader Already Running','The SSA Job reading Interface logs is already running. The job will attempt to catch the new request at the end of the current cycle.'
ELSE
BEGIN
DECLARE #Errormsg nvarchar(max)
SELECT #Errormsg=ERROR_MESSAGE()
EXEC msdb.dbo.sp_send_dbmail NULL,'name#domain.org',NULL,NULL,'Interface XML Log Reader Spawn Error',#Errormsg
END
END CATCH
END
GO
I'm getting the following error despite the error handling block. It's as if the CATCH block is non-existent.
Msg 22022, LeveSQLServerAgent Error: Request to run job Launch Job (from User xxx) refused because the job is already running from a request by User xxx. l 16, State 1, Line 17
This error can't be caught by TRY/CATCH unfortunately.
You should check if the job is running and start only if it's not, although the job might start in between the check and the EXEC statement.
DECLARE #JobID UNIQUEIDENTIFIER = (SELECT job_id FROM msdb.dbo.sysjobs AS J WHERE J.name = 'Launch job')
IF NOT EXISTS (
SELECT
'job is running'
FROM
msdb.dbo.sysjobactivity ja
INNER JOIN msdb.dbo.sysjobs j ON ja.job_id = j.job_id
WHERE
ja.session_id = (SELECT TOP 1 session_id FROM msdb.dbo.syssessions ORDER BY agent_start_date DESC) AND
ja.start_execution_date is not null AND
ja.stop_execution_date is null AND
ja.job_id = #JobID
)
BEGIN
EXEC msdb.dbo.sp_start_job #job_name = 'Launch job'
END
ELSE
BEGIN
EXEC msdb.dbo.sp_send_dbmail NULL,'name#domain.org',NULL,NULL,'Interface XML Log Reader Already Running','The SSA Job reading Interface logs is already running. The job will attempt to catch the new request at the end of the current cycle.'
END

How to manipulate the status of current job-execution from inside of an inline script?

The following code returns an error to rundeck.
#!/bin/bash
exit -1
And rundeck decides how to deal with it by running the next step or changing the execution "status" to "failed".
I would like to modify the status directly by inline script to support more than 2 states. I need "succeeded", "failed" and "nodata" to express that the data are missing.
Is there a way to express this?
There is none. Just like bash can return zero or non-zero
One possible alternative is raise an exception with message nodata and exit with non-zero code. Rundeck will mark this job as fail with NonZeroResultCode error. You should be able to get your error message nodata with ${result.message}

Powershell unexpected behavior of uncaught exception inside a catch block

The following powershell script produce a very unexcepted output:
try {
throw "some exception"
echo "check point"
}
catch
{
echo "catch"
throw "some other exception"
exit(-1)
}
echo "finish"
output:
catch
finish
I would except the script to exit either by the uncaught exception throw "some exception" and for the script not reach finish.
Even if Powershell is set to continue after uncaught exception, I would expect it to execute exit(-1) and never reach finish.
Can anyone explain this behavior?
exit(-1) is unreachable because the previous line, throw "some other exception", throws an exception which bypasses the rest of the block.
I see "finish" being reached in two cases:
As Bacon Bits said, when $ErrorActionPreference is set to "SilentlyContinue".
The code is pasted into the interactive shell (as opposed to run from a .ps1 file), in which case it runs the final line as a manual command.

When popen performs status check on service that dosen't exist error no results returned

I am attempting to use subprocess.Popen() to read a service status.
If I get an unrecognized service error the value, while printed to the screen, is not saved to out or err for later viewing.
If the service does exist, "is running" gets saved to the out value. I would like to accomplish the same results when the unrecognized error is encountered.
I have tried using subprocess.check_output but it is unrecognized.
If I use an existing service it works as desired.
My code:
p = subprocess.Popen(['service','PretendService','status'], stdout=subprocess.PIPE)
out,err = p.communicate()
You need to pipe stderr as well as stdout:
p = subprocess.Popen(['service','PretendService','status'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out,err = p.communicate()
# Now err will have your error message