-
Notifications
You must be signed in to change notification settings - Fork 218
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
Conversation
use storm.workers.list from cli in remove_logs and create_or_update_virtualenvs
There was a problem hiding this 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.
streamparse/util.py
Outdated
@@ -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: |
There was a problem hiding this comment.
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'):
streamparse/cli/common.py
Outdated
@@ -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: |
There was a problem hiding this comment.
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.
streamparse/cli/common.py
Outdated
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(",") |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
@dan-blanchard This is tested locally and should be ready to go if the changes look good to you. |
This PR makes CLI options available to
pre_submit_hooks
, as well as passing them tocreate_or_update_virtualenvs
. It also ensures thatstorm.workers.list
set on the CLI is used in these contexts. This allows client programs to override the storm workers list from the CLI.