Skip to main content
Solved

How to run same workspace multiple times with different parameters


Forum|alt.badge.img

I would like to run the same workspace multiple times but with a different source geodabase each time. Basically, I want to run it once for each geodatabase in a given folder. I believe this could be scripted with Python, but am not entirely sure where to start.

Any suggestions or script samples is appreciated.

Best answer by blueinc

So you should have two FMWs at this point: one that does all your translations (let's call it Processor.fmw) and another fmw that uses the directory/file pathnames reader to feed the *.gdb names to the processor.fmw using a WorkspaceRunner Transformer. When you hook the Reader to the WSR and examine the parameters on the WSR, you will see the public parameter you set up on the processor.fmw. Using the dropdown arrow, you can set the parameter to one of the Reader's outputs like path_windows.

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

9 replies

pratap
Contributor
Forum|alt.badge.img+11
  • Contributor
  • June 20, 2016

Is there any reason for you to search in Python instead of using Workspace Runner in FME?


david_r
Evangelist
  • June 20, 2016

You can use the reader "Directory and File Pathnames" to look for folders ending with .gdb, then send those to the WorkspaceRunner with a workspace that treats each one individually:


Forum|alt.badge.img+5
david_r wrote:

You can use the reader "Directory and File Pathnames" to look for folders ending with .gdb, then send those to the WorkspaceRunner with a workspace that treats each one individually:

Yes, check out this example to see exactly how it is done.


Forum|alt.badge.img
  • Author
  • June 20, 2016
pratap wrote:

Is there any reason for you to search in Python instead of using Workspace Runner in FME?

No reason other than I am a newby at this and thought Python was required.

So is the idea to use Workspace Runner to grab the filenames in the directory, and then for each filename, pass it into the workspace parameters and execute?


david_r
Evangelist
  • June 20, 2016
lesleyf wrote:

No reason other than I am a newby at this and thought Python was required.

So is the idea to use Workspace Runner to grab the filenames in the directory, and then for each filename, pass it into the workspace parameters and execute?

Yes, you use the Directory and File Pathnames reader to grab the filenames, then for each filename (i.e. each feature that exits the reader), you fire off another workspace with the WorkspaceRunner, passing the gdb filename as a published parameter.


Forum|alt.badge.img
  • Author
  • June 20, 2016

Ok, thanks. Have the directory/file pathnames reader working. I have the generic workspace set up as well with the published parameter. What is confusing is that I am not sure how to loop through the filenames from the reader.


blueinc
Contributor
Forum|alt.badge.img+6
  • Contributor
  • Best Answer
  • June 20, 2016

So you should have two FMWs at this point: one that does all your translations (let's call it Processor.fmw) and another fmw that uses the directory/file pathnames reader to feed the *.gdb names to the processor.fmw using a WorkspaceRunner Transformer. When you hook the Reader to the WSR and examine the parameters on the WSR, you will see the public parameter you set up on the processor.fmw. Using the dropdown arrow, you can set the parameter to one of the Reader's outputs like path_windows.


Forum|alt.badge.img
  • Author
  • June 20, 2016
blueinc wrote:

So you should have two FMWs at this point: one that does all your translations (let's call it Processor.fmw) and another fmw that uses the directory/file pathnames reader to feed the *.gdb names to the processor.fmw using a WorkspaceRunner Transformer. When you hook the Reader to the WSR and examine the parameters on the WSR, you will see the public parameter you set up on the processor.fmw. Using the dropdown arrow, you can set the parameter to one of the Reader's outputs like path_windows.

Worked perfectly. Thank you.


blueinc
Contributor
Forum|alt.badge.img+6
  • Contributor
  • June 21, 2016
lesleyf wrote:

Worked perfectly. Thank you.

Awesome. Glad to help. (Though, in truth, all I did was diagram david_r's response :-))


Reply


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