-
Notifications
You must be signed in to change notification settings - Fork 313
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
Set retry-on-timeout=true for ES clients used by Telemetry devices #507
Conversation
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 the PR. I left a couple of suggestions.
esrally/mechanic/launcher.py
Outdated
@@ -69,6 +69,8 @@ def start(self): | |||
for cluster_name, cluster_hosts in all_hosts.items(): | |||
all_client_options = self.cfg.opts("client", "options").all_client_options | |||
cluster_client_options = all_client_options[cluster_name] |
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.
You are modifying the object in the config directly which leads to side-effects, see e.g. #472. Can you please make a copy with:
cluster_client_options = dict(all_client_options[cluster_name])
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.
Great catch thanks!
esrally/mechanic/launcher.py
Outdated
@@ -69,6 +69,8 @@ def start(self): | |||
for cluster_name, cluster_hosts in all_hosts.items(): | |||
all_client_options = self.cfg.opts("client", "options").all_client_options | |||
cluster_client_options = all_client_options[cluster_name] | |||
# Use retries for telemetry connections: http://elasticsearch-py.readthedocs.io/en/latest/index.html#automatic-retries |
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.
Can you please explain the reason why we're doing this in the comment (e.g. to avoid aborts on long-living connections)?
esrally/mechanic/launcher.py
Outdated
@@ -69,6 +69,8 @@ def start(self): | |||
for cluster_name, cluster_hosts in all_hosts.items(): | |||
all_client_options = self.cfg.opts("client", "options").all_client_options | |||
cluster_client_options = all_client_options[cluster_name] | |||
# Use retries for telemetry connections: http://elasticsearch-py.readthedocs.io/en/latest/index.html#automatic-retries | |||
cluster_client_options.update({"retry-on-timeout": True}) |
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.
Why not:
cluster_client_options["retry-on-timeout"] = True
tests/mechanic/launcher_test.py
Outdated
retry_timeout_setting = {"retry-on-timeout": True} | ||
|
||
for telemetry_device in cluster.telemetry.devices: | ||
self.assertLessEqual(retry_timeout_setting.items(),telemetry_device.client.client_options.items()) |
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 could use assertDictEqual
here to check whether the client dictionary contains only expected 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.
My thought here is that this test cares about ensuring that the specific option is set and we won't need to update it, if, for whatever reason, other client option settings, specified in the Class Attributes, change in the future. I don't mind changing it to what you are suggesting though.
Thanks for the review! I addressed the comments can you take another pass please? |
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! LGTM
Closes #502