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

Changed Hub.registration_timeout to be a config input. #5303

Closed
wants to merge 1 commit into from
Closed

Changed Hub.registration_timeout to be a config input. #5303

wants to merge 1 commit into from

Conversation

TD22057
Copy link
Contributor

@TD22057 TD22057 commented Mar 9, 2014

I did a quick test on my local machine with this. I couldn't figure out how to commit back to the github server so I did an online edit so someone should double check that everything is OK.

@@ -410,7 +417,8 @@ def __init__(self, **kwargs):
"""

super(Hub, self).__init__(**kwargs)
self.registration_timeout = max(10000, 5*self.heartmonitor.period)
if self.registration_timeout <= 0:
Copy link
Member

Choose a reason for hiding this comment

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

This type of validation should be done in a validation method _registration_timeout_changed method that traitlets will call automatically each time the value is set.

@TD22057
Copy link
Contributor Author

TD22057 commented Mar 10, 2014

I put the validation there because the registration_timeout value needs to change when you set it OR when you set the hearmonitor period. If it's automatic, then what you get is order dependent. Of course I might not understand exactly how the traits work either...

@ellisonbg
Copy link
Member

Then I think you should add validation logic to the traits handler for both of these attributes. The problem is that if you ever change the value after the class is created, the validation won't be performed.

@minrk minrk added this to the 2.0 milestone Mar 11, 2014
@minrk
Copy link
Member

minrk commented Mar 11, 2014

The traits duplication / validation is more complicated than it should be because I created the Factory stuff before we had config, and it mostly serves the same purpose (i.e. HubFactory does all validation and initialization for Hub). The trait does not need to be validated twice. Hopefully I will find the time to remove all of the Factory classes for 3.0.

I made a PR against your branch (TD22057/ipython#1) to add the appropriate validation to registration_timeout.

@minrk
Copy link
Member

minrk commented Mar 13, 2014

@TD22057 I made a PR against your branch. Do you want to merge that? If you aren't comfortable with that, I can finish this up in another PR.

@TD22057
Copy link
Contributor Author

TD22057 commented Mar 13, 2014

@minrk Sorry - I got yanked off this at work to finish something else and haven't had time to come back it. Given that I'd need to learn how to do the merge, it would be fantastic if you could take care of it. Or I can get back to this sometime next week if you want to wait - either way is fine with me.

@minrk
Copy link
Member

minrk commented Mar 13, 2014

No problem, I'll finish it up. Thanks!

@minrk
Copy link
Member

minrk commented Mar 13, 2014

will continue this PR in #5349.

@minrk minrk closed this Mar 13, 2014
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.

None yet

3 participants