I'm using a PythonCaller to get a list of files in an FTP site folder as per this question:
https://knowledge.safe.com/questions/35179/use-pythoncaller-to-get-list-of-files-in-directory.html
This is because at the time, the FTPCaller didn't have the ability to download a folder, and the names of the files I want to download are not known. Once the list of files has been retrieved, the names of those that are CSV files are passed to the FTPCaller to download.
The FTP download functionality is in its own Workspace, called from a parent Workspace by a WorkspaceRunner. If there is a problem with the FTPCaller (Rejected port), an email is sent and a Terminator terminates the Workspace. The parent Workspace then picks this up via the Failed port of the WorkspaceRunner and abort subsequent processing steps that would have taken place on the downloaded data.
It also used to send an email and terminate if there are no files to download, or none of the files are CSVs. I now want to Terminate the Workspace and subsequent processing in parent Workspace but not send any emails. I have added a second Terminator to the FTP Workspace with the custom message "No CSV files to download from FTP site". The parent Workspace has a Tester attached to the Failed port of the WorkspaceRunner, and if this is the failure message, does not send the error alert email.
This works fine if there are some files, but none are CSVs, but if there are no files at all, I get this after the Terminator has fired:
2019-04-25 13:30:09| 1.3| 0.0|WARN |
2019-04-25 13:30:09| 1.3| 0.0|ERROR |Error encountered while calling method `input'
2019-04-25 13:30:09| 1.3| 0.0|FATAL |PythonCaller(PythonFactory): PythonFactory failed to process feature
2019-04-25 13:30:09| 1.3| 0.0|ERROR |A fatal error has occurred. Check the logfile above for details
Is this because the Terminator is firing too early? Is it not giving the PythonCaller time to finish? This seems to be the case because if I add a FeatureHolder before the Terminator, I don't get the fatal error.
This is slightly by the way, because the custom Termination message is not getting passed back to the WorkspaceRunner as I thought it would. I guess it only gets written to the log...? If so, is there a way of feeding back custom messages to the WorkspaceRunner so I can test them and act accordingly?