当前位置: 首页>>代码示例>>Python>>正文


Python api.cd方法代码示例

本文整理汇总了Python中fabric.api.cd方法的典型用法代码示例。如果您正苦于以下问题:Python api.cd方法的具体用法?Python api.cd怎么用?Python api.cd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fabric.api的用法示例。


在下文中一共展示了api.cd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def update():
    """Update the svn repo, then reinstall LNT."""
    with cd(LNT_PATH):
        with cd(LNT_PATH + "/docs/"):
            sudo('rm -rf _build')
        with cd(LNT_PATH + "/lnt/server/ui/static"):
            sudo('rm -rf docs')
            sudo('git checkout docs')

        sudo("git pull --rebase")
        run("git log -1 --pretty=%B")
        with cd(LNT_PATH + "/docs/"):
            sudo(in_venv("make"))
        sudo(IN_VENV + "python setup.py install --server")

    put(here + "/blacklist", "/tmp/blacklist")
    sudo("mv /tmp/blacklist /srv/lnt/install/blacklist")
    put(here + "/kill_zombies.py", "/tmp/kill_zombies.py")
    sudo("mv /tmp/kill_zombies.py /etc/cron.hourly/kill_zombies")
    sudo("chmod +x /etc/cron.hourly/kill_zombies")
    rotate_log()
    service_restart() 
开发者ID:llvm,项目名称:llvm-zorg,代码行数:24,代码来源:fabfile.py

示例2: setup_supervisor

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def setup_supervisor():
    # We use supervisord to keep Crestify running in the background
    # Recover from crashes, and to start automatically on bootup
    # Also, using more than 1 gunicorn worker resulted in socket not being released, so only 1 worker will be used
    sudo('apt-get -y install supervisor')
    sudo('mkdir /var/log/crestify/')
    sudo(
        'cd /home/crestify/crestify && ../crestifyenv/bin/honcho export -s /bin/sh -a crestify supervisord /etc/supervisor/conf.d')
    fd = StringIO()
    get('/etc/supervisor/conf.d/crestify.conf', fd)
    content = fd.getvalue().splitlines()
    for n, i in enumerate(content):
        if i.startswith("environment="):
            content[n] = i + ",PATH=/home/crestify/crestifyenv/bin:%(ENV_PATH)s"
        if i.startswith("user="):
            content[n] = "user=crestify"
        if i.startswith("stopsignal="):
            content[n] = "stopsignal=TERM"  # Both Gunicorn and Celery use SIGTERM for graceful shutdown
    content = StringIO("\n".join(content))
    put(content, "/etc/supervisor/conf.d/crestify.conf", use_sudo=True)
    sudo('supervisorctl reread')
    sudo('supervisorctl update') 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:24,代码来源:fabfile.py

示例3: engine_start

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def engine_start(http_host, http_port):
    package = env.package

    command = (
        "workon {package}_env &&"
        " (marvin engine-httpserver"
        " -h {http_host}"
        " -p {http_port}"
        " -e {executor}"
        " 1> /var/log/marvin/engines/{package}.out"
        " 2> /var/log/marvin/engines/{package}.err"
        " & echo $! > /var/run/marvin/engines/{package}.pid)"
    ).format(
        package=package,
        http_host=http_host,
        http_port=http_port,
        executor=env.marvin_engine_executor_path
    )

    with cd("/opt/marvin/engines/{package}/current".format(package=package)):
        run(command, pty=False) 
开发者ID:marvin-ai,项目名称:marvin-python-toolbox,代码行数:23,代码来源:fabfile.py

示例4: keys

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def keys():
    if "rsdir" not in env:
        secret = file("secret.key").read()
        public = rscoin.Key(secret, public=False)
        pid = b64encode(public.id())

        env["rsdir"] = {"special": pid, "directory": []}

    [_, host] = env.host_string.split("@")
    with cd('/home/ubuntu/projects/rscoin'):
        run('touch secret.key')
        run('rm secret.key')
        result = run('python derivekey.py --store')
        [_, key] = result.strip().split()
        
        kid = b64encode(rscoin.Key(b64decode(key)).id())
        env["rsdir"]["directory"] += [ [kid, host, 8080] ]
    

    from json import dumps
    file("directory.conf", "w").write(dumps(env["rsdir"])) 
开发者ID:gdanezis,项目名称:rscoin,代码行数:23,代码来源:fabfile.py

示例5: experiment1collect

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def experiment1collect():        
        # run("ls experiment1/*")
    with cd('/home/ubuntu/projects/rscoin/%s' % env.expname):
        get('issue-times.txt', '%s/%s-issue-times.txt' % (env.expname, env.host))

    with lcd(env.expname):
        local("cat %s-issue-times.txt >> issue-times.txt" % env.host)

    with cd('/home/ubuntu/projects/rscoin/%s' % env.expname):
        get('r1-times.txt', '%s/%s-r1-times.txt' % (env.expname, env.host))
    
    with lcd(env.expname):
        local("cat %s-r1-times.txt >> r1-times.txt" % env.host)

    with cd('/home/ubuntu/projects/rscoin/%s' % env.expname):
        get('r2-times.txt', '%s/%s-r2-times.txt' % (env.expname, env.host))

    with lcd(env.expname):
        local("cat %s-r2-times.txt >> r2-times.txt" % env.host)

        # local("python exp1plot.py experiment1") 
开发者ID:gdanezis,项目名称:rscoin,代码行数:23,代码来源:fabfile.py

示例6: build

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def build(build_type='prod'):
    """
        Drops and recreates the databases for development, then initializes main
        This will raise an error if 127.0.0.1 is not in env.hosts to protect live databases
        Make sure complete migration scripts exist prior to running this
    :return:
    """
    restart_supervisor()
    prepare_build_or_deploy(build_type=build_type)
    start = datetime.datetime.now()
    recreate_db(build_type)
    with cd(get_django_setting(build_type, 'ROOT_PATH')):
        manage_py('syncdb --noinput', build_type)
        manage_py('migrate', build_type)
        manage_py('collectstatic --noinput', build_type)
        setup_tilestache_user()
    build_database(build_type=build_type)
    post_build_database()
    end = datetime.datetime.now()
    elapsed = end - start
    print elapsed
    npm_install() 
开发者ID:CalthorpeAnalytics,项目名称:urbanfootprint,代码行数:24,代码来源:methods.py

示例7: build_database

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def build_database(build_type='dev', **kwargs):
    """
    Calls footprint_init to load fixture datasets from into the app.

    :param kwargs: all the options for footprint init
    :return:
    """

    # TODO: unify dev+devbuild and prod+init and/or provide a way to
    # override this celery setting. In the mean time this is a hack to
    # make sure we use a build file with CELERY_ALWAYS_EAGER=False
    if build_type == 'dev':
        build_type = 'devbuild'
    elif build_type == 'prod':
        build_type = 'init'
    with cd(get_django_setting(build_type, 'ROOT_PATH')):
        args = ' '.join(["--{}={}".format(key, value) for key, value in kwargs.iteritems()])
        manage_py('footprint_init %s' % args, build_type) 
开发者ID:CalthorpeAnalytics,项目名称:urbanfootprint,代码行数:20,代码来源:methods.py

示例8: setupServers

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def setupServers():
    sudo('yes '' | add-apt-repository ppa:fkrull/deadsnakes-python2.7 -y')
    sudo('apt-get -y update')
    sudo('apt-get -y install python2.7')
    sudo('apt-get -y dist-upgrade')
    sudo('apt-get -y install python-pip python-dev build-essential')
    sudo('apt-get -y install libssl-dev libffi-dev git-all')
    sudo('yes | pip install --upgrade pip')
    sudo('yes | pip install --upgrade virtualenv')
    sudo('yes | pip install --upgrade petlib')
    sudo('yes | pip install twisted==16.6.0')
    sudo('yes | pip install numpy')
    sudo('yes | pip install service_identity')
    sudo('yes | pip install sphinxmix')
    sudo('apt-get -y install htop')
    #sudo('apt-get -y install tshark')
    if fabric.contrib.files.exists("loopix"):
        with cd("loopix"):
            run("git pull")
            run("git checkout %s" % BRANCH)
    else:
        run("git clone https://github.com/UCL-InfoSec/loopix.git") 
开发者ID:UCL-InfoSec,项目名称:loopix,代码行数:24,代码来源:fabfile.py

示例9: deployMultiClient

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def deployMultiClient(num):
    local('rm -f testMap.csv')
    for i in range(int(num)):
        dirc = 'client%s' % i
        with cd(dirc):
            with cd('loopix'):
                run("git pull")
                run("git checkout %s" % BRANCH)
            with cd('loopix/loopix'):
                N = hexlify(os.urandom(8))
                providers = getProvidersNames()
                prvName = random.choice(providers)
                port = int(9999 - i)
                print "CLIENT: Client%s" % N
                run("python setup_client.py %d %s Client%s %s" % (port, str(env.host), N, prvName))
                get('publicClient.bin', 'publicClient-%d-%s.bin'%(port, env.host))
                with open('testMap.csv', 'a') as outfile:
                    csvW = csv.writer(outfile)
                    csvW.writerow(['Client%s'%N, dirc]) 
开发者ID:UCL-InfoSec,项目名称:loopix,代码行数:21,代码来源:fabfile.py

示例10: rollback

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def rollback():
    """
    Reverts project state to the last deploy.
    When a deploy is performed, the current state of the project is
    backed up. This includes the last commit checked out, the database,
    and all static files. Calling rollback will revert all of these to
    their state prior to the last deploy.
    """
    with project():
        with update_changed_requirements():
            update = "git checkout" if env.git else "hg up -C"
            run("%s `cat last.commit`" % update)
        with cd(join(static(), "..")):
            run("tar -xf %s" % join(env.proj_path, "last.tar"))
        restore("last.db")
    restart() 
开发者ID:keithadavidson,项目名称:ansible-mezzanine,代码行数:18,代码来源:fabfile.py

示例11: delete_old_builds

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def delete_old_builds(history):
    ''' Auto delete unnecessary build directories from the filesystem. '''
    build_path = get_release_dir()
    kept_builds = map(lambda x: get_build_name(x['id']), history['builds'])
    found_builds = fs.glob(build_path)
    to_be_deleted_builds = [x for x in found_builds if x not in kept_builds]
    deletion_count = len(to_be_deleted_builds)

    # Skip, if there are no builds to be deleted.
    if deletion_count == 0:
        return

    # Remove directories to be deleted.
    with cd(build_path):
        fs.rm_rf(to_be_deleted_builds)
        remote_info(
            'Deleted {} old build(s) from the remote'.format(deletion_count)
        ) 
开发者ID:kabirbaidhya,项目名称:boss,代码行数:20,代码来源:buildman.py

示例12: all_run

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def all_run(directory='distributed_rl', num_proc='4'):
    with cd(directory):
        with settings(warn_only=True):
            run("./run.sh %s" % num_proc) 
开发者ID:neka-nat,项目名称:distributed_rl,代码行数:6,代码来源:fabfile.py

示例13: actor_run

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def actor_run(directory='distributed_rl', num_proc='1', learner_host='localhost'):
    print('num_proc: %s' % num_proc)
    print('learner_host: %s' % learner_host)
    with cd(directory):
        with settings(warn_only=True):
            run("./run.sh %s config/actor.conf %s" % (num_proc, learner_host)) 
开发者ID:neka-nat,项目名称:distributed_rl,代码行数:8,代码来源:fabfile.py

示例14: learner_run

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def learner_run(directory='distributed_rl'):
    with cd(directory):
        with settings(warn_only=True):
            run("./run.sh 0 config/learner.conf localhost") 
开发者ID:neka-nat,项目名称:distributed_rl,代码行数:6,代码来源:fabfile.py

示例15: deploy

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import cd [as 别名]
def deploy(branch='master'):
    version_folder = '{rp}/{vf}'.format(rp=ROOT_PATH, vf=VERSION)
    run('mkdir -p {p}'.format(p=version_folder))  
    with cd(version_folder):
        # _create_new_dir() 
        _get_latest_source(branch)
        _update_virtualenv()
        _create_or_update_settings()
        _create_static_media_symlinks()
        _update_static_files()
        _update_database()
        _update_symlink()
        _restart_webserver() 
开发者ID:ecds,项目名称:readux,代码行数:15,代码来源:fabfile.py


注:本文中的fabric.api.cd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。