Skip to main content
Solved

python workbench runner

  • October 22, 2015
  • 2 replies
  • 21 views

Hey FMEpedia,

 

 

I'm trying to automate the the running of a 2 step process required for multiple admin areas.

 

 

My current process is:

 

1. Workbench with workbench runner kicks of step 1 (for multiple admin areas at a time)

 

2. Once all admin areas have been processed - redirect workbench runner to point to step 2

 

 

Ideally I'd like to have a python shutdown script (or something of that ilk) within step 1, which would process step 2. 

 

 

Problem - The documentation for python shutdown scripts states you shouldn't use fmeobjects within a shutdown script...however this example highlights that it can be done.

 

 

I attempted to follow the example code, but it is dated 2013, so could be redundant to 2015...can anyone assist with:

 

a. Writing a python shutdown script to kick of new workbench,

 

b. Can you use fmeobjects withn a shutdown script?

 

  
 #FME Variables import fme, fmeobjects status = fme.status runner = fmeobjects.FMEWorkspaceRunner() #Path to Workspace current_workspace_dir = fme.macroValues["FME_MF_DIR_DOS"] workspace = current_workspace_dir + "\Workbench2.fmw" def main():     with open("E:\FME_Workbenches\PythonTesting\WorkbenchOne_Status.txt", "w") as text_file:         text_file.write("Workbench Status: {}".format(status) + "\n")         text_file.write("Workbench directory: {}".format(current_workspace_dir) + "\n")         text_file.write("Workbench: {}".format(workspace) + "\n") def workspaceRunner():     runner.promptRun(workspace)      main() workspaceRunner()      #if status == "True":     #main()     #workspaceRunner()
 

 

Cheers

 

 

Hugh

Best answer by david_r

Hi

 

 

Unless you're familiar with Python, I'd recommend not going the shutdown script route. I'd rather do a small, third workspace containing a Creator followed by two WorkspaceRunners with "Wait for job to complete" set to Yes. It will be much easier to maintain.

 

 

David

 

 
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.

2 replies

david_r
Celebrity
  • Best Answer
  • October 22, 2015
Hi

 

 

Unless you're familiar with Python, I'd recommend not going the shutdown script route. I'd rather do a small, third workspace containing a Creator followed by two WorkspaceRunners with "Wait for job to complete" set to Yes. It will be much easier to maintain.

 

 

David

 

 

  • Author
  • October 22, 2015
Hey David,

 

 

Yeah I already have a workbench with a workbench runner which initiates step 1 for the various admin areas, but I've set this to allow multiple processes, which means the workspace runner workbench completes well in advance of the workbenches it initiates, therefore the initiation of step 2 needs to be done from within step 1 rather than from the initial workench runner. 

 

 

I appreciate your point about the creator, this is awesome functionality I only found out about recently (doh should have remembered)...i can use this method within step 1 to kick off step 2.

 

 

Cheers for the suggestion.

 

 

Hugh