# Do the python binding support getting output?

**URL:** https://discourse.paraview.org/t/do-the-python-binding-support-getting-output/12790
**Category:** Development
**Tags:** python
**Created:** [August 31, 2023, 6:46pm UTC](https://discourse.paraview.org/t/do-the-python-binding-support-getting-output/12790 "2023-08-31T18:46:17Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [August 31, 2023, 6:46pm UTC](https://discourse.paraview.org/t/do-the-python-binding-support-getting-output/12790/1 "2023-08-31T18:46:18Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![berkgeveci](https://discourse.paraview.org/user_avatar/discourse.paraview.org/berkgeveci/32/1464_2.png) [@berkgeveci](https://discourse.paraview.org/u/berkgeveci)
#### Post date: [August 31, 2023, 7:28pm UTC](https://discourse.paraview.org/t/do-the-python-binding-support-getting-output/12790/2 "2023-08-31T19:28:04Z")

</div>

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:

1. With property informations, the way we get the names of existing arrays etc. with data populated in RequestionInformation
2. Field arrays or data in information objects for use by filters downstream
3. 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.

---

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [August 31, 2023, 7:33pm UTC](https://discourse.paraview.org/t/do-the-python-binding-support-getting-output/12790/3 "2023-08-31T19:33:39Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [August 31, 2023, 7:44pm UTC](https://discourse.paraview.org/t/do-the-python-binding-support-getting-output/12790/4 "2023-08-31T19:44:27Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![berkgeveci](https://discourse.paraview.org/user_avatar/discourse.paraview.org/berkgeveci/32/1464_2.png) [@berkgeveci](https://discourse.paraview.org/u/berkgeveci)
#### Post date: [September 1, 2023, 1:44pm UTC](https://discourse.paraview.org/t/do-the-python-binding-support-getting-output/12790/5 "2023-09-01T13:44:30Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [September 1, 2023, 4:01pm UTC](https://discourse.paraview.org/t/do-the-python-binding-support-getting-output/12790/6 "2023-09-01T16:01:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![berkgeveci](https://discourse.paraview.org/user_avatar/discourse.paraview.org/berkgeveci/32/1464_2.png) [@berkgeveci](https://discourse.paraview.org/u/berkgeveci)
#### Post date: [September 1, 2023, 4:48pm UTC](https://discourse.paraview.org/t/do-the-python-binding-support-getting-output/12790/7 "2023-09-01T16:48:13Z")

</div>

I would stick that sort of stuff in the field data of the existing output. You can access that very easily.

---

<div class="post-metadata">

### Author: ![mclarsen](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/d07c76/32.png) [@mclarsen](https://discourse.paraview.org/u/mclarsen)
#### Post date: [September 1, 2023, 4:57pm UTC](https://discourse.paraview.org/t/do-the-python-binding-support-getting-output/12790/8 "2023-09-01T16:57:33Z")

</div>

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!
