How to get last Successful end date of job in variable

Seven Stars

How to get last Successful end date of job in variable

Hi,

I want to retrieve the end date of my job if the execution is completed successfully in a variable.

I tried to do that but it doesn't work

b.PNGa.PNG

Best regards !


Accepted Solutions
Forteen Stars

Re: How to get last Successful end date of job in variable

all there

 

@vapukov wrote:

You not explain Your error, but at least:

message not always "success", it could be null, and it will return NULL pointer error for equals

 

 

so You need at least add compare with null

!message==null && message.equals("success")

 

Check for null always - first

-----------

All Replies
Forteen Stars

Re: How to get last Successful end date of job in variable

You can use tPostJob and

TalendDate.getDate("yyyy-MM-dd hh:mm:ss") 

 or You can use same in tJavaRow

 

Screen Shot 2017-05-29 at 11.48.49 PM.png

 

Starting job endDT at 23:48 29/05/2017.

[statistics] connecting to socket on port 3490
[statistics] connected
2017-05-29 23:48:42
[statistics] disconnected
Job endDT ended at 23:48 29/05/2017. [exit code=0]

 

-----------
Seven Stars

Re: How to get last Successful end date of job in variable

Yes it allows to get the execution date but I need a condition to see if the job is successfully completed or not. If successfully I record the end date of execution in a variable.

Forteen Stars

Re: How to get last Successful end date of job in variable

You not explain Your error, but at least:

message not always "success", it could be null, and it will return NULL pointer error for equals

Screen Shot 2017-05-30 at 12.54.32 AM.png

 

so You need at least add compare with null

meesage!=null && message.equals("success")

 

second - stat catcher - lat component (last from last) if You try to check Job finish, so - where You plan use variable if nothing run after?

 

-----------
Seven Stars

Re: How to get last Successful end date of job in variable

Here is my job : 

job.PNG

Last_Date_Out : contains last execution date than i get this date to filter my files tike this :

job1.PNG

This job works but I need a test to check that the last execution date is made following a success. Because my job is going to be run every night automatically so I need to resume the error if there ever was an interruption.

Forteen Stars

Re: How to get last Successful end date of job in variable

I think You need connect tStatCatcher just to tlogrow (or direct to csv)

and this is give You ideas - what to check

 

You must handle nulls exactly

 

see for picture above

 

BUT!!!

 

in Your case - think it not help!

 

because - stat catcher catch begin and end ... and what if error (not success) after 30 minutes of Your long Job?

what You will catch? time will be wrong

-----------
Seven Stars

Re: How to get last Successful end date of job in variable

Yes exactly i agree with you, for this reason I used tjavarow at the beginning to get the end date of execution if the message = success and therefore if not we start the job manually the next day after having had an email or a notification of the error...

Forteen Stars

Re: How to get last Successful end date of job in variable

so, add null check before equals - and it must work without error

think - not proper, but at least without errors :-)

-----------
Seven Stars

Re: How to get last Successful end date of job in variable

T get this error : 

e1.PNGe2.PNG

Forteen Stars

Re: How to get last Successful end date of job in variable

do You have output_row? add tLogRow after tJavaRow

 

 

-----------
Seven Stars

Re: How to get last Successful end date of job in variable

job.PNGjob1.PNG

Forteen Stars

Re: How to get last Successful end date of job in variable

read above - CHECK NULLS! :-)

-----------
Highlighted
Seven Stars

Re: How to get last Successful end date of job in variable

Sorry for the question but I thought I should add .equal("null")in tjavarow as the figure above if it is not so where i check ?

Forteen Stars

Re: How to get last Successful end date of job in variable

all there

 

@vapukov wrote:

You not explain Your error, but at least:

message not always "success", it could be null, and it will return NULL pointer error for equals

 

 

so You need at least add compare with null

!message==null && message.equals("success")

 

Check for null always - first

-----------
Seven Stars

Re: How to get last Successful end date of job in variable

Thank you for your explanations Smiley Happy

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download