Created
September 11, 2014 11:12
-
-
Save huseyinyilmaz/775908726513abc476af to your computer and use it in GitHub Desktop.
Run part of the fabric script sequentially (failed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import env | |
# from fabric.api import serial | |
from fabric.api import task | |
from fabric.api import run | |
from fabric.task_utils import state | |
env.hosts = ['addv3.redbeacon-inc.com', 'addv4.redbeacon-inc.com'] | |
env.parallel = True | |
# @serial < does not work on function | |
def go_sleep_serial(): | |
env.parallel = False # Does not work | |
state.env['parallel'] = False # does not work | |
run('sleep 10') | |
env.parallel = True | |
state.env['parallel'] = True | |
def go_sleep_parallel(): | |
run('sleep 10') | |
@task | |
# @serial < running task should be assigned as serial | |
# it seems like execution strategy is decided start of task call | |
# and cannot change later. | |
def start_serial(): | |
go_sleep_serial() | |
@task | |
def start_parallel(): | |
go_sleep_parallel() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment