opensistemas-hub / osbrain

osBrain - A general-purpose multi-agent system module written in Python
https://osbrain.readthedocs.io/en/stable/
Apache License 2.0
176 stars 43 forks source link

Name server shutdown #265

Closed Peque closed 6 years ago

Peque commented 6 years ago

If #264 is merged, name server shutdown is asynchronous, which means we trust it will be shut down after the call.

Maybe we could at least check that the proxy Pyro4 connection to the name server is lost? Only if there is a reliable way of doing so.

ocaballeror commented 6 years ago

Why not test that the name server is actually shut down? The name server process runs in the same machine as the agents in our test suite, so I don't see why we can't check that the name server is actually shut down.

Peque commented 6 years ago

@ocaballeror That would work for our test suit, but ideally we should implement something that works well for other use cases (i.e.: the name server might not be in the same machine).

ocaballeror commented 6 years ago

If the name server is not in the same machine, then there's nothing we can do to check if it's actually dead. I don't think sending a one-way call and then checking if the connection is alive is a good idea. The way I see it, if we send a one-way shutdown call it's because we don't know/care if the nameserver will be able to respond. In that case, checking if we can connect to it afterwards kinda defeats the whole purpose of this change, because we might as well send a synchronous request and wait for the response, which would be easier.

@Peque do you see what I mean? We can ~argue~ politely discuss this over Hangouts if you prefer :smile: .

Peque commented 6 years ago

Yeah, no need for now. :blush: #264 is a WIP and will probably not include the oneway call for shutdown. I am having a look at it right now, but found other problems with the pytest --boxed option and some PUB-SUB synchronization issues. I'll try to fix that and see if everything works as expected.