Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where update_virtualenv would ignore virtualenv flags #282

Merged
merged 1 commit into from
Jul 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions streamparse/cli/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ def submit_topology(name=None, env_name="prod", workers=None, ackers=None,
create_or_update_virtualenvs(
env_name,
name,
"{}/{}.txt".format(config["virtualenv_specs"], name),
virtualenv_flags=env_config.get('virtualenv_flags'))
"{}/{}.txt".format(config["virtualenv_specs"], name))
streamparse_run_path = '/'.join([env.virtualenv_root, name, 'bin',
'streamparse_run'])
# Update python paths in bolts
Expand Down
19 changes: 12 additions & 7 deletions streamparse/cli/update_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from fabric.contrib.files import exists

from .common import add_environment, add_name
from ..util import activate_env, die, get_config, get_topology_definition
from ..util import (activate_env, die, get_config, get_env_config,
get_topology_definition)


@parallel
Expand Down Expand Up @@ -42,8 +43,7 @@ def _create_or_update_virtualenv(virtualenv_root,
run("rm {}".format(tmpfile))


def create_or_update_virtualenvs(env_name, topology_name, requirements_file,
virtualenv_flags=None):
def create_or_update_virtualenvs(env_name, topology_name, requirements_file):
"""Create or update virtualenvs on remote servers.

Assumes that virtualenv is on the path of the remote server(s).
Expand All @@ -53,6 +53,10 @@ def create_or_update_virtualenvs(env_name, topology_name, requirements_file,
:param requirements_file: path to the requirements.txt file to use
to update/install this virtualenv.
"""
topology_name = get_topology_definition(topology_name)[0]
env_name, env_config = get_env_config(env_name)

# Setup the fabric env dictionary
activate_env(env_name)
# Check to ensure streamparse is in requirements
with open(requirements_file, "r") as fp:
Expand All @@ -68,7 +72,8 @@ def create_or_update_virtualenvs(env_name, topology_name, requirements_file,
.format(requirements_file))

execute(_create_or_update_virtualenv, env.virtualenv_root, topology_name,
requirements_file, virtualenv_flags=virtualenv_flags,
requirements_file,
virtualenv_flags=env_config.get('virtualenv_flags'),
hosts=env.storm_workers)


Expand All @@ -84,9 +89,9 @@ def subparser_hook(subparsers):

def main(args):
""" Create or update a virtualenv on Storm workers. """
name = get_topology_definition(args.name)[0]
topology_name = get_topology_definition(args.name)[0]
config = get_config()
config["virtualenv_specs"] = config["virtualenv_specs"].rstrip("/")
create_or_update_virtualenvs(args.environment, name,
create_or_update_virtualenvs(args.environment, topology_name,
"{}/{}.txt".format(config["virtualenv_specs"],
name))
topology_name))