How to end a pipeline with a snap that does nothing

I’ve noticed that the pipeline execute snaps don’t seem to do anything, unless there is at least one snap after them. Is that true or am I doing something wrong?

Also, I want to add one snap at the end of my pipeline, right after my last pipeline execute snap, for the above given reason. How can I add a snap that effectively, does nothing?

I just noticed, after typing the above, that if I left the output view of the pipeline execute snap open (not connected to another snap), that it does work, but is that best practice? In other words, when I take away the output view on that last snap, it isn’t running the pipeline.

image

@vincenr - The Pipeline Execute snap will always call the child if there is an input document to send to it; the exception here is if you remove the input view from the Pipeline Execute snap and the child does not expect any input documents (i.e. no open input views).

When you execute, you might want to look in the Dashboard to confirm this behavior. It doesn’t matter if there is a snap connected to it after - only before.

1 Like

@vincenr – as @koryknick pointed out, you don’t need an endpoint just to get the pipeline execute to work. However, you may eventually encounter a situation where you need to dump an output to /dev/null so to speak (for example, when IN a child pipeline, you can have only ONE document stream open at the end).

For this, use an “Exit” snap (found in the “Flow” menu), and set the Threshold Limit to a number that far exceeds the number of documents it might ever receive. Name the snap informatively: “End” or “Exit” or “Suppress Returned Documents”, etc. Put it at the end of a path in the pipeline where you need it:

image

Since you’ll never hit the threshold, you’ll never get an error.
It simply “eats” the documents, sending them to that great big bit bucket in the sky.

PS: Another way to end a chain of snaps is to simply delete the output view on the last snap:

image

Note that all of the above examples are actually from the same pipeline. This is a VERY good example of when you’d need both strategies. It’s a child pipeline and there is a different path (not shown) that is expected to pass documents back up to the parent pipeline. The purple-ish snap is a call to a stored procedure so there are two outputs, neither of which can be removed from the snap. In one case, there’s something we want to pass to a logging pipeline, but we don’t want the doc stream to go any further than that. The other output, we don’t want to do anything with, but we must supply a “terminator” because there can only be one output path from a child pipeline to it’s parent, and the SP doesn’t return a useful result set.

Whew! Longer reply than I’d expected!

Hope this helps!

1 Like