I've got 2 scripts - master scripts runs via WorkspaceRunner slave one. Into slave workspaceI've placed specified Python code as shutdown script to print on console some summaries. When run master script via command line - there are no prints from slave script.
Solved
[Python] How to access from master workspace to fme.featuresWritten from slave workspace?
Best answer by david_r
Unfortunately that isn't possible for a couple of reasons:
- Print statements are not sent to the FME log file, only to the display (either command line window or the translation log window)
- The child workspace and the master workspace have separate log files
- Furthermore, the translation log file has been closed before the shutdown script executes, so you cannot use the FMELogFile() object to output additional text in the log (I'll post a workaround for this below)
A couple of solutions:
Use the shutdown script in the child workspace to write a small file containing the number of features written (fme.featuresWritten) and then pick it up in the main workspace using a FeatureReader after the WorkspaceRunner. You will of course have to configure the WorkspaceRunner to wait for the child workspace to finish for this to work.
Another alternative is to pass the master log file name as a published parameter to the child workspace, then append to it in the child shutdown script as per the workaround below.
Reply
Rich Text Editor, editor1
Editor toolbars
Press ALT 0 for help
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.