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


Python api.run方法代码示例

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


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

示例1: engine_start

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [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

示例2: install

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def install(name):
    with act_virtualenv(name):
        run("pip install uwsgi")
        run("pip install flask==0.12.4")
        run("pip install flask-bootstrap")
        run("pip install flask-script")
        run("pip install flask-moment")
        run("pip install pyminizip==0.2.1")
        run("pip install flask_wtf")
        run("pip install flask_sqlalchemy")
        run("pip install sqlalchemy-migrate")
        run("pip install flask-mail")
        run("pip install flask-login")
        run("pip install flask-ldap-login")
        run("pip install python-ldap")
        run("pip install python-daemon") 
开发者ID:sibosend,项目名称:openvpn-admin-ui,代码行数:18,代码来源:fabfile.py

示例3: keys

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [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

示例4: experiment1collect

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [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

示例5: _clone_code_from_local_path

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def _clone_code_from_local_path(from_path, to_path, run_as_sudo=True):
    cmd_fn = sudo if run_as_sudo else run
    git_local_submodule_config = [
        'git config {} {}'.format(submodule_config.key, submodule_config.value)
        for submodule_config in _get_local_submodule_urls(from_path)
    ]
    git_remote_submodule_config = [
        'git config {} {}'.format(submodule_config.key, submodule_config.value)
        for submodule_config in _get_remote_submodule_urls(from_path)
    ]

    with cd(from_path):
        cmd_fn('git clone {}/.git {}'.format(
            from_path,
            to_path
        ))

    with cd(to_path):
        cmd_fn('git config receive.denyCurrentBranch updateInstead')
        cmd_fn(' && '.join(git_local_submodule_config))
        cmd_fn('git submodule update --init --recursive')
        cmd_fn(' && '.join(git_remote_submodule_config)) 
开发者ID:dimagi,项目名称:commcare-cloud,代码行数:24,代码来源:release.py

示例6: bash

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def bash(script, nodes=None, user=None):
    """Run a bash script on a set of nodes
    
    script - A bash script written as a string or list.
    nodes  - The set of nodes to run the command on. If None, all nodes of 
             the cluster will be used.
    user   - The user to run the command as. If None, the default user specified 
             in the cluster configuration    
    """ 
    if type(script) in (list, tuple):
        script = "\n".join(script)
    if nodes is None:
        nodes = common.fab.env.hosts
    if user is None:
        user = common.fab.env.user
    with common.fab.settings(user=user, hosts=nodes):
        return execute(common.bash, script) 
开发者ID:datastax,项目名称:cstar_perf,代码行数:19,代码来源:benchmark.py

示例7: get_spark_cassandra_stress_command

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def get_spark_cassandra_stress_command(script, node, master, stress_node=None):
    dse_bin = os.path.join(dse.get_dse_path(), 'bin')
    # see conversation on https://github.com/datastax/cstar_perf/pull/226 for why we pass SPARK_MASTER
    # tl;dr on DSE 4.7.x the dse script tries to call dsetool on the spark-cassandra-stress node
    # if SPARK_MASTER env var is not set and this results in a connection error trace as
    # we do not start DSE on the spark-cassandra-stress node
    spark_cassandra_stress_cmd_prefix = 'cd {spark_cass_stress_path}; ' \
                                        'PATH=$PATH:{dse_bin} ' \
                                        'JAVA_HOME={JAVA_HOME} ' \
                                        'DSE_HOME={dse_home} ' \
                                        'SPARK_MASTER={master} '.format(spark_cass_stress_path=get_spark_cassandra_stress_path(stress_node=stress_node),
                                                                        dse_bin=dse_bin,
                                                                        JAVA_HOME=JAVA_HOME,
                                                                        dse_home=dse.get_dse_path(),
                                                                        master=master)

    spark_cass_connection_host_arg = ' --conf spark.cassandra.connection.host={node}'.format(node=node)
    spark_cassandra_run_cmd = './run.sh dse {script} {master} {connection_host}'.format(script=script,
                                                                                        master=master,
                                                                                        connection_host=spark_cass_connection_host_arg)
    cmd = spark_cassandra_stress_cmd_prefix + ' ' + spark_cassandra_run_cmd

    return cmd 
开发者ID:datastax,项目名称:cstar_perf,代码行数:25,代码来源:benchmark.py

示例8: make_doc

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def make_doc():
    with lcd('../docs'):
        local('make html')
        local('cp -rf _build/html/* /var/www/mendelmd_static/docs/')

#def backup():
#    run(' mysqldump -u root -p mendelmd14 | gzip > db_backup/mendelmd151012.sql.gz ') 
开发者ID:raonyguimaraes,项目名称:mendelmd,代码行数:9,代码来源:fabfile.py

示例9: create_sample_data

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def create_sample_data():
    #backup all users
#    with cd('/projects/www/mendelmd14'):
#
#        run('mysqldump -u root -p mendelmd14 auth_user account_account profiles_profile | gzip > db_backup/users.sql.gz')
#        #get sample from individuals
#        run('mysqldump -u root -p --where="individual_id < 16" mendelmd14 individuals_variant | gzip > db_backup/individual_variants_sample.sql.gz')
#        run('mysqldump -u root -p --where="id < 16" mendelmd14 individuals_individual | gzip > db_backup/individuals_sample.sql.gz')


    get('/projects/www/mendelmd14/db_backup/users.sql.gz', '/home/raony/sites/mendelmd14/db_backup/')
    get('/projects/www/mendelmd14/db_backup/individual_variants_sample.sql.gz', '/home/raony/sites/mendelmd14/db_backup/')
    get('/projects/www/mendelmd14/db_backup/individuals_sample.sql.gz', '/home/raony/sites/mendelmd14/db_backup/') 
开发者ID:raonyguimaraes,项目名称:mendelmd,代码行数:15,代码来源:fabfile.py

示例10: loaddata

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def loaddata():
    #Load user and sample from individuals
    local('gunzip < db_backup/users.sql.gz | mysql -u root -p mendelmd')
    local('gunzip < db_backup/individual_variants_sample.sql.gz | mysql -u root -p mendelmd ')
    local('gunzip < db_backup/individuals_sample.sql.gz | mysql -u root -p mendelmd ')


#    run(' gunzip < db_backup/mendelmd151012.sql.gz | mysql -u root -p mendelmd14 ')
#    local("""python manage.py loaddata db_backup/all_without_individuals.json.gz""") 
开发者ID:raonyguimaraes,项目名称:mendelmd,代码行数:11,代码来源:fabfile.py

示例11: deploy

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def deploy(message="changes (fabric)"):
    local('git add .; git commit -m "%s";git push' % (message))
    with cd('/projects/www/mendelmd'):
#        run('git reset --hard HEAD')
        run('git pull')
#        run('source virtualenvwrapper.sh && workon genome_research && python manage.py syncdb --noinput')

        run('sudo /etc/init.d/apache2 restart') 
开发者ID:raonyguimaraes,项目名称:mendelmd,代码行数:10,代码来源:fabfile.py

示例12: up

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def up(mode='-t'):
    down()
    local('docker run %s --name %s ' % (mode, CONTAINER_BASE) +
          ' -v news_data:/root/data -v news_test:/root/_posts ' +
          IMAGE_BASE) 
开发者ID:ailabstw,项目名称:justcopy-backend,代码行数:7,代码来源:fabfile.py

示例13: install_phantomjs

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def install_phantomjs():
    # The PhantomJS headless browser
    sudo('apt-get -y install fontconfig')
    run('wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2')
    run('tar xjf phantomjs-2.1.1-linux-x86_64.tar.bz2')
    sudo('mv phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs') 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:8,代码来源:fabfile.py

示例14: run_migrations

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def run_migrations():
    with settings(sudo_user='crestify', shell='/bin/bash -c'):
        with cd('/home/crestify/crestify'):
            with prefix('source ../crestifyenv/bin/activate'):
                sudo('honcho run python main.py db upgrade')  # Run initial migrations 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:7,代码来源:fabfile.py

示例15: _git_update

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import run [as 别名]
def _git_update():
    with settings(sudo_user="crestify", shell='/bin/bash -c'):
        with cd('/home/crestify/crestify'):
            with prefix('source ../crestifyenv/bin/activate'):
                with settings(sudo_user='crestify', shell='/bin/bash -c'):
                    sudo('git pull')
                    sudo('pip install -r requirements.txt')
                    sudo('honcho run python main.py db upgrade') 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:10,代码来源:fabfile.py


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