Distributed.jl icon indicating copy to clipboard operation
Distributed.jl copied to clipboard

allow initiating peer to close stream gracefully

Open simeonschaub opened this issue 2 years ago • 7 comments

I have a usecase where I would like to remove a worker without killing it. Currently, trying to disconnect from the head node will cause the message handler loop to throw a fatal exception, so this adds a check that the connection is still open when trying to read new messages.

A minimal example of what I'm trying to do can be found here, could adapt that into a test if so desired.

simeonschaub avatar Oct 31 '23 16:10 simeonschaub

@jpsamaroo Looks like GitHub won't let me request a review, but I'd be curious to hear your thoughts on this. Is there a reason we might still want a closed connection to be fatal here?

simeonschaub avatar Nov 01 '23 18:11 simeonschaub

This seems like a good idea to me, but I will yield to @vchuravy for further review. Until then, I'd want a test to ensure that the worker only remains alive when it's incoming to the head node. Additionally, some documentation on how to initiate this kind of connection (with an example) would be an excellent addition to the docs.

jpsamaroo avatar Nov 01 '23 22:11 jpsamaroo

Additionally, some documentation on how to initiate this kind of connection (with an example) would be an excellent addition to the docs.

Agree! My current thinking is that it might be best to move this functionality into a new package and then just link to that in the documentation. Since Distributed is just a regular package now, we should be able to then add this as a test dependency here, right?

Eventually, it might even make sense to move the implementation here but I'd like to experiment with this some more first before we commit to an official API.

simeonschaub avatar Nov 02 '23 10:11 simeonschaub

We certainly would need a test here for this. Right now I am moving slowly on Distributed.jl since I have my hands full with the rest of the stdlibs and I want to move cautiously until we have 1.11 registered.

vchuravy avatar Nov 02 '23 13:11 vchuravy

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.34%. Comparing base (af89e6c) to head (dcc7da8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master       #9      +/-   ##
==========================================
+ Coverage   79.14%   79.34%   +0.19%     
==========================================
  Files          10       10              
  Lines        1899     1898       -1     
==========================================
+ Hits         1503     1506       +3     
+ Misses        396      392       -4     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 06 '24 12:09 codecov[bot]

I have now added an integration test with a lot of the code from https://github.com/simeonschaub/PersistentWorkers.jl. I couldn't really think of a better way to test this. What do you think?

simeonschaub avatar Sep 06 '24 13:09 simeonschaub

@vchuravy or @jpsamaroo would you mind taking another look at this?

simeonschaub avatar Sep 26 '24 14:09 simeonschaub