Question

Send messages to terminal when batch processing from command line

  • 16 August 2016
  • 2 replies
  • 1 view

Badge

Hi all,

We're batch processing a lot of sqlplus commands and FME Workspaces (with parameters). However, the FME Workspaces only say "failed" or "success" and I would like them to talk more ;-)

Like reporting "1034 records written"

Is there a way to send a message from the workspace to the terminal / dos prompt?

It doesn't have to be a customized message per se, it could also be a relevant portion of the log (only the part where it displays the amount of records read/written?).

Best wishes, Annet


2 replies

Userlevel 4

You can use the Python shutdown script for this. Example:

import fme
if fme.status:
    print "%s records written" % fme.totalFeaturesWritten
else:
    print "Workspace FAILED"

This works because Python print statements goes to STDOUT by default, which would be the command window when FME is invoked from the command line. If the workspace is executed from within FME Workbench, the print statements will be sent to the log window.

Documentation for the fme module function variables: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Workbench/Configuration/FME_END_PYTHON.htm

Badge

You can use the Python shutdown script for this. Example:

import fme
if fme.status:
    print "%s records written" % fme.totalFeaturesWritten
else:
    print "Workspace FAILED"

This works because Python print statements goes to STDOUT by default, which would be the command window when FME is invoked from the command line. If the workspace is executed from within FME Workbench, the print statements will be sent to the log window.

Documentation for the fme module function variables: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Workbench/Configuration/FME_END_PYTHON.htm

Works like a charm! Thanks so much @david_r

Reply