Hi everyone,

I am trying to setup a method using async objects, and I am having a number 
of issues including the use of storing callbacks in a dictionary for future 
use.  Also, the async objects seem to call the callbacks prior to receiving 
the data, or before a timeout is reached.  Sample code below:

# trying to call an async object
rc = rpyc.connect('', port=10000)
exposed_method = rpyc.async(rc.root.exposed_method)
asyncFunc = exposed_method("test data","test data 2")
asyncFunc.set_expiry(10)
asyncFunc.add_callback(self.relay_callback("some value"))
self.asyncFuncDict[key] = asyncFunc
self.callbacks[key] = client_callback

# in my local callback function (relay_callback)  
asyncFunc = self.asyncFuncDict.get(key)
client_callback = self.callbacks.get(key)
asyncFunc.wait()
client_callback(asyncFunc.value)

So, I am trying to call another process first by connecting to it, and then 
setting up an async wrapper around a method exposed by the other process. 
 I want my relay_callback function to be called when either the value is 
ready, or the timeout has been reached.  I try to save a handle to my 
asyncFunc and my client_callback so that I can use them later to relay the 
value.  However, when I pull the client_callback out of my dictionary, I am 
unable to use it as a callback.  Python thinks it is just a string.  Also, 
my "relay_callback" function is called before the value is ready or the 
timeout is expired, which is not what I would expect. I am unable to call 
wait() (or any other methods of an AsyncResult object) on my asyncFunc, 
since it is no longer recognized as an AsyncResult.

Thank you for any insight you can provide.

-Mark

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"rpyc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to