Skip to main content
Solved

Move files to error directory after failed FeatureWriter

  • September 6, 2022
  • 4 replies
  • 12 views

ewb_fme
Contributor
Forum|alt.badge.img+4

Is it possible to move files to an error directory when a FeatureWriter fails? Unfortunately, I have not found a way so far. Is there any other way than to use an FMEServer Automation that triggers another FME Workbench in case of an error, which only moves files to a directory? Is it possible to achieve this with only one FME Workbench?

Best answer by virtualcitymatt

Hmm, What kind of files would you be moving? input files or some kind of half written output?

 

Assuming a FeatureWriter fails you can use a Filecopy writer to move (or copy) files to a new directory. You'd need to attach the workflow to all your FeatureWriter rejection ports though (this also assumes a feature will come out of here).

 

Another option could be to create a python shutdown script - this could achieve what you want as well and might make it look cleaner?

 

https://community.safe.com/s/article/shutdown-python-scripts-in-fme#:~:text=In%20the%20Navigator%20pane%2C%20go,workspace%20with%20your%20own%20data.

View original
Did this help you find an answer to your question?

4 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+35
  • Celebrity
  • Best Answer
  • September 6, 2022

Hmm, What kind of files would you be moving? input files or some kind of half written output?

 

Assuming a FeatureWriter fails you can use a Filecopy writer to move (or copy) files to a new directory. You'd need to attach the workflow to all your FeatureWriter rejection ports though (this also assumes a feature will come out of here).

 

Another option could be to create a python shutdown script - this could achieve what you want as well and might make it look cleaner?

 

https://community.safe.com/s/article/shutdown-python-scripts-in-fme#:~:text=In%20the%20Navigator%20pane%2C%20go,workspace%20with%20your%20own%20data.


ewb_fme
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • September 6, 2022

Hi virtuakcitymatt,

it is a csv import file with data that I want to write to my SQL database. However, if the FeatureWriter fails for some reason, I want the files that could not be imported to be moved to an error directory.

 

But when FeatureWriter fails, the entire translation stops, so I haven't figured out how to take a final action (move the files to an error directory) after the failure.

 

Thank you for your advice to use a python shutdown script. I will try this and see if it works.

 

 


virtualcitymatt
Celebrity
Forum|alt.badge.img+35
ewb_fme wrote:

Hi virtuakcitymatt,

it is a csv import file with data that I want to write to my SQL database. However, if the FeatureWriter fails for some reason, I want the files that could not be imported to be moved to an error directory.

 

But when FeatureWriter fails, the entire translation stops, so I haven't figured out how to take a final action (move the files to an error directory) after the failure.

 

Thank you for your advice to use a python shutdown script. I will try this and see if it works.

 

 

Ahh right, check your workspace parameters on how rejected features are handled. It could be as simple as switching from ending the process to continuing the process​.


ewb_fme
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • September 7, 2022
virtualcitymatt wrote:

Ahh right, check your workspace parameters on how rejected features are handled. It could be as simple as switching from ending the process to continuing the process​.

Thank you for your inputs!


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