Skip to main content

Hey,

I have FME Desktop licence where I have several workspaces created and running fine.

I open these workspaces individually and run them manually as required, these are not tasks that need to be run on a predetermined schedule (I have got some of those workspaces being triggered by batch files and windows task scheduler). These tasks are just random one-off's that I want to trigger.

I am hoping to use a html file on my local machine to trigger individual workspaces on demand, rather than having to load FME Desktop Workspace, and running them manually. A 'dumb' html file like this is what I am wanting to set as my homepage for triggering several different workspaces:

Is this something that can be achieved without a FME Server licence?

I have done some searching for a tutorial/example but all of the things I am finding are using FME server.

Any ideas?

Running local exe-files or other from a webpage is disabled due to security (read more here https://stackoverflow.com/questions/5422093/run-a-program-from-a-local-webpage )

 

 

A better option is to look into FME Cloud or FME Server. Depending how often you want to run these tasks.

 

 

If you still want to run them locally - just gather all your *.bat files in a folder and go to that folder when you want to run one of them.

Running local exe-files or other from a webpage is disabled due to security (read more here https://stackoverflow.com/questions/5422093/run-a-program-from-a-local-webpage )

 

 

A better option is to look into FME Cloud or FME Server. Depending how often you want to run these tasks.

 

 

If you still want to run them locally - just gather all your *.bat files in a folder and go to that folder when you want to run one of them.

While I agree with @sigtill that it is better to look at FME Cloud or FME Server for these kinds of workflows, or just use a bunch of batch files or desktop shortcuts, I do want to point out there is a loophole (or at least there used to be when I last tried it...), the php exec() command, as well as a few others, allows you to execute a system command.

Try this at your own peril, it can be a pretty big security risk and if you have IT staff they may not appreciate it.


How are you at Python? Fairly basic Python, that is. I'm far from an expert and I got something running in 15-30 minutes.

See this folder in FME: C:\Program Files\FME2019\fmeobjects\samples\Python\WorkspaceRunner

It has a Python example of writing an app that lets you run a workspace. You just fire it up and pick a workspace from a menu, just as you mocked up, above. The only difference is that it's a command window, not a HTML window.

0684Q00000ArJr4QAF.png

By default option 1 opens a Windows browser to pick your workspace, but it's fairly straightforward to adjust it to run a hard-coded choice of workspace without prompting.

For example, under the main() section I replaced the existing section of code to this:

if option_num == 1:
    workspace_path = r'C:\Users\MIreland\Documents\Parks2GML.fmw'
    print("\nRunning: " + workspace_path)
    run_workspace(workspace_path)

i.e. I tell it which workspace to run directly, and then have it run that workspace (avoiding the section run_workspace_main(), which you can then delete)

So now I have this:

0684Q00000ArJvOQAV.png

The readme file in the Python example folder suggests you have to install a Plugin to get this to run. It's no big deal. It only took a couple of minutes. But you might even be able to avoid that if you delete the run_workspace_main() section, and remove references to wx (I say "might", because I haven't tried it, but I think wx is only responsible for the Windows file browser, so if you don't use that, there's no need for this to be installed or imported).

Anyway, it's fairly crude, but it does what I think you need. And I'm sure there must be a way to create a nicer interface that you don't need to run through a command prompt.

If it helps, my final Python is attached (WorkspaceRunner.py)

Regards

Mark


How are you at Python? Fairly basic Python, that is. I'm far from an expert and I got something running in 15-30 minutes.

See this folder in FME: C:\Program Files\FME2019\fmeobjects\samples\Python\WorkspaceRunner

It has a Python example of writing an app that lets you run a workspace. You just fire it up and pick a workspace from a menu, just as you mocked up, above. The only difference is that it's a command window, not a HTML window.

By default option 1 opens a Windows browser to pick your workspace, but it's fairly straightforward to adjust it to run a hard-coded choice of workspace without prompting.

For example, under the main() section I replaced the existing section of code to this:

if option_num == 1:
workspace_path = r'C:\Users\MIreland\Documents\Parks2GML.fmw'
    print("\nRunning: " + workspace_path)
    run_workspace(workspace_path)

i.e. I tell it which workspace to run directly, and then have it run that workspace (avoiding the section run_workspace_main(), which you can then delete)

So now I have this:

The readme file in the Python example folder suggests you have to install a Plugin to get this to run. It's no big deal. It only took a couple of minutes. But you might even be able to avoid that if you delete the run_workspace_main() section, and remove references to wx (I say "might", because I haven't tried it, but I think wx is only responsible for the Windows file browser, so if you don't use that, there's no need for this to be installed or imported).

Anyway, it's fairly crude, but it does what I think you need. And I'm sure there must be a way to create a nicer interface that you don't need to run through a command prompt.

If it helps, my final Python is attached (WorkspaceRunner.py)

Regards

Mark

Oh, one quick comment. On this line:

workspace_path = r'C:\Users\MIreland\Documents\Parks2GML.fmw'

 

 

You totally need the "r" at the front of the path. It means this is a raw string. Otherwise Python thinks the \s are escape characters and starts complaining about encoding. I think the other solution is to replace them with \\

How are you at Python? Fairly basic Python, that is. I'm far from an expert and I got something running in 15-30 minutes.

See this folder in FME: C:\Program Files\FME2019\fmeobjects\samples\Python\WorkspaceRunner

It has a Python example of writing an app that lets you run a workspace. You just fire it up and pick a workspace from a menu, just as you mocked up, above. The only difference is that it's a command window, not a HTML window.

0684Q00000ArJr4QAF.png

By default option 1 opens a Windows browser to pick your workspace, but it's fairly straightforward to adjust it to run a hard-coded choice of workspace without prompting.

For example, under the main() section I replaced the existing section of code to this:

if option_num == 1:
    workspace_path = r'C:\Users\MIreland\Documents\Parks2GML.fmw'
    print("\nRunning: " + workspace_path)
    run_workspace(workspace_path)

i.e. I tell it which workspace to run directly, and then have it run that workspace (avoiding the section run_workspace_main(), which you can then delete)

So now I have this:

0684Q00000ArJvOQAV.png

The readme file in the Python example folder suggests you have to install a Plugin to get this to run. It's no big deal. It only took a couple of minutes. But you might even be able to avoid that if you delete the run_workspace_main() section, and remove references to wx (I say "might", because I haven't tried it, but I think wx is only responsible for the Windows file browser, so if you don't use that, there's no need for this to be installed or imported).

Anyway, it's fairly crude, but it does what I think you need. And I'm sure there must be a way to create a nicer interface that you don't need to run through a command prompt.

If it helps, my final Python is attached (WorkspaceRunner.py)

Regards

Mark

Another quick comment. You can vary the command depending on how you want to run the workspace:

  • runner.run(workspace_path) - run the workspace, prompting for parameters the first time
  • runner.promptRun(workspace_path) - run the workspace, prompting for parameters every time
  • runner.runWithParameters(workspace_path,{}) - run the workspace without prompting

Reply