-
Notifications
You must be signed in to change notification settings - Fork 267
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
Spawner waits for services #683
Conversation
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
I also have no idea how to test this fixes the race condition other than my local environment. I was not able to produce a minimal example that showed the race condition however reading the code it seems obvious to me that there is a race condition. As to unit testing these new functions I don't know where to start with writing python unit tests. If someone would like to point me to an example I'd be happy to try write unit tests for these new functions (and the old one that it doesn't look like anyone tested). |
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
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.
This looks good, but I am just not sure if this is not to complicate code for the task since there are many function injections. Probably an additional for-loop for checking the services would also do.
Other than that, having an output with “wait” notification as previously existed would be useful.
Regarding tests, you can check this file for spawner tests.
It seems that the Galactic binary job (galactic, testing) is experiencing the same test failures I am locally seeing. I'll try running tests without this change and see if they pass. |
Is that log actually useful? You did catch that I removed it. |
I did look at that and it seems that it only tests the spawner from the outside. Is there some way to ask the controller_manager to start without services? That might be a valid way to write a black box test like what is shown here that would verify this code does what you expect. |
Is there some way you think this would be clearer with for loops? I started implementing it that way and found that I had a bunch of copy-pasta between checking for the node to exist and checking for the services to exist so I tried to separate the algorithmic code and the checks it was doing. |
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
I put the log back in the wait_for function so you get a log when it is waiting for the controller_manager to initialize and cleaned up that if statement with an assignment expression. |
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
I fixed the logging some more to troubleshoot this and it actually doesn't seem to work for me. Maybe something about galactic is broken? If I run |
Consider that you are actually submitting this against rolling, which is correct. We would back-port this than to galactic. |
I know, I just can't test this on rolling because rolling is so broken right now. |
759a22f
to
a9f0c46
Compare
I believe this now works. I am still unsure how to test 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.
This'd require some heavy mocking to test and I think the utility of that would be questionable. Probably the best way forward is trial by fire
Nitpick: I found writing Python with type annotations very maintainable, perhaps that'd help the readability but that could be a good first issue for anyone, not necessarily needed in this PR |
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.
In general, it looks good to me!
thank you for bringing us this approach, it's amazing!!
Co-authored-by: Erick G. Islas-Osuna <erickisos653@gmail.com>
@erickisos I accepted your changes but it looks like they aren't passing the formatter check. Would you mind pushing a change that fixes that or would you like me to? |
Sorry @tylerjw , let me check! |
Co-authored-by: Erick G. Islas-Osuna <erickisos653@gmail.com>
Co-authored-by: Erick G. Islas-Osuna <erickisos653@gmail.com>
@Mergifyio backport galactic |
* Spawner waits for services Signed-off-by: Tyler Weaver <tyler@picknik.ai> Co-authored-by: Erick G. Islas-Osuna <erickisos653@gmail.com> (cherry picked from commit 038741e)
✅ Backports have been created
|
Signed-off-by: Tyler Weaver tyler@picknik.ai
Resolves #682
To send us a pull request, please:
colcon test
andpre-commit run
(requires you to install pre-commit bypip3 install pre-commit
)Testing
Locally I'm getting two test failures with this. I would appreciate any help in resolving these test failures: