Re: [Fab-user] Proposal: remote execution of Python code
On Sun, 15 Feb 2009 11:13:23 am you wrote: On Sat, Feb 14, 2009 at 6:59 PM, Richard Jones rjo...@ekit-inc.com wrote: Actually, no, it's for remote system deployment where we need to perform operations on the remote end that currently require us to copy a script to that system and execute it (which is your proposed workaround). Can you give a concrete example, then? I can't think of anything offhand that Fabric cannot currently do along those lines; it can execute any remote shell command (normally and via sudo), local shell commands, put/get files, and is capable of obtaining the output of the remote commands and performing logic based on those results. Yes, you're pretty much just repeating what I referred to as your proposed workaround :) I'd like to be able to do stuff like: Debug(WARN, STOPPING SERVER: %s:%s%(ihost, ihome)) killcmds = [] try: z2pids = open('%s/var/ZEO_SERVER-starting.pid'%ihome).read() except: try: z2pids = open('%s/var/ZEO_SERVER.pid'%ihome).read() except: Debug(INFO, no pid file - not running?) z2pids = None if z2pids: z2pids = z2pids.split() z2pids = filter(lambda x:x!='1', z2pids) # don't kill init :) z2pids = ' '.join(z2pids) killcmds.append('-kill -TERM %s 2/dev/null'%z2pids) if killcmds: do_commands('stop_server', ihost, killcmds) without having to write that as a script on the remote end. Currently we do it that way, and it just feels inelegant :) I think I can comfortably say the developer response to my proposal is a solid YAGNI, so I'll move on :) Richard ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
Re: [Fab-user] Proposal: remote execution of Python code
On Sun, Feb 15, 2009 at 6:34 PM, Richard Jones rjo...@ekit-inc.com wrote: I'd like to be able to do stuff like: open('%s/var/ZEO_SERVER-starting.pid'%ihome).read() do_commands('stop_server', ihost, killcmds) As far as I can tell, those were the only two kinds of method calls you had in the script that actually affect anything outside the script, and thus the only things that could possibly require remote execution. 'open()' could turn into two lines, download() + open() (and I could definitely see an argument for making a convenience method encapsulating the two); or, if one didn't need the file interface, it can already be done in a one-liner, z2pids = run('cat /location/of/zeo_pid_file') -- as run() returns its output, and I assume you know what the cat command does! I don't know what do_commands() does; does it simply execute a local shell command? Guessing not since you'd obviously know to turn that into a run() or sudo(); so is it a method you had to import from some other Python on that remote system? Which would explain your insistence that Fabric isn't cutting it right now...:) Please let me know -- I want to make sure I understand your needs here, even if I do have to end up saying nope, not happening anytime soon. Best, Jeff ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user
[Fab-user] Proposal: remote execution of Python code
[apologies if this pops up in the moderation queue - I'm trying to subscribe but I've not received any robot response to my application] Fabric is cool ;) I'd like to propose being able to define a function locally that's executed remotely. The inspiration for this comes from py.execnet: http://codespeak.net/py/dist/execnet.html Thoughts? I believe the addition of this capability would introduce whole new levels of awesome to Fabric :) Richard ___ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user