Discussion:
[Fab-user] Single tasks, 2 servers
Lorenzo Bivens
2013-09-13 17:21:30 UTC
Permalink
Hi,

I need to run a task that involves running commands in two separate servers. 
The task is to open a listener on the fixed host and receive a stream of data from the list of servers. 

The idea I have is to do something like: (loose syntax ahead )
@task
def data_transfer():
server_list = ls_servers()

execute(start_listening, hosts=listener)
execute(start_sending, hosts=server_list)

Obviously the task is going to stop on the first execute statement until it is done

Is there a way to put it in the background and jump to the next execute statement?

Thanks!

-- 
Lorenzo Bivens - Lucera DevOps Team
cel: (646) 203 1754 | support: (855) 551-2708
Jeff Forcier
2013-09-13 20:35:21 UTC
Permalink
Hi Lorenzo,

Fabric isn't well set up for this sort of thing, and since it's also
not threadsafe, you can't use that technique either.

What is usually recommended here is to use remote backgrounders like
screen or tmux (or process managers like supervisor, upstart, runit,
etc). This allows you to tell the remote system to manage your
listener in the background, returning control to Fabric.

Then you would add another subtask or run() statement at the end of
your main task that connects to the listener again & turns the process
back off.

Best,
Jeff
Post by Lorenzo Bivens
Hi,
I need to run a task that involves running commands in two separate servers.
The task is to open a listener on the fixed host and receive a stream of
data from the list of servers.
The idea I have is to do something like: (loose syntax ahead )
@task
server_list = ls_servers()
execute(start_listening, hosts=listener)
execute(start_sending, hosts=server_list)
Obviously the task is going to stop on the first execute statement until it
is done…
Is there a way to put it in the background and jump to the next execute statement?
Thanks!
--
Lorenzo Bivens - Lucera DevOps Team
cel: (646) 203 1754 | support: (855) 551-2708
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
--
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org
Loading...