-
Notifications
You must be signed in to change notification settings - Fork 42
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
Custom socket connect timeout in Session() #210
Custom socket connect timeout in Session() #210
Conversation
Test:
|
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.
ACK
@JacobCallahan would it make sense to propagate this attribute to broker_settings.yaml
?
I don't think so. When you're checking out the VM, AT is turning it on anyway(if I recall correctly). This setting will mostly be used in cloud VMs. |
@akhil-jha are you using Broker sessions directly instead of through a host object? |
Yea, directly . I did checkout(didn't practically tried) init() of Broker(), I am probably gonna hit No data load from file exception. Since I don't really need any provider setup and I don't think I need to have a broker_settings.yaml for any reason at all. That would be just another thing to maintain. |
Oops, I didn't checkout Host() 🤦♂️ EDIT: I saw that, I think using directly would be simpler. no? To accommodate socket_connect_timeout arg in Host() would require more changes. |
It would indeed, which is why I asked. Most users make connections from the Host objects themselves instead of directly with a Session object. Perhaps, if you make it a configurable option (with a sane default), then that would help them. Otherwise, it would need to be passed down during host object creation. |
aa6296e
to
aedf3b3
Compare
|
@akhil-jha is this ready for merge, or did you want to do some more testing on it? |
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.
Let's switch from this implementation to simply passing this timeout
https://github.com/SatelliteQE/broker/blob/master/broker/hosts.py#L57
to the Sessions created here
https://github.com/SatelliteQE/broker/blob/master/broker/hosts.py#L65
I don't know why I removed it in #151
35f829e
to
695a80c
Compare
@@ -68,6 +68,7 @@ def connect( | |||
password=password, | |||
port=_port, | |||
key_filename=key_filename, | |||
timeout=timeout |
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.
Dependent on settings.HOST_CONNECTION_TIMEOUT
. If not , it'll be none. That means no retry.
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 None, simple_retry should still get your default of 60
so I think we're good here!
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.
Ah right.okay yes.
695a80c
to
e8738c8
Compare
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.
ACK, thanks for the revision!
@@ -68,6 +68,7 @@ def connect( | |||
password=password, | |||
port=_port, | |||
key_filename=key_filename, | |||
timeout=timeout |
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 None, simple_retry should still get your default of 60
so I think we're good here!
@@ -70,7 +70,7 @@ def init_settings(settings_path, interactive=False): | |||
validators = [ | |||
Validator("HOST_USERNAME", default="root"), | |||
Validator("HOST_PASSWORD", default="toor"), | |||
Validator("HOST_CONNECTION_TIMEOUT", default=None), | |||
Validator("HOST_CONNECTION_TIMEOUT", default=60), |
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.
So you want to keep it? or should I remove it?
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.
let's try to keep this version, but we'll need to pay attention to automation after this release is live.
What?
Let the user give a timeout for socket.connect(). Default is still 60.
Why?
In cloud VMs, we get Connection Refused as the machine is not ready to take ssh connection just yet. Increasing the timeouts(reties) solves the issue.
Usage: