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


Python api.get方法代码示例

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


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

示例1: setup_supervisor

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

示例2: experiment1collect

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

示例3: is_enabled

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def is_enabled(revision_config=None):
    is_compatible = True
    is_enabled = common_module.config.get('flamegraph', False)
    if revision_config:
        if revision_config.get('product', 'cassandra') == 'dse':
            logger.info('Flamegraph is not compatible with DSE yet')
            is_compatible = False
        jvm = revision_config.get('java_home', '')
        try:
            jvm = os.path.basename(jvm)
            jvm = jvm[jvm.index('1'):]
            if v.LooseVersion(jvm) < v.LooseVersion('1.8.0_60'):
                logger.info('Flamegraph is not compatible with java <1.8.0_60')
                is_compatible = False
        except ValueError:
            pass
    return is_enabled and is_compatible 
开发者ID:datastax,项目名称:cstar_perf,代码行数:19,代码来源:fab_flamegraph.py

示例4: install_java

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def install_java(packages=None):
    # Try to get the os distribution:
    dist = fab.run('lsb_release -is', quiet=True)
    if dist.return_code != 0:
        dist = fab.run('cat /etc/redhat-release', quiet=True)
    if dist.startswith('CentOS'):
        if not packages:
            packages = ['java-1.7.0-openjdk.x86_64',
                        'java-1.7.0-openjdk-devel.x86_64']
        cmd = 'yum -y install {package}'
    elif dist.startswith('Ubuntu'):
        if not packages:
            packages = ['openjdk-7-jdk']
        fab.run('apt-get update')
        cmd = 'apt-get -y install {package}'
    else:
        raise RuntimeError('Unknown distribution: %s' % dist)
    for package in packages:
        fab.run(cmd.format(package=package)) 
开发者ID:datastax,项目名称:cstar_perf,代码行数:21,代码来源:fab_common.py

示例5: _setup_gradle_authentication

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def _setup_gradle_authentication(config):
    dse_source_build_artifactory_username = config.get('dse_source_build_artifactory_username')
    dse_source_build_artifactory_password = config.get('dse_source_build_artifactory_password')
    dse_source_build_artifactory_url = config.get('dse_source_build_artifactory_url')

    gradle_settings = """
allprojects {{
    repositories {{
        maven {{
            url = "\\"{url}\\""
            credentials {{
                username '{username}'
                password '{password}'
            }}
        }}
    }}
}}
    """.format(username=dse_source_build_artifactory_username, password=dse_source_build_artifactory_password,
               url=dse_source_build_artifactory_url)

    fab.local('rm -rf ~/.gradle')
    fab.local('mkdir -p ~/.gradle/init.d')
    fab.local('echo "{gradle_settings}" > ~/.gradle/init.d/nexus.gradle'.format(gradle_settings=gradle_settings)) 
开发者ID:datastax,项目名称:cstar_perf,代码行数:25,代码来源:fab_dse.py

示例6: _configure_spark_env

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def _configure_spark_env(config):
    # Place spark environment file on hosts:
    spark_env = config.get('spark_env', '')

    if isinstance(spark_env, list) or isinstance(spark_env, tuple):
        spark_env = "\n".join(spark_env)
    spark_env += "\n"

    spark_env_script = "spark-{name}.sh".format(name=uuid.uuid1())
    spark_env_file = StringIO(spark_env)
    fab.run('mkdir -p ~/fab/scripts')
    fab.put(spark_env_file, '~/fab/scripts/{spark_env_script}'.format(spark_env_script=spark_env_script))

    fab.puts('spark-env is: {}'.format(spark_env))
    if len(spark_env_script) > 0:
        spark_env_path = os.path.join(get_dse_path(), 'resources', 'spark', 'conf', 'spark-env.sh')
        fab.run('cat ~/fab/scripts/{spark_env_script} >> {spark_env_path}'.format(spark_env_script=spark_env_script,
                                                                                  spark_env_path=spark_env_path)) 
开发者ID:datastax,项目名称:cstar_perf,代码行数:20,代码来源:fab_dse.py

示例7: update_config

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def update_config(self, content, path):
        old_file = six.BytesIO()
        if files.exists(path, use_sudo=self.sudo):
            fab.get(remote_path=path, local_path=old_file, use_sudo=self.sudo)
        old_content = old_file.getvalue()
        need_update = content != old_content
        if need_update:
            fabricio.move_file(
                path_from=path,
                path_to=path + '.backup',
                sudo=self.sudo,
                ignore_errors=True,
            )
            fab.put(six.BytesIO(content), path, use_sudo=self.sudo, mode='0644')
            fabricio.log('{path} updated'.format(path=path))
        else:
            fabricio.log('{path} not changed'.format(path=path))
        return need_update 
开发者ID:renskiy,项目名称:fabricio,代码行数:20,代码来源:postgres.py

示例8: install_python_reqs

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def install_python_reqs():
    sudo('apt-get update --fix-missing')
    # We need the Python headers (python-dev) for compiling some libraries
    sudo('apt-get -y install python-virtualenv python-dev python-pip')
    # Readability dependencies for lxml
    sudo('apt-get -y install libxslt1-dev libxml2-dev libz-dev') 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:8,代码来源:fabfile.py

示例9: install_rabbitmq

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def install_rabbitmq():
    # RabbitMQ is our message queue
    sudo('echo "deb http://www.rabbitmq.com/debian/ testing main" >> /etc/apt/sources.list')
    sudo('apt-get -y install wget sudo')
    sudo('apt-get -y install ca-certificates')
    sudo('wget --quiet -O - https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -')
    sudo('apt-get update --fix-missing')
    sudo('apt-get -y install rabbitmq-server') 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:10,代码来源:fabfile.py

示例10: install_postgres

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def install_postgres():
    sudo('echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/pgdg.list')
    sudo('wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
  sudo apt-key add -')
    sudo('apt-get update')
    sudo('apt-get -y install postgresql-9.4 postgresql-server-dev-9.4 postgresql-contrib-9.4') 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:8,代码来源:fabfile.py

示例11: install_redis

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def install_redis():
    # Used for temporarily saving incoming tab saves
    sudo('apt-get -y install redis-server') 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:5,代码来源:fabfile.py

示例12: install_phantomjs

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

示例13: config_environment

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def config_environment():
    sudo('apt-get -y install git screen')
    sudo('adduser crestify --disabled-password --gecos GECOS')
    sudo('locale-gen en_US.UTF-8')
    with settings(sudo_user='crestify', shell='/bin/bash -c'):
        with cd('/home/crestify'):
            sudo('git clone https://github.com/crestify/crestify.git crestify')
            sudo('virtualenv crestifyenv')
            with prefix('source crestifyenv/bin/activate'):
                sudo('pip install -r crestify/requirements.txt') 
开发者ID:dhamaniasad,项目名称:crestify,代码行数:12,代码来源:fabfile.py

示例14: passcache

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def passcache():
    # Delete old folder and make a new one
    sudo( 'rm -rf /home/ubuntu/projects/rscoin')
    sudo("apt-get install -y sysbench")

    with cd('/home/ubuntu/projects'):
        sudo('pip install petlib --upgrade')
        run("git clone https://github.com/gdanezis/rscoin.git") 
开发者ID:gdanezis,项目名称:rscoin,代码行数:10,代码来源:fabfile.py

示例15: get_flamegraph_directory

# 需要导入模块: from fabric import api [as 别名]
# 或者: from fabric.api import get [as 别名]
def get_flamegraph_directory():
    return common_module.config.get('flamegraph_directory', '/tmp/flamegraph') 
开发者ID:datastax,项目名称:cstar_perf,代码行数:4,代码来源:fab_flamegraph.py


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