Skip to content

Instantly share code, notes, and snippets.

@huseyinyilmaz
Created September 11, 2014 11:12
Show Gist options
  • Save huseyinyilmaz/775908726513abc476af to your computer and use it in GitHub Desktop.
Save huseyinyilmaz/775908726513abc476af to your computer and use it in GitHub Desktop.
Run part of the fabric script sequentially (failed)
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