How to specify protocols.py python file while running existing docker image

Hi ,

I want to save series of png files from paraview web visualizer application.
for that I have done changes in protocols.py file as

Save actual screenshot

            # simple.SaveScreenshot(fullPath)
            # view = self.getView(viewId)
            resolution = v.ViewSize
            simple.SaveAnimation(filePath, view, ImageResolution=resolution) # FrameWindow=[0, 43]

Now i want to supply this file while running docker, so that it will create png for all my loaded data files.
i am using paraview 5.6.0 docker on ec2. Its an existing docker image, I just want to write all the loaded files into png format.

I am using below command to run existing docker “pvw-visualizer-osmesa-master”,

sudo docker run --rm -p 127.0.0.1:8081:80 -v /home/ubuntu/animation/data:/data -v /home/ubuntu/animation/Web/python/paraview/web/protocols.py -v /home/ubuntu/animation/pvw/launcher:/pvw/launcher -v /home/ubuntu/animation/pvw:/pvw -e “SERVER_NAME=ec2-3-91-190-5.compute-1.amazonaws.com” -e “PROTOCOL=ws” -e “EXTRA_PVPYTHON_ARGS=-dr,–mesa-swr,Web/python/paraview/web/protocols.py” -ti docker.io/kitware/paraviewweb:pvw-visualizer-osmesa-master ws://ec2-3-91-190-5.compute-1.amazonaws.com

I am supplying the file as
-v /home/ubuntu/animation/Web/python/paraview/web/protocols.py but it is not picking up

also I am trying to supply it as args to EXTRA_PVPYTHON_ARGS
“visualizer”: {
“cmd”: [
“${python_exec}”,
EXTRA_PVPYTHON_ARGS
“/home/ubuntu/animation/Web/python/paraview/web/protocols.py”,

But it does not work, My question here is, I want to modify one python file , Do i need to build whole new paraview build or new Docker ?
OR can i specify it as argument.

Please let me know.
Thanks,
Nitin Kadam.

Hi Nitin,

The pvpython program cannot take the protocols.py path as an argument, so don’t follow that path any further. You might still be able to achieve your goal of swapping a different protocols.py in an existing pre-built container, however. I think your best bet is to pick the pvw containers [1] (pick one that starts with pvw) which allow you to run what we refer to as a “fully external” web application, where you mount a directory containing your web application.

There are some docs [2] you should read on that, but the basic idea would be for you to take the pvw visualizer server python code and built javascript application (tarball available here[3]), and just patch the pvw-visualizer.py to import your edited protocols.py (which should also live in the directory you mount). If you run into issues where your replacement protocols.py can’t import other paraview web python modules, you may need to copy those into your mounted directory as well.

All this isn’t terribly difficult, but it’s probably not trivial either, especially if you’re not comfortable with the various pieces involved. So feel free to continue responding on this thread if you decide to try it out and run into issues.

Cheers,

Scott

[1] https://hub.docker.com/repository/docker/kitware/paraview/tags?page=1

[2] http://kitware.github.io/paraviewweb/docs/container_overview.html#Layer-Two-ParaViewWeb

[3] https://registry.npmjs.org/pvw-visualizer/-/pvw-visualizer-3.2.0.tgz

Hi Scott,

Thanks for the suggestions. I worked on it and I did Visualiser javascript build using npm.
Now I am facing problem that where should I specify the new Visualiser.js file?

i am running below docker,
sudo docker run --rm -p 127.0.0.1:8081:80 -v /home/ubuntu/animation/data:/data -v /home/ubuntu/animation/pvw/launcher:/pvw/launcher -v /home/ubuntu/animation/pvw:/pvw -e “SERVER_NAME=ec2-3-91-98-13.compute-1.amazonaws.com” -e “PROTOCOL=ws” -e “EXTRA_PVPYTHON_ARGS=-dr,–mesa-swr” -ti docker.io/kitware/paraviewweb:pvw-visualizer-osmesa-master ws://ec2-3-91-98-13.compute-1.amazonaws.com

I tried to put it as visualiser.js in document root in apache server conf file but it is not working.

DocumentRoot /home/ubuntu/visualizer-build/visualizer/dist
(in dist my new Visualiser.js file is present)

Let me know where to specify this new javascript file for visualiser.

Thanks,
Nitin Kadam.