Skip to main content
Solved

python workbench runner


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

 

 
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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

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