Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How do I get job specific logs? (Beginner)

Hello everyone,

I am a beginner in Talend, I currently work on Talend Open Studio for Data Integration.

 

I need to get all informations from my job / subjob and insert them into a table:

JOB_NAME character # Job Name
LOAD_TYPE character # Loading status (Insert / Update)
STATUS character # Job status / under job (OK / KO)
JOB_STIME date # Start date of job / subjob
JOB_ETIME date # End date of job / subjob

 

I managed to get the JOB_NAME thanks to a tMap connected to the tLogCatcher (field : job) but I do not know how to get the other fields despite my research.

In thanking you and apologizing for this trivial question for Talend experts.

 

Regards

Labels (1)
22 Replies
Anonymous
Not applicable
Author

Ok well, is it this mapping which i must do ? (Joined in my message)

1  : Input database

2 : Output database 

tPostgresqlOutput_5 : Output log database 

 

And I put in the tJava : 

((Integer)globalMap.get("2_NB_LINE_INSERTED"));

 

i'm not sure of the name of my component, where can I see it ? Because "2" is an alias I think and when i put 2 in the formula, it doesn't work. 

 Thank you


2017-09-19_123849.jpg
Anonymous
Not applicable
Author

To get the name of the component, click on it and you will see it in brackets in the Component tab.

Anonymous
Not applicable
Author

Yes but in my case the name of my table in brackets, doesn't work with the formula : 

 

((Integer)globalMap.get("fact_table_NB_LINE_INSERTED"))

 

 

Anonymous
Not applicable
Author

Click on your output component and take a screen shot of your component tab. Then post it.

Anonymous
Not applicable
Author

Join in my message. 

Thank you


2017-09-19_152537.jpg
Anonymous
Not applicable
Author

You need to use....

 

((Integer)globalMap.get("tPostgresqlOutput_1_NB_LINE_INSERTED"))

Anonymous
Not applicable
Author

YEAAAAAAAH, it's work 0683p000009MACn.png

 

Last question : 

I would like to run my job in function of the last return status. 

For exemple, in my AMC table, my last job finished with "success" status, so I can run another time my job. 

But when my last status is "failed", I would like to "block" the launching and inform the users. 

 

Best regards

Anonymous
Not applicable
Author

This is easy. Just query your database for the last status. The use the value to decide what to do.

 

Connect your database component to a tFlowToIterate. The tFlowToIterate will produce a globalMap variable holding your status data returned from your query. It will be in the format....

 

((String)globalMap.get("row.column"))

 

Please note "row.column" refers to the name of the row feeding the tFlowToIterate and the name of the column holding the status value. This will need to be changed accordingly. 

From the tFlowToIterate use RunIf connectors to join to a component to inform your users that it cannot be run (maybe a tJava with a System.out command) and to the start component of this job. In the success link use logic like this....

 

((String)globalMap.get("row.column")).compareToIgnoreCase("success")==0

 

....in the failed link use logic like this.....

 

((String)globalMap.get("row.column")).compareToIgnoreCase("failed")==0

 

Then, when you run the job it will check the result of your last run and if it was a success, it will run the main body of the job. If it was a failure it will run the mechanism to to inform of an issue

 

Anonymous
Not applicable
Author

Ok perfect, I will check that later. 

 

Concerning my previous question, how can I get the PID in a tFixedFlowInput ? 

Is there a standard variable to get it ? 

 

Thank you 0683p000009MACn.png

Anonymous
Not applicable
Author

You can get the PID from any Talend job using the variable pid. In a tJava component you can print it out to the output using the following code....

 

System.out.println("My PID is "+pid);