コード例 #1
0
ファイル: deploy.py プロジェクト: SohuTech/essay
def deploy(version, venv_dir, profile):
    """ 发布指定的版本,会自动安装项目运行所需要的包

        version:build之后的版本
        venv_dir:虚拟环境名称
        profile:profile参数会传递到supervisord.conf中
    """

    if not version:
        version = build.get_latest_version()

    virtualenv.ensure(venv_dir)

    pre_hook = getattr(env, 'DEPLOY_PRE_HOOK', None)
    post_hook = getattr(env, 'DEPLOY_POST_HOOK', None)

    with virtualenv.activate(venv_dir):
        if callable(pre_hook):
            pre_hook(version, venv_dir, profile)
        supervisor.ensure(project=env.PROJECT, profile=profile)
        package.install(env.PROJECT, version)
        supervisor.shutdown()
        supervisor.start()
        if callable(post_hook):
            post_hook(version, venv_dir, profile)
コード例 #2
0
ファイル: supervisor.py プロジェクト: SohuTech/essay
def start(venv_dir=None, retry=0, retry_interval=2, max_retries=3):
    """
    重启指定虚拟环境的supervisor
    venv_dir 指定虚拟环境地址
    retry 当前重试次数
    retry_interval 多少秒后开始重试
    max_retries 最大重试次数
    """

    if retry > max_retries:
        print(red('start supervisord FAIL!'))
        return

    if venv_dir:
        with virtualenv.activate(venv_dir):
            start()

    if 'CURRENT_VIRTUAL_ENV_DIR' not in env:
        raise Exception('只可以在虚拟环境安装Python包')

    venv_dir = env.CURRENT_VIRTUAL_ENV_DIR

    with settings(warn_only=True), cd(venv_dir):
        # 停止supervisor管理的进程
        result = run('bin/supervisord -c etc/supervisord.conf ')
        if result:
            retry += 1
            print(green('start supervisord fail, retry[{}]'.format(retry)))
            start(retry=retry, retry_interval=retry_interval, max_retries=max_retries)
コード例 #3
0
ファイル: deploy.py プロジェクト: zhanghongxi517/essay
def deploy(version, venv_dir, profile):
    """ 发布指定的版本,会自动安装项目运行所需要的包

        version:build之后的版本
        venv_dir:虚拟环境名称
        profile:profile参数会传递到supervisord.conf中
    """

    if not version:
        version = build.get_latest_version()

    virtualenv.ensure(venv_dir)

    pre_hook = getattr(env, 'DEPLOY_PRE_HOOK', None)
    post_hook = getattr(env, 'DEPLOY_POST_HOOK', None)

    with virtualenv.activate(venv_dir):
        if callable(pre_hook):
            pre_hook(version, venv_dir, profile)
        supervisor.ensure(project=env.PROJECT, profile=profile)
        package.install(env.PROJECT, version)
        supervisor.shutdown()
        supervisor.start()
        if callable(post_hook):
            post_hook(version, venv_dir, profile)
コード例 #4
0
def start(venv_dir=None, retry=0, retry_interval=2, max_retries=3):
    """
    重启指定虚拟环境的supervisor
    venv_dir 指定虚拟环境地址
    retry 当前重试次数
    retry_interval 多少秒后开始重试
    max_retries 最大重试次数
    """

    if retry > max_retries:
        print(red('start supervisord FAIL!'))
        return

    if venv_dir:
        with virtualenv.activate(venv_dir):
            start()

    if 'CURRENT_VIRTUAL_ENV_DIR' not in env:
        raise Exception('只可以在虚拟环境安装Python包')

    venv_dir = env.CURRENT_VIRTUAL_ENV_DIR

    with settings(warn_only=True), cd(venv_dir):
        # 停止supervisor管理的进程
        result = run('bin/supervisord -c etc/supervisord.conf ')
        if result:
            retry += 1
            print(green('start supervisord fail, retry[{}]'.format(retry)))
            start(retry=retry,
                  retry_interval=retry_interval,
                  max_retries=max_retries)
コード例 #5
0
ファイル: __init__.py プロジェクト: lyoniionly/onlinetodos
def git_deploy(venv_dir, profile):
    virtualenv.ensure(venv_dir)

    with virtualenv.activate(venv_dir):
        supervisor.ensure(project=env.PROJECT, profile=profile)
        package.install_from_git(env.PROJECT)
        supervisor.shutdown()
        supervisor.start()
コード例 #6
0
ファイル: __init__.py プロジェクト: yangsheng1/onlinetodos
def git_deploy(venv_dir, profile):
    virtualenv.ensure(venv_dir)

    with virtualenv.activate(venv_dir):
        supervisor.ensure(project=env.PROJECT, profile=profile)
        package.install_from_git(env.PROJECT)
        supervisor.shutdown()
        supervisor.start()
コード例 #7
0
ファイル: supervisor.py プロジェクト: JeasonG/essay
def _supervisor_command(command, venv_dir=None):
    if venv_dir:
        with virtualenv.activate(venv_dir):
            _supervisor_command(command)

    if 'CURRENT_VIRTUAL_ENV_DIR' not in env:
        raise Exception('只可以在虚拟环境安装Python包')

    venv_dir = env.CURRENT_VIRTUAL_ENV_DIR

    # 停止supervisor管理的进程
    with settings(warn_only=True), cd(venv_dir):
        run('bin/supervisorctl -c etc/supervisord.conf ' + command)
コード例 #8
0
ファイル: deploy.py プロジェクト: zhenchaozhu/starmachine
def deploy(version, venv_dir, profile):
    """
    发布指定的版本

    会自动安装项目运行所需要的包
    """

    virtualenv.ensure(venv_dir)
    with virtualenv.activate(venv_dir):
        supervisor.ensure(project=env.PROJECT, profile=profile)
        package.install(env.PROJECT, version)
        supervisor.shutdown()
        supervisor.start()
コード例 #9
0
def _supervisor_command(command, venv_dir=None):
    if venv_dir:
        with virtualenv.activate(venv_dir):
            _supervisor_command(command)

    if 'CURRENT_VIRTUAL_ENV_DIR' not in env:
        raise Exception('只可以在虚拟环境安装Python包')

    venv_dir = env.CURRENT_VIRTUAL_ENV_DIR

    # 停止supervisor管理的进程
    with settings(warn_only=True), cd(venv_dir):
        run('bin/supervisorctl -c etc/supervisord.conf ' + command)
コード例 #10
0
ファイル: deploy.py プロジェクト: chiehwen/essay
def deploy(version, venv_dir, profile):
    """
    发布指定的版本

    会自动安装项目运行所需要的包
    """

    virtualenv.ensure(venv_dir)

    with virtualenv.activate(venv_dir):
        supervisor.ensure(project=env.PROJECT, profile=profile)
        package.install(env.PROJECT, version)
        supervisor.shutdown()
        supervisor.start()
コード例 #11
0
ファイル: supervisor.py プロジェクト: JeasonG/essay
def start(venv_dir=None):
    """重启指定虚拟环境的supervisor"""

    if venv_dir:
        with virtualenv.activate(venv_dir):
            start()

    if 'CURRENT_VIRTUAL_ENV_DIR' not in env:
        raise Exception('只可以在虚拟环境安装Python包')

    venv_dir = env.CURRENT_VIRTUAL_ENV_DIR

    with settings(warn_only=True), cd(venv_dir):
        # 停止supervisor管理的进程
        run('bin/supervisord -c etc/supervisord.conf ')
コード例 #12
0
def start(venv_dir=None):
    """重启指定虚拟环境的supervisor"""

    if venv_dir:
        with virtualenv.activate(venv_dir):
            start()

    if 'CURRENT_VIRTUAL_ENV_DIR' not in env:
        raise Exception('只可以在虚拟环境安装Python包')

    venv_dir = env.CURRENT_VIRTUAL_ENV_DIR

    with settings(warn_only=True), cd(venv_dir):
        # 停止supervisor管理的进程
        run('bin/supervisord -c etc/supervisord.conf ')