Skip to main content
Solved

How to run same workspace multiple times with different parameters

  • Jun 20, 2016 12:43 PM UTC
  • 9 replies
  • 368 views

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
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

9 replies

pratap
Contributor
Forum|alt.badge.img+12
  • Contributor
  • Jun 20, 2016 12:46 PM UTC

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


david_r
Celebrity
  • Jun 20, 2016 1:53 PM UTC

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

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
  • Jun 20, 2016 2:16 PM UTC

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
Celebrity
  • Jun 20, 2016 3:50 PM UTC

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
  • Jun 20, 2016 5:17 PM UTC

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
  • Jun 20, 2016 6:24 PM UTC

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
  • Jun 20, 2016 8:54 PM UTC

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
  • Jun 21, 2016 3:34 AM UTC

Worked perfectly. Thank you.

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