Skip to main content
Hi,

 

 

I want to call same workbench again based on some feature at shutdown.

 

I achieved this through a python shutdown script but the problem is i also want to set the user parameter for the next run. I tried but each time the workbench runs again, i takes the default value of parameter.

 

Is there any way to set the parameter at shutdown so that next time when workbench runs it picks the value i set ? Any help would be appreciated. Thanks in advance.

 

Hi,

 

 

I think the easiest solution would be to store this info in an external configuration file. You could read the file during startup and write the file on shutdown.

 

 

David
You could run your workbench from a script.  This allows you to pass parameter values to the FMW using the scripting language, which may allow more flexibility in generating your parameter values.

 

 

Have a look here for reference:

 

 

http://fmepedia.safe.com/articles/How_To/Batch-Processing-Method-1-Command-Line-or-Batch-File

 

 

You could then read the parameter value from a text file using the script, execute an fmw with a shutdown script that writes to the same text file whatever the next parameter needs to be.

 

 

Good luck!
David, is there an article published about using info from an external configuration file to define parameters?
I have used Scripted parameters many times to retrieve external settings into a workspace. It is a very flexible way to do it once you get the hang of it.

 

 

Example:

 

 

External file mySettings.txt

 

-----

 

database_user=system

 

database_password=verysecret

 

-----

 

 

Scripted parameter (Python) mapped to the Reader password

 

-----

 

f = open('mySettings.txt', 'r')

 

for line in f:

 

    key, value = line.split('=')

 

    if key == 'database_password':

 

        return value # Success!

 

return '' # Failure...

 

-----

 

 

This is very simplified, but you get the idea. This enables you to store e.g. common settings in an external configuration file rather than embedding it into each and every workspace.

 

 

For the original question, my idea was that the shutdown script (or a Text File writer) could write out the last run settings, and that they could be picked up on consequtive runs by something like the above.

 

 

There is a good example use for scripted parameters here, although the use case is quite different (but equally interesting).

 

 

I hope this helps.

 

 

David
Hi,

 

 

> I want to call same workbench again based on some feature at shutdown.

 

> I achieved this through a python shutdown script...

 

 

If you want to run the workspace through the shutdown script, using fmeobjects.WorkspaceRunner.runWithParameters might be an alternative way. But when running the same workspace recursively with this way, you have to think about a finish condition carefully not to make it run infinitely.

 

 

Takashi
Sorry for a typo. error: fmeobjects.WorkspaceRunner. correct: fmeobjects.FMEWorkspaceRunner. 

Reply