We have developed a custom reader plugin that we interact with via python. There are cases where we want to get information out from the reader. What is the best way to retrieve information from the plugin via python?
Can you be a bit more specific? Do you want the information for the pipeline downstream? Or do you want it on the client(application)-side? Also, is this meta-data (known at RequestInformation stage) or part of the full data set (known at RequestData stage)?
There are multiple ways to do this. Here are some:
- With property informations, the way we get the names of existing arrays etc. with data populated in RequestionInformation
- Field arrays or data in information objects for use by filters downstream
- Via Fetch() which fetches the output of a filter to the client/application side
There is also the most hacky way for when client & server are running in the same process and that is using the GetClientSideObject() to get a pointer to the pipeline object and then calling whatever methods you see fit. I suggest staying away from this approach.
More specifically, I wan’t to invoke a c++ function from python that executes on all ranks inside the reader but completely outside of pipeline execution. A simple example could be a MPI reduce that returns a single number.
I suppose one way of doing this might be to make custom filter that creates a dataset containing the output I am looking for, but I am hoping that there is a simpler way.
What is the output that you are looking for? A few numbers? A VTK dataset? …
Also, when do you need it? After the filter executes it or after it generates meta-data?
Here is an example of what I am looking for. Say I launch pvbatch 8 ranks. I want to find the max memory usage (RSS) for each rank and get the total. I just want a few numbers.
I would stick that sort of stuff in the field data of the existing output. You can access that very easily.
Sounds good. My plan is to create a new filter that outputs an empty dataset will field data containing the information I am looking for. I’ll fetch that in python and log the information. Thanks Berk!