WorkspaceRunner
From fmepedia
WorkspaceRunner is a Workbench Transformer.
| Table of contents |
Description
Runs a workspace from within an existing workspace. Useful for batch processing, especially in conjunction with the Directory and File Reader.
Example
The attached workspace shows an example use of the WorkspaceRunner transformer.
This workspace requires the FME 2008 FME Sample Dataset (http://www.safe.com/support/onlinelearning/fmesampledata.php) to be installed for it to run correctly.
The WorkspaceRunner transformer runs a different workspace. In conjunction with the PATH format reader it can be used as a device for batch processing.
In this example the user has a polygon building workspace that he needs to use on a number of MIF/MID datasets stored within a single folder. He can do this by creating a new workspace that uses the WorkspaceRunner transformer.
The same technique can be carried out on an FME Server by using the ServerJobSubmitter transformer in place of the WorkspaceRunner.
Workspace Screenshots

Above: The Polygon Building workspace. As with any workspace to be used for batch processing folder-based datasets, a Merge Filter has been defined. Likewise a Feature Type Fanout is used to create a separate output file for each input. The source dataset parameter has been published to make it available to the WorkspaceRunner.

Above: The WorkspaceRunner workspace. The PATH reader reads a list of MIF files inside a specified folder. The feature count shows us there are 30. The WorkspaceRunner calls the polygon building workspace once for each source MIF file. Parameters published in the first workspace are made available to the WorkspaceRunner which is how the name of each source file is transmitted. The Logger transformers are there just to provide a list of the translation results.
Output Screenshot

Above: As the WorkspaceRunner does its stuff, a number of FME processes are started - one for each file. The WorkspaceRunner can be set to wait for each process to complete before starting the next, in which case there would only be one new process at a time. If you were using the ServerJobSubmitter alternative then, instead of a number of FME processes in the task manager, you could browse the server admin tools and watch all of the engines processing away.

Above: As each workspace starts it is logged in the log pane. Because the workspace is not waiting for the process to complete, a success message only tells us that the process started, not whether it was properly completed.

Above: Here is the output from the batch process. A different Shape dataset is written for each input mif/mid file. The contents will be a set of polygons built from the original linework.
NB: In case you were wondering, yes you can use a WorkspaceRunner to run the workspace in which it is contained. But then starting with ten features would create ten new FME processes, each of which creates ten new FME processes, each of which creates ten new FME processes, each of which...... CRASH! - just don't do it unless you want to tie up your machine (or worse your FME Server) with thousands of processes.
