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
Fix Nailgun failure when the port is not specified #7878
Fix Nailgun failure when the port is not specified #7878
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.
lgtm!
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.
The commit description seems over the top to me. This is all just the common pattern of using meaningful default param values instead of None plus check in constructor. That central lesson and fix is pretty well obscured by a wall of text.
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.
The commit description seems over the top to me.
Agreed, and very good feedback. Because I hadn't yet run the fix through Twitter tests—and it took a while to figure out how all the pieces fit together—I was retracing my steps as an exercise in reasoning about the correctness of the solution. While useful to me, doesn't mean it's helpful in the PR description. I shortened it quite a bit.
Thanks for the review both!
Downstream Twitter tests were failing to compile certain targets with the error message: ``` zinc[zinc-java](path/to/target:target) failed: an integer is required (got type NoneType) ``` This happens when `ProcessManager.socket` returns `None`, which is an expected return value: https://github.com/pantsbuild/pants/blob/e727747e036584301fb4dac5203597fd1066d6f7/src/python/pants/pantsd/process_manager.py#L306-L309 This ends up resulting in the nailgun code trying to use `None` for the `port`, which is invalid and causes the error. Instead, we use Pants' idiom of setting the default to `None` and in the body of the constructor then defaulting to the actual default value we care about.
Downstream Twitter tests were failing to compile certain targets with the error message: ``` zinc[zinc-java](path/to/target:target) failed: an integer is required (got type NoneType) ``` This happens when `ProcessManager.socket` returns `None`, which is an expected return value: https://github.com/pantsbuild/pants/blob/e727747e036584301fb4dac5203597fd1066d6f7/src/python/pants/pantsd/process_manager.py#L306-L309 This ends up resulting in the nailgun code trying to use `None` for the `port`, which is invalid and causes the error. Instead, we use Pants' idiom of setting the default to `None` and in the body of the constructor then defaulting to the actual default value we care about.
Downstream Twitter tests were failing to compile certain targets with the error message:
This happens when
ProcessManager.socket
returnsNone
, which is an expected return value:pants/src/python/pants/pantsd/process_manager.py
Lines 306 to 309 in e727747
This ends up resulting in the nailgun code trying to use
None
for theport
, which is invalid and causes the error.Instead, we use Pants' idiom of setting the default to
None
and in the body of the constructor then defaulting to the actual default value we care about.