Hello,
Please accept my apologies for a long description.
We are using Paraview at the moment to visulaize OpenFoam files and we are planning to use it in Browser (Web). We want our sever to do heavy-lifting and browser rendering the results. There are a couple of products provided by Paraview and based on a couple of topics in this forum (most of them are old). I was under this impression that we should use paraviewweb. However, ParaviewWeb looks to be deprecated and no docker image has been created in last 4 years.
Main Question
- What is the way forward to have paraview in web ? Which tools or project we should use? Trame or ParaviewWeb, Paraview (using luncher )?
To have a better understand of products, I have tried most of the examples provided while I hit walls on each of them as described below. Skip to issue 3, if we have to use Trame. Our sever specification:
- Ubuntu 18
- Instance type: g3.4xlarge
- NVIDIA-SMI 470.141.03 Driver Version: 470.141.03 CUDA Version: 11.4
Issue 1 : I started with single user example in ParaViewWeb (kitware.github.io) and it is working. We need to have multi-session, So I followed the instruction to use Launcher in ParaViewWeb (kitware.github.io). Per run command provided as shown below, we should build Paraview in order to run luncher with luncher config.
$ cd ParaView/build
$ ./bin/pvpython lib/site-package/vtk/web/launcher.py launcher.config
Question 1:
- Is there anyway to run Paraview luncher with binary file that can be downloaded from Download ParaView? Like using version “ParaView-5.10.1-MPI-Linux-Python3.9-x86_64”
- if not, how to build Paraview and run luncher?
Issue 2:
As we stuck on previous issue, we tried following instruction for Docker ParaViewWeb (kitware.github.io) and EC2 ParaViewWeb (kitware.github.io). Both instructions were failing with issue described in Minified reaction error #31 and websocket connection error · Issue #534 · Kitware/paraviewweb (github.com). We followed your suggestion of using generic pvm-* image and following generic container instruction in ParaViewWeb (kitware.github.io).
We created www (with index.html) and launcher (with config.json file as shown below) folders. We ran the docker with three different images including “kitware/paraviewweb:pvw-v5.6.0-egl”, “kitware/paraview:pvw-master-egl-py3” and “kitware/paraview:pvw-v5.8.0-egl-py3” (changed config file to reflect the path for different paraview version. in all three experiment we get below error message when redirecting to ec2-IP-XX-XX.ap-southeast-2.compute.amazonaws.com/paraview route. The root is showing the index.html successfully and visualizer path is returning 503.
Error
: 2023-04-16 07:21:30,183:CRITICAL:twisted:
Traceback (most recent call last):
File "/opt/paraview/lib/python3.6/site-packages/twisted/web/server.py", line 199, in process
self.render(resrc)
File "/opt/paraview/lib/python3.6/site-packages/twisted/web/server.py", line 259, in render
body = resrc.render(self)
File "/opt/paraview/lib/python3.6/site-packages/twisted/web/resource.py", line 250, in render
return m(request)
File "/opt/paraview/lib/python3.6/site-packages/wslink/launcher.py", line 607, in render_GET
id = extractSessionId(request)
File "/opt/paraview/lib/python3.6/site-packages/wslink/launcher.py", line 252, in extractSessionId
path = request.path.split('/')
***TypeError: a bytes-like object is required, not 'str'***
Launcher/config.json
{
"resources": [ {"port_range": [9010, 9014], "host": "ec2--IP-XX-XX.ap-southeast-2.compute.amazonaws.com"} ],
"sessionData": {},
"configuration": {
"log_dir": "/opt/launcher/log",
"host": "localhost",
"endpoint": "paraview",
"sessionURL": "SESSION_URL_ROOT/proxy?sessionId=${id}&path=ws",
"timeout": 25,
"upload_dir": "/data/upload",
"fields": [],
"port": 9000,
"proxy_file": "/opt/launcher/proxy-mapping.txt",
"sanitize": {
"file": {
"type": "regexp",
"regexp": "^[-\\\\w./]+$",
"default": "emptyFile"
}
}
},
"properties": {
"dataDir": "/data",
"webapps_dir": "/opt/paraview/share/paraview-5.8/web",
"python_exec": "/opt/paraview/bin/pvpython"
},
"apps": {
"MySuperPVWApp": {
"cmd": [
"${python_exec}",
EXTRA_PVPYTHON_ARGS
"/pvw/server/pvw-server.py",
"--port", "${port}",
"--authKey", "${secret}",
"--timeout", "30"
],
"ready_line" : "Starting factory"
},
"visualizer": {
"cmd": [
"${python_exec}",
EXTRA_PVPYTHON_ARGS
"${webapps_dir}/visualizer/server/pvw-visualizer.py",
"--port", "${port}",
"--data", "${dataDir}",
"--authKey", "${secret}",
"--viewport-max-width", "1920",
"--viewport-max-height", "1080",
"--timeout", "30"
],
"ready_line" : "Starting factory"
},
"visualizer-with-file": {
"cmd": [
"${python_exec}",
EXTRA_PVPYTHON_ARGS
"${webapps_dir}/visualizer/server/pvw-visualizer.py",
"--port", "${port}",
"--data", "${dataDir}",
"--authKey", "${secret}",
"--viewport-max-width", "1920",
"--viewport-max-height", "1080",
"--timeout", "30",
"--load-file", "${file}"
],
"ready_line" : "Starting factory"
},
"paraview-lite": {
"cmd": [
"${python_exec}",
EXTRA_PVPYTHON_ARGS
"${webapps_dir}/lite/server/pvw-lite.py",
"--port", "${port}",
"--data", "${dataDir}",
"--authKey", "${secret}",
"--viewport-max-width", "1920",
"--viewport-max-height", "1080",
"--timeout", "30"
],
"ready_line" : "Starting factory"
},
"divvy": {
"cmd": [
"${python_exec}",
EXTRA_PVPYTHON_ARGS
"${webapps_dir}/divvy/server/pvw-divvy.py",
"--port", "${port}",
"--data", "${dataDir}/${file}",
"--authKey", "${secret}",
"--viewport-max-width", "1920",
"--viewport-max-height", "1080",
"--timeout", "30"
],
"ready_line" : "Starting factory"
}
}
}
Docker command
export PORT=8080
export DATA=/home/ubuntu/fujin
export DEPLOY=/home/ubuntu/fujin/mypvw/
export SERVER_NAME=ec2-IP-XX-XX.ap-southeast-2.compute.amazonaws.com:443
export PROTOCOL=ws
sudo docker run --gpus all \
-p 0.0.0.0:${PORT}:80 \
-v ${DATA}:/data \
-v ${DEPLOY}:/pvw \
-e "SERVER_NAME=${SERVER_NAME}" \
-e "PROTOCOL=${PROTOCOL}" \
-dti kitware/paraview:pvw-v5.8.0-egl-py3
Apache 001-pvw.conf
<VirtualHost *:80>
ServerName ec2--IP-XX-XX.ap-southeast-2.compute.amazonaws.com
ServerAdmin arash@example.com
DocumentRoot /home/ubuntu/fujin/mypvw/www
ErrorLog /home/ubuntu/fujin/mypvw/logs/error.log
CustomLog /home/ubuntu/fujin/mypvw/logs/access.log combined
ProxyPass /visualizer http://localhost:8080/visualizer
ProxyPassReverse /visualizer http://localhost:8080/visualizer
ProxyPass /paraview http://localhost:8080/paraview
RewriteEngine On
RewriteMap session-to-port txt:/home/ubuntu/fujin/mappingfile/proxy.txt
RewriteCond %{QUERY_STRING} ^sessionId=(.*)&path=(.*)$ [NC]
# This does the rewrite using the mapping file and the sessionId
RewriteRule ^/proxy.*$ ws://${session-to-port:%1}/%2 [P]
<Directory /home/ubuntu/paraviewweb-docker/testsite/www>
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
Question 2
- Any idea what we missed in this setup?
- Do you have any plan creating updated Paraview Image such as version 5.10?
Issue 3:
Considering having issues in above two approaches, we continued our investigation on using Kitware/paraview-visualizer: Web frontend to ParaView based on trame (github.com). there was on issue in Pip and Npm Installation and finally we ran below command on Ubuntu 18:
../ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython -m paraview.apps.trame --venv myvenv --trame-app pv_visualizer --data /home/ubuntu/fujin/paraview-visualizer/
../ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython -m paraview.apps.trame --venv myvenv --trame-app pv_visualizer --data /home/ubuntu/fujin/paraview-visualizer/
Error:
ubuntu@ip-172-20-2-55:~/fujin/paraview-visualizer$ ../ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/bin/pvpython -m paraview.apps.trame --venv myvenv --trame-app pv_visualizer --data /home/ubuntu/fujin/paraview-visualizer/
ParaView is using venv: /home/ubuntu/fujin/paraview-visualizer/.venv
VisRTX 0.1.6, using devices:
0: Tesla M60 (Total: 8.0 GB, Available: 7.6 GB)
App running at:
- Local: http://localhost:8080/
- Network: http://172.20.2.55:8080/
Note that for multi-users you need to use and configure a launcher.
Traceback (most recent call last):
File "/home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/apps/trame.py", line 26, in <module>
main()
File "/home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/apps/trame.py", line 23, in main
module.main()
File "/home/ubuntu/fujin/paraview-visualizer/pv_visualizer/app/main.py", line 41, in main
return server.start(**kwargs)
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/core.py", line 556, in start
task = CoreServer.server_start(
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/protocol.py", line 50, in server_start
return server.start_webserver(
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/wslink/server.py", line 301, in start_webserver
return exec_modes[exec_mode]()
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/wslink/server.py", line 284, in main_exec
loop.run_until_complete(create_coroutine())
File "/home/ubuntu/fujin/ParaView-5.10.1-MPI-Linux-Python3.9-x86_64/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/wslink/backends/aiohttp/__init__.py", line 126, in start
port_callback(self.get_port())
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/protocol.py", line 95, in port_callback
self.server.controller.on_server_ready(**self.server.state.to_dict())
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/controller.py", line 283, in __call__
results = list(map(lambda f: f(*args, **kwargs), copy_list))
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/controller.py", line 283, in <lambda>
results = list(map(lambda f: f(*args, **kwargs), copy_list))
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_server/controller.py", line 277, in __call__
result = f(*args, **kwargs)
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_vtk/widgets/vtk/common.py", line 547, in update
self.update_geometry(
File "/home/ubuntu/fujin/paraview-visualizer/.venv/lib/python3.9/site-packages/trame_vtk/widgets/vtk/common.py", line 487, in update_geometry
delta_state = MODULE.scene(
TypeError: scene() got an unexpected keyword argument 'widgets'
Question 3
- Any idea what we missed in configurations?