Skip to main content
Question

Extract message from the terminator. Is it possible?


gio
Contributor
Forum|alt.badge.img+15
  • Contributor

Is it possible and how would I do that?

11 replies

david_r
Celebrity
  • November 16, 2018

Extract from where? The message normally appears in the log file.


danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • November 16, 2018
david_r wrote:

Extract from where? The message normally appears in the log file.

@david_r I believe the message from transformer:


gio
Contributor
Forum|alt.badge.img+15
  • Author
  • Contributor
  • November 16, 2018

@david_r

 

I meant the message one sets in the terminator, can it be extracted?

The message appears when terminated. Can I acces it?

 

I tried some of your earlier sugestions and @takashi's log extractor python scripts , but can't get at the message from the terminator.

 

 


david_r
Celebrity
  • November 16, 2018
gio wrote:

@david_r

 

I meant the message one sets in the terminator, can it be extracted?

The message appears when terminated. Can I acces it?

 

I tried some of your earlier sugestions and @takashi's log extractor python scripts , but can't get at the message from the terminator.

 

 

Sorry if my question wasn't clear enough: where would you like to access the error message from? The shutdown script? A PythonCaller? Some external program?


david_r
Celebrity
  • November 16, 2018

This will let you access the Terminator message in the shutdown script.

Copy the following into the startup script:

import fmeobjects

global TERMINATOR_MESSAGE
TERMINATOR_MESSAGE = None

terminator_prefix = "Termination Message: '"

def log_callback(severity, message):
  Â  global TERMINATOR_MESSAGE
  Â  pos = message.find(terminator_prefix)
  Â  if pos > -1 and severity > 1:
  Â  Â  Â  TERMINATOR_MESSAGE = message[pos+len(terminator_prefix):-1]

fmeobjects.FMELogFile().setCallBack(log_callback)

This demonstrates how to test for the Terminator in the shutdown script:

global TERMINATOR_MESSAGE

if TERMINATOR_MESSAGE:
  Â  print TERMINATOR_MESSAGE
else:
  Â  print "All is well"

Does this help?


david_r
Celebrity
  • November 16, 2018
david_r wrote:

This will let you access the Terminator message in the shutdown script.

Copy the following into the startup script:

import fmeobjects

global TERMINATOR_MESSAGE
TERMINATOR_MESSAGE = None

terminator_prefix = "Termination Message: '"

def log_callback(severity, message):
  Â  global TERMINATOR_MESSAGE
  Â  pos = message.find(terminator_prefix)
  Â  if pos > -1 and severity > 1:
  Â  Â  Â  TERMINATOR_MESSAGE = message[pos+len(terminator_prefix):-1]

fmeobjects.FMELogFile().setCallBack(log_callback)

This demonstrates how to test for the Terminator in the shutdown script:

global TERMINATOR_MESSAGE

if TERMINATOR_MESSAGE:
  Â  print TERMINATOR_MESSAGE
else:
  Â  print "All is well"

Does this help?

Hi @NatalieAtSafe, any news regarding the semi-random "Â" characters in code blocks?


gio
Contributor
Forum|alt.badge.img+15
  • Author
  • Contributor
  • November 16, 2018

@david_r

 

Thanks, for the sample.

I was trying to directly access the message in the workbench and mail to in case of bad results.

Seems I still have to post process my log file as usual.

 

Would be nice to have an output port on the terminator like the logger. So ne can embed it in between those scripts with 2 callers.

 

Basically it seems I cant do what I had in mind, yes?

 


mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • November 16, 2018
david_r wrote:

Hi @NatalieAtSafe, any news regarding the semi-random "Â" characters in code blocks?

Not yet, sorry.


mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • November 16, 2018

What you could do is add an AttributeCreator/Emailer just before the Terminator. Set the message and send out an email before anything gets terminated. And then you don't need to even set the message in the Terminator - just use the attribute in which you defined the message.

 

The nice thing then is that you can copy the Terminator anywhere in a workspace, and it will work fine, provided you use the same attribute name throughout.


david_r
Celebrity
  • November 18, 2018
gio wrote:

@david_r

 

Thanks, for the sample.

I was trying to directly access the message in the workbench and mail to in case of bad results.

Seems I still have to post process my log file as usual.

 

Would be nice to have an output port on the terminator like the logger. So ne can embed it in between those scripts with 2 callers.

 

Basically it seems I cant do what I had in mind, yes?

 

You could do what @Mark2AtSafe suggested and embed it into a custom "gioTerminator" transfomer.


gio
Contributor
Forum|alt.badge.img+15
  • Author
  • Contributor
  • November 19, 2018

@david_r, @Mark2AtSafe and all others.

 

Tx for the answers.

I don't know about the "gio terminator" though...sounds dangerous to me..;0

 

Yes, ill simply use a creator to create a message and e-mail it (usually we do that trough batches). So I probably won't be using the terminator.

 

 

Greetz.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings