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

Update opts.py to allow for 'None' timeout-value in client_options #1541

Merged
merged 2 commits into from
Jul 11, 2022
Merged
Changes from 1 commit
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
18 changes: 17 additions & 1 deletion esrally/utils/opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ def to_bool(v):
raise ValueError("Could not convert value '%s'" % v)


def to_none(v):
if v is None:
return None
elif v.lower() == "none":
return None
else:
raise ValueError("Could not convert value '%s'" % v)


def kv_to_map(kvs):
def convert(v):
# string (specified explicitly)
Expand All @@ -76,6 +85,12 @@ def convert(v):
return to_bool(v)
except ValueError:
pass

try:
return to_none(v)
except ValueError:
pass

# treat it as string by default
return v

Expand Down Expand Up @@ -197,7 +212,8 @@ def parse_options(self):
default_client_map = kv_to_map([ClientOptions.DEFAULT_CLIENT_OPTIONS])
if self.argvalue == ClientOptions.DEFAULT_CLIENT_OPTIONS and self.target_hosts is not None:
# --client-options unset but multi-clusters used in --target-hosts? apply options defaults for all cluster names.
self.parsed_options = {cluster_name: default_client_map for cluster_name in self.target_hosts.all_hosts.keys()}
self.parsed_options = {cluster_name: default_client_map for cluster_name in
self.target_hosts.all_hosts.keys()}
else:
self.parsed_options = to_dict(self.argvalue, default_parser=ClientOptions.normalize_to_dict)

Expand Down