[Paraview-developers] Fwd: Invoke remote procedure from proxy with argument and return value
Mario Schreiber
schreibermario40 at gmail.com
Tue Dec 13 12:53:34 EST 2016
Dear developers,
I am urgently looking for a possibility to invoke methods with return
values on the server from a paraview python client. For performance reasons
(high latency network) this should not need more than a single
client-server request.
This appears to be a difficult task, at least I couldn't get any reply on
the users list for a week (see below). I'd appreciate if you could guide me
in the right direction, and if there is no easy solution, maybe enumerate a
few steps where I have to interfere with the message protocol to include a
return value.
Thank you
Mario
---------- Forwarded message ----------
From: Mario Schreiber <schreibermario40 at gmail.com>
Date: 2016-12-11 18:01 GMT+01:00
Subject: Re: Invoke remote procedure from proxy with argument and return
value
To: paraview at paraview.org
Why is it so complicated to call a procedure and receive a return value on
the client?
I am attaching my attempt (CMakeLists.txt, vtkSquareFun.cxx, vtkSquareFun.h
and TestPlugin.xml, each less than 20 lines of code), which basically
calculates the square of an argument in vtkSquareFun::eval(double x).
When I load this plugin in Paraview and open the Python Shell, I can
evaluate vtkSquareFun::eval() using a detour by first setting the argument
and then getting the result, which is linked to the argument property in
TestPlugin.xml:
fun=servermanager.CreateProxy("test","SquareFun")
fun.GetProperty("Arg").SetElement(0,999)
fun.UpdateVTKObjects()
fun.UpdatePropertyInformation()
fun.GetProperty("Result").GetElement(0)
... showing the correct result 998001.
Why can't I simply run the following?
fun=servermanager.CreateProxy("test","SquareFun")
result=fun.InvokeCommand("eval",[999.0])
Does Paraview really not provide any means of calling a function with
arguments and return value within a single client-server communication? All
these individual message transfers are a bottleneck in our application.
Does the Paraview architecture exclude more universal remote procedure
calls, or do you think that one could just augment the available procedures
with another procedure that can deliver a set of custom return values?
Thanks
Mario
2016-12-07 7:34 GMT+01:00 Mario Schreiber <schreibermario40 at gmail.com>:
> Hello,
> I have a use case, where a vtkObject on the server implements a method like
>
> std::string doSomething(std::string arg);
>
> Now, with a proxy prx on the client for that class, I would like to call
> the remote procedure similar to
>
> result=prx.InvokeCommand("doSomething",[arg])
>
> Is something like this possible?
> I found a very complicated workaround by first defining the arguments as
> properties, defining the result as information_only property linked to on
> of the args, then calling "UpdateVTKObjects" to push the arguments and
> finally "UpdateInformationProperties" to pull the result. Is there an
> easier solution, possible with a short example?
>
> Thank you
> Mario
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20161213/62da072e/attachment.html>
-------------- next part --------------
FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})
ADD_PARAVIEW_PLUGIN(TestPlugin "1.0"
SERVER_MANAGER_XML TestPlugin.xml
SERVER_MANAGER_SOURCES vtkSquareFun.cxx
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestPlugin.xml
Type: text/xml
Size: 625 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20161213/62da072e/attachment.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkSquareFun.cxx
Type: text/x-c++src
Size: 311 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20161213/62da072e/attachment.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkSquareFun.h
Type: text/x-chdr
Size: 421 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20161213/62da072e/attachment.h>
More information about the Paraview-developers
mailing list