Continuous output from remote functions#39
Continuous output from remote functions#39psukys wants to merge 3 commits intoalfredodeza:masterfrom
Conversation
| self.logger.debug(docstring) | ||
| self.channel.send("%s(%s)" % (name, arguments)) | ||
| try: | ||
| for item in self.channel: |
There was a problem hiding this comment.
This is not straightforward - there needs to be a finalizer and I have doubts about it being on remoto side (rather than remote function explicitly finalizing)
There was a problem hiding this comment.
isn't it possible to raise an exception here instead of just getting a None?
There was a problem hiding this comment.
I'm not aware (and experienced) with pickling capabilities in this end. What I thought could be an alternative is having some side-channel or trigger that gives us end-of-stream (since we might want to reuse the channel for further communication and so on)
There was a problem hiding this comment.
This would basically mean that no function would be allowed to not return anything (which implicitly returns a None) or explicitly return a None unless it wants to really close the channel.
I don't have a use case for this explicitly, but I would prefer an exception. There is no need to pickle anything here though, as you can see the exception is being handled in the next few lines and we are able to poke inside. Something like EOFError('close') would be enough for us to check this?
There was a problem hiding this comment.
Sorry for being inactive for quite a while. I saw that there's util.RemoteError, what is its relation to execnet.RemoteError functionality?
There was a problem hiding this comment.
the naming is unfortunate, but it is just a helper to try to detect the remote exception name. There is no relation to execent.RemoteError
There was a problem hiding this comment.
Also, I'm not sure regarding EOFError from guest side. Having something like this:
def test():
for i in range(1, 10):
channel.send(i)
channel.send(EOFError('close'))
if __name__ == '__channelexec__':
for item in channel:
eval(item)returns me a DumpError as EOFError is not serializable, while:
def test():
for i in range(1, 10):
channel.send(i)
raise EOFError('close')
if __name__ == '__channelexec__':
for item in channel:
eval(item)finishes silently (not caught by execnet?)
There was a problem hiding this comment.
I knew this wouldn't be straightforward :( If EOFError is not serializable, I would try with other exceptions. Basically, to find a way where the connection is able to detect there is nothing else coming in, in a non-generic way (e.g. implicit None can't be used).
|
@alfredodeza so far, what I've come up with is explicitly sending something specific back to (in this scenario Not sure how to progress, maybe include method this in |
So far, I've only used a pretty trivial implementation that accepts continuous output from a remote module. Duplicated wrapper to differentiate upon a set parameter
self.continuousto not break previous implementations.Remote module used
foo.py:Solves #38