Solved

SystemCaller without waiting for result

  • 29 August 2018
  • 9 replies
  • 5 views

Badge

Hello,

is it possible to run from fme system call (or python caller) and don't wait for the result?

icon

Best answer by david_r 29 August 2018, 14:59

View original

9 replies

Userlevel 5
Badge +30

Hi @witos

Would you like to send the results by email, for example?

Thanks,

Danilo

Badge

Hi @witos

Would you like to send the results by email, for example?

Thanks,

Danilo

Hi @danilo_fme. It is not needed. In my ptyhon script that will be executed I will have some code to update database once it is finished, but if it is possible to send email or do web api call then why not. I just want to know what are the possibilities.

 

Userlevel 5
Badge +30
Hi @danilo_fme. It is not needed. In my ptyhon script that will be executed I will have some code to update database once it is finished, but if it is possible to send email or do web api call then why not. I just want to know what are the possibilities.

 

Perfect. You can to integration with API. There is a interesting custom transform TwilioCaller and TwilioSMSSender.

 

It is very easy to use this transform. You can do download here:

 

https://hub.safe.com/api/v2/transformers/twiliocaller/downloadhttps://hub.safe.com/api/v2/transformers/twiliocaller/download

 

 

Thanks,

 

Danilo

 

 

Badge
Perfect. You can to integration with API. There is a interesting custom transform TwilioCaller and TwilioSMSSender.

 

It is very easy to use this transform. You can do download here:

 

https://hub.safe.com/api/v2/transformers/twiliocaller/downloadhttps://hub.safe.com/api/v2/transformers/twiliocaller/download

 

 

Thanks,

 

Danilo

 

 

Thanks but the main question is: can I run a systemCaller and don't wait for the result, just finish FME Job and don't occupy FME Engine anymore?

 

 

Userlevel 3
Badge +17

No, there isn't such an option not to wait for the result from a program executed via SystemCaller or PythonCaller.

If necessary, consider creating another workspace containing the WorkspaceRunner (Wait for Job Complete: No) to run the workspace which contains the SystemCaller or the PythonCaller.

Userlevel 5

The SystemCaller is synchronous, but you can use a PythonCaller with something like the following to execute an external command asynchronously:

import subprocess

my_command = subprocess.Popen(['command1.exe', 'args1', 'arg2'],
                              stdin=None, stdout=None, stderr=None, close_fds=True)

This will execute "command1.exe" with the arguments "args1" and "args2" and FME will continue the workspace without waiting for the result.

Badge

The SystemCaller is synchronous, but you can use a PythonCaller with something like the following to execute an external command asynchronously:

import subprocess

my_command = subprocess.Popen(['command1.exe', 'args1', 'arg2'],
                              stdin=None, stdout=None, stderr=None, close_fds=True)

This will execute "command1.exe" with the arguments "args1" and "args2" and FME will continue the workspace without waiting for the result.

cool, thanks!

 

 

Badge +13

The SystemCaller is synchronous, but you can use a PythonCaller with something like the following to execute an external command asynchronously:

import subprocess

my_command = subprocess.Popen(['command1.exe', 'args1', 'arg2'],
                              stdin=None, stdout=None, stderr=None, close_fds=True)

This will execute "command1.exe" with the arguments "args1" and "args2" and FME will continue the workspace without waiting for the result.

😍 Just what I needed right now...

 

And when I finish the external command with triggering a webhook to a workspace with the second half of the process, it saves me 10 hours of running-but-actually-idle engine capacity.

Badge +13

😍 Just what I needed right now...

 

And when I finish the external command with triggering a webhook to a workspace with the second half of the process, it saves me 10 hours of running-but-actually-idle engine capacity.

😕 It works, as long as the workspace (and the python-environment in which I did pOpen) is alive. As soon as the workspace stops, the python-environent stops and so does the external process I triggered...

 

So no silently running process outside of FME, which wil trigger the next step when done.

Reply