I have a c# application that runs fme translation but how can I know if the translation was successfully or not?
How does your code run the FME translation? Using the .NET IFMEOWorkspaceRunner interface, or by any other method?
How does your code run the FME translation? Using the .NET IFMEOWorkspaceRunner interface, or by any other method?
In case is needed this is the code I use for open a process, pass the arguments and run fme.
ProcessStartInfo info = new ProcessStartInfo;
info.Arguments = "/C fme.exe " + workspace + " --BName " + BNameFix + " --BType " + BType + " --DB " + DB + " --Schema " + Schema + " --DName " + DName + " --DestDataset_ACAD " + "\\"";
info.FileName = "fme.exe";
Process.Start (info);
The simplest solution is probably to use the Process.ExitCode property:
There may be some cases where this won't work, however, and if so you'll probably have to scan the FME log file and look for either string (I recommend case sensitive):
Translation was SUCCESSFUL
or
Translation FAILED
The simplest solution is probably to use the Process.ExitCode property:
There may be some cases where this won't work, however, and if so you'll probably have to scan the FME log file and look for either string (I recommend case sensitive):
Translation was SUCCESSFUL
or
Translation FAILED
You can also use the workspace shutdown script to write out the translation status.
Sample Python shutdown script that will write either "SUCCESS" or "FAILURE" to the text file named <workspace filename>_status.log
import fme
message = 'SUCCESS' if fme.status else 'FAILURE'
log_filename = fme.macroValues>'FME_MF_DIR'] + '/' +
fme.macroValues/'WORKSPACE_NAME'] + '_status.log'
with open(log_filename, 'w') as statuslog:
statuslog.write(message)
There's a lot if interesting stuff in the 'fme' module that you may want to in include in this file: