[GIS] How to you conditionally halt an FME translation

fme

I have an FME workspace that takes a set of street centerlines and converts it into address points. I have been working my way across the state of Missouri with this translator one county at a time, since each county can take up to an hour to process. I select a county at the start of the translator as a choice parameter.

My problem is that I keep having to double check to make sure of what counties I have processed so I do not process a county twice. When I have a file of several million address points, I do not want to be removing duplicates.

What I would like to have FME do is take the county I have selected, and check against a shapefile of counties to see if the county has been processed yet. I have a flag attribute, "COMPLETE" that is set to 0 if the county has not been processed and 1 if it has.

The county shapefile has nothing to do with any other readers or writers in the translator.

Edit: To clarify, the counties are not being processed at all by the translator, only the centerlines.

Since there are over 2 million centerlines, I do not want to read the centerlines at all (much less maintain an attribute on the centerlines) if the county has already been processed.

Edit:
Here is the solution. I moved up the st_county10 reader (the one in the image) to the top of the reader list. This executes before anything else. By using the feature holder, I avoid writing over the st_county10 shapefile if the translation is terminated.

One last piece, since I had a python shutdown script, I had to add this line:

import pyfme
if FME_Status == True:

To the front of the shutdown script to stop execution of the shutdown script too.

If COMPLETE=0, translation proceeds, otherwise it goes to the Terminator

Best Answer

If I understand the problem correctly, I think you want to incorporate your county shapefile as a Reader and then execute a Tester transformer against that, then route your job accordingly. Use your published parameter of state name in the tester as one of the test clauses, along with the processed yes/no flag. Here's a quickie I threw together:

enter image description here

This looks for features with a Status = 'Other' in this cities shapefile, then routes according to pass/fail. Now, I think FME is sensitive to the order you put your Readers into the workspace, so if you put this reader in after you already have some others in, the others will get executed first. Try it, you might have to make a new workspace, put this logic in first, then put your other readers in after that to get the read order correct. If you want to kill the job if the query fails, there may be a way to do that with pyfme, or you could route the FAILED feature (when status = Completed already) to a Terminator transformer.