8000 make cli options available to pre_submit_hooks by emmettbutler · Pull Request #396 · pystorm/streamparse · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

make cli options available to pre_submit_hooks #396

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

Merged
merged 2 commits into from
Sep 12, 2017

Conversation

emmettbutler
Copy link
Contributor

This PR makes CLI options available to pre_submit_hooks, as well as passing them to create_or_update_virtualenvs. It also ensures that storm.workers.list set on the CLI is used in these contexts. This allows client programs to override the storm workers list from the CLI.

use storm.workers.list from cli in remove_logs and create_or_update_virtualenvs
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 46.538% when pulling dcda51c on bugfix/workers_options into f449f9b on master.

Copy link
Member
@dan-blanchard dan-blanchard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together! This will be useful for cases (like Parse.ly's) where you want to modify the list of workers you get back from Nimbus.

Just needs a couple minor changes.

@@ -120,7 +120,10 @@ def activate_env(env_name=None):
"""
env_name, env_config = get_env_config(env_name)

env.storm_workers = get_storm_workers(env_config)
if options and 'storm.workers.list' in options:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case where we'd want to keep an empty list here? Seems like we'd be better off with

if options.get('storm.workers.list'):

@@ -230,7 +230,10 @@ def resolve_options(cli_options, env_config, topology_class, topology_name,

# If ackers and executors still aren't set, use number of worker nodes
if not local_only:
storm_options['storm.workers.list'] = get_storm_workers(env_config)
if 'storm.workers.list' not in storm_options:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if storm_options.get('storm.workers.list'):

might be better since we otherwise ignore empty lists.

if 'storm.workers.list' not in storm_options:
storm_options['storm.workers.list'] = get_storm_workers(env_config)
else:
storm_options['storm.workers.list'] = storm_options['storm.workers.list'].split(",")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proba 8000 bly best to check that this is a string before doing this a split, incase someone passes in a list.

# Run pre_submit actions provided by project
_pre_submit_hooks(override_name, env_name, env_config)
_pre_submit_hooks(override_name, env_name, env_config, options)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make these available to _post_submit_hooks too for consistency.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 46.51% when pulling a6a4026 on bugfix/workers_options into f449f9b on master.

@emmettbutler
Copy link
Contributor Author

@dan-blanchard This is tested locally and should be ready to go if the changes look good to you.

@dan-blanchard dan-blanchard merged commit 951d7a3 into master Sep 12, 2017
@dan-blanchard dan-blanchard deleted the bugfix/workers_options branch September 12, 2017 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0