Skip to main content
Solved

SystemCaller without waiting for result


Forum|alt.badge.img

Hello,

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

Best answer by david_r

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.

View original
Did this help you find an answer to your question?

9 replies

danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • August 29, 2018

Hi @witos

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

Thanks,

Danilo


Forum|alt.badge.img
  • Author
  • August 29, 2018
danilo_fme wrote:

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.

 


danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • August 29, 2018
witos wrote:
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

 

 


Forum|alt.badge.img
  • Author
  • August 29, 2018
danilo_fme wrote:
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?

 

 


takashi
Influencer
  • August 29, 2018

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.


david_r
Celebrity
  • Best Answer
  • August 29, 2018

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.


Forum|alt.badge.img
  • Author
  • August 29, 2018
david_r wrote:

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!

 

 


martinkoch
Supporter
Forum|alt.badge.img+18
  • Supporter
  • October 5, 2021
david_r wrote:

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.


martinkoch
Supporter
Forum|alt.badge.img+18
  • Supporter
  • October 5, 2021
martinkoch wrote:

😍 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.


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