fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] Virtualenv Use Case


From: s s
Subject: [Fab-user] Virtualenv Use Case
Date: Sat, 2 May 2009 10:23:41 -0400

Here's one of my use cases that I'd like to get up on the Wiki at some point for discussion.

We are deploying a django app to cloud servers.

The servers come up pretty vanilla on one particular provider; we can't set up boot images.

We need to put up a Python virtual environment, activate it, then install a bunch of Python stuff into it.

Since "run()" gets a whole new shell each time, you can't carry-over the environment and end up having to re-establishing the virtual environment each time. I'm not a Capistrano user, only having played with it for a little while a few months ago, but it appears that Capistrano partially handles this with "cap shell."
        
        What I want is something like:
                runner=BatchRunner()
                runner.addCommand("cd my-new-virtualenv")
                runner.addCommand("bin/activate")
                runner.addCommand("easy_install 
some_project_into_my_virtual_env")
runner.addCommand("easy_install some_other_project_into_my_virtual_env")
                runner.run()

        Or, even better:
                shell_commands = """
cd my-new-virtualenv
bin/activate
easy_install some_project_into_my_virtual_env
easy_install some_other_project_into_my_virtual_env
"""
                runner=BatchRunner()
                runner.addCommand("some_pre_command") # I can add one to the 
beginning
                runner.addCommands(shell_commands)              # then add my 
batch commands
runner.addCommand("some_post_command") # I can add one to the end if I want
                runner.run()

        Or, even:
                batchCommandsRunner=BatchRunner(shell_commands)
                runner=BatchRunner()
                runner.addCommand("some_pre_command") # I can add one to the 
beginning
                runner.addCommands(batchCommandsRunner) # then add my batch 
commands
runner.addCommand("some_post_command") # I can add one to the end if I want
                runner.run()
                
That way all the commands can be run, in sequence, but without causing multiple connections or having to re-establish the environment. The third syntax allows easy combinations of pre-configured BatchRunners, even add-on module type ones.

I'm excited to see this moving forward right at the time. I've got this and some other really strong use-cases and some time to put in to help make it work.

S





reply via email to

[Prev in Thread] Current Thread [Next in Thread]