In my previous post about Workbench updates for FME2011, one item I deliberately missed out was the new tool for Feature Inspection. This functionality is designed to help in debugging a translation – whether it’s a problem with the workspace, or a problem with the data – and should be a great time-saver.
NB: Feature Inspection is sometimes referred to as “inline data inspection” or “workspace debugging”, so if you’ve heard those terms before, this is the same thing.
Data Inspection vs Feature Inspection
If you’ve taken the FME Desktop training course – or used the FME Data Inspector application – then you’ll know all about Data Inspection. Data Inspection is when a user opens a dataset in the FME Viewer/Inspector in order to examine it in detail. This usually takes place before or after a translation, but you can also view the data at different stages within a translation by using Visualizer transformers.
However, by the time you view the data, the translation is already complete and what is being viewed is merely a snapshot of what was.
Feature Inspection – the new tool for 2011 – is significantly different in two ways. Firstly, only one feature at a time is inspected, not an entire dataset. More importantly, feature inspection is not just a snapshot of the past, but is a live view of a translation as it is taking place, and that’s a key development.
First a quick diversion. The Feature Inspection functionality obviously requires a workspace to be halted mid-translation, in order for data to be viewed live. So, once that part was in place we could expose it to users via a pause button.
That’s right: even without inspecting features, Workbench now includes a toolbar button to pause translations, so you can check the log file mid-run or simply pause a lengthy translation while you do some other work on that machine.
Well, pausing is fine, but say you want to pause at a particular point: well that is what Inspection Points are for. To create an inspection point, right click on a workspace connection and choose Inspection Point > Add Inspection Point.
You can also select that connection and press F9. Inspection Points are denoted in a workspace by a thick, blue connection line:
OK, now we have an inspection point, how can we use it? Well notice the other new button on the Workbench toolbar: Run with Inspection.
Press that particular run button, and then when the first feature reaches the designated inspection point, the translation is automatically paused. And, of course, if you have inspection points but don’t want to use them, then just use the standard run button on the left.
So when a translation has hit an inspection point and paused, a new window called the Feature Inspection dialog opens up. This contains all of the same sort of information you would expect to see if you queried a feature in the FME Universal Viewer (click to enlarge)
Notice the buttons at the foot of this dialog:
From left to right we have:
- Step to Next Connection: Clicking this button takes the current feature and moves it through the next transformer. Repeated clicking moves the feature through the whole workspace, a step at a time, until the next feature is ready to process; then it steps through the workspace with that feature.
- Step to Next Inspection Point: Clicking this button restarts the translation, and then halts it again the next time an inspection point is reached. It may be a different inspection point, or the same one with a different feature.
- Continue Translation: Clicking this button restarts the translation, and runs it to completion, ignoring all subsequent inspection points. Once clicked, this button reverts to a pause button itself, which you can use to pause the translation again.
- Stop Translation: Clicking this button terminates the translation. The message is slightly different to what the Terminator transformer would return.
I like the “Step to Next Connection” button very much. Besides its intended use, I think it helps educate you about how features flow through a workspace.
For example, when a feature reaches a group-based (blocking) transformer it will stop, and the next feature is processed up to the same point. Also, you can see the order of feature processing when there are multiple connections out of a single transformer port. It’s hard to describe that sort of action, but much easier when you can see it taking place.
Conditional Inspection Points
When using Feature Inspection to debug a bad workspace/bad data, it’s going to be useful to inspect a feature only when it has some particular characteristic or status. This can be achieved using a Conditional Inspection Point. To create one of these, right-click an existing inspection point and select the option Inspection Point > Edit Inspection Point:
This opens a Tester-like interface where conditions can be defined that need to be met before a feature will trigger an inspection point. For example, here the inspection point will only be triggered when a point feature enters (identified by fme_type = fme_point). Other features will not get inspected.
At the foot of the dialog are options to define how the hit count can affect inspection. The hit count is the number of features that have triggered inspection. The options are to always trigger inspection (no matter what the hit count) or to trigger inspection only when the hit count passes some rudimentary test itself:
One warning on both the pause button and feature inspection must be to take caution with database formats. If you pause a translation as it is reading from a database, and leave it paused for a period of time, there’s the obvious risk that the connection will time-out, and the workspace fail when it is re-commenced.
Also, just in case you were wondering, it isn’t possible to use inspection points within a mapping file. Yes, they do just use a BreakpointFactory, but that interacts with some special code in Workbench that you wouldn’t have when running a mapping file.
Finally, there was a tiny problemette with the pause button on Windows XP. If it doesn’t work for you then be sure to check for FME2011 Service Pack 1, which will contain a fix. Feature Inspection will work fine anyway, so you might not be too worried about this.
So, that’s Feature Inspection in brief. Like I said, the use cases we see for this are when debugging a workspace or data:
- To check for bad features in a translation, and stop it before they corrupt the output.
- To prototype a workspace – running it while it is still being built to make sure it works as expected
- To debug a workspace – to find the one or two features that cause problems (for example, why one feature fails Tester conditions, when you are expecting it to pass).
One other quick tip: if you’ve paused a translation with the pause button then you can enter feature inspection mode by simply clicking the “Run with Feature Inspection” button to restart the process.
As always, please send any feedback or suggestions you have for this functionality. For instance, I’ve just filed an enhancement request to add the option to delete an inspected feature from the translation, in order to weed out bad data in a real-time way.
You can either email me directly, or send your thoughts to email@example.com
Mark IrelandMark, aka iMark, is the FME Evangelist (est. 2004) and has a passion for FME Training. He likes being able to help people understand and use technology in new and interesting ways. One of his other passions is football (aka. Soccer). He likes both technology and soccer so much that he wrote an article about the two together! Who would’ve thought? (Answer: iMark)