python - Wait until process in remote server finishes using Fabric -
setup
i using fabric kick off process on remote server. local server executes python file runs 3 functions in sequence: 1st , 3rd in local server , 2nd in remote server, follows.
local_file.py
local_function_1() remote_function() local_function_2() the remote function 1 specified in local fabfile, follows.
fabfile.py
from fabric.api import * @hosts(remote_server) def remote_function(): run('python function_on_remote_server.py') question
local_function_2 should run after remote_function has finished running, unsure how accomplish this.
i have considered (1) waiting fixed number of seconds before local_function_2 runs , (2) adding intermediary local function checks existence of output remote_function before running local_function_2.
how can delay execution of function on local server until after function on remote server has finished running?
one way change way you're calling remote_function, , use fabric execute instead.
from fabric.api import execute local_function_1() execute(remote_function) local_function_2() execute should block until tasks complete.
for more info, see intelligently executing tasks execute.
Comments
Post a Comment