Problems with launcher.py

Hello,
I was trying to follow this setup guide for Multi-users in ParaViewWeb, but instead of using Apache I am using VTK.js in an Angular application. I am using ParaView 5.10.1 and the path to launcher.py is C:\Program Files\ParaView 5.10.1-Windows-Python3.9-msvc2017-AMD64\bin\Lib\site-packages\wslink, I was trying to configure it with this file:

{
  // ===============================
  // General launcher configuration
  // ===============================

  "configuration": {
    "host" : "localhost",                           // name of network interface to bind for launcher webserver
    "port" : 8080,                                  // port to bind for launcher webserver
    "endpoint": "paraview",                         // SessionManager Endpoint
    "proxy_file" : "/.../proxy-mapping.txt",  // Proxy-Mapping file for Apache
    "sessionURL" : "ws://${host}:${port}/ws",       // ws url used by the client to connect to started process
    "timeout" : 5,                                  // Wait time in second after process start
    "log_dir" : "./viz-logs",                    // Directory for log files
    "upload_dir" : "/.../uploadDirectory",          // Start file upload server on same port as launcher
    "fields" : ["file", "host", "port", "updir"]    // Fields not listed are filtered from response
  },

   // ===============================
   // Useful session vars for client
   // ===============================

  "sessionData" : { "key": "value" },      // Dictionary of values interesting to the client

  // ===============================
  // Resources list for applications
  // ===============================

  "resources" : [ { "host" : "localhost", "port_range" : [9001, 9003] } ],

  // ===============================
  // Set of properties for cmd line
  // ===============================

  "properties" : {
    "build_dir" : "/.../build",
    "python_exec" : "/.../build/bin/vtkpython",
    "WWW" : "/.../build/www",
    "source_dir": "/.../src",
    "vtkpython" : "/.../VTK/build/bin/vtkpython",
    "pvpython" : "/.../ParaView/build/bin/pvpython",
    "vtk_python_path": "/.../VTK/build/Wrapping/Python/vtk/web",
    "pv_python_path": "/.../ParaView/build/lib/site-packages/paraview/web",
    "plugins_path": "/.../ParaView/build/lib",
    "dataDir": "/.../path/to/data/directory"
  },

  // ===============================
  // Application list with cmd line
  // ===============================

  "apps": {
    "visualizer": {
        "cmd": [
            "${pvpython}", "-dr", "C:\\Users\\User\\Documents\\pvw_server.py",
            "--port", "${port}", "-f", "--authKey", "${secret}"
        ],
        "ready_line" : "Starting factory"
    }
  }
}

This is the config object in the Angular application:

const config = {
      application: 'visualizer',
      sessionManagerURL: 'http://localhost:8080/paraview',
      };

When I start the launcher with pvpython and the configuration, the server runs listening to port 8080, but when I am try to make a POST, I get a 404 error, in the log file I see that the endpoint is reached. Am I doing something wrong? Is there anything missing?
Thanks.

I would cleanup your launcher config to remove everything you don’t use. And then I would clarify what you mean by log and post request endpoint.

{
  "configuration": {
    "host" : "localhost",                         
    "port" : 8080,                                  
    "endpoint": "paraview",                   
    "proxy_file" : "proxy-mapping.txt",  
    "sessionURL" : "ws://${host}:${port}/ws",    
    "timeout" : 25,
    "log_dir" : ".", 
    "fields" : []
  },

  "resources" : [ { "host" : "localhost", "port_range" : [9001, 9050] } ],

  "properties" : {
    "pvpython": "C:\\Program Files\\ParaView 5.10.1-Windows-Python3.9-msvc2017-AMD64\\bin\\pvpython.exe"
  },

  "apps": {
    "visualizer": {
        "cmd": [
            "${pvpython}", "-dr", "C:\\Users\\User\\Documents\\pvw_server.py",
            "--port", "${port}", "-f", "--authKey", "${secret}"
        ],
        "ready_line" : "Starting factory"
    }
  }
}

I modified the launcher.config as you suggested. However, when I run the launcher that is listening to port 8080 I mocked the a HTTP POST to see if the server responded back with the configuration with the sessionURL as described here, but I got this:


I do not know if I have to modify something inside launcher.py. I hope this clarifies the situation.

Try running the launcher on another port. I have no idea, why you get a 404.
Any log from the launcher? Does the launcher start or does it complain that something is already running on port 8080?

I solved it, the problem was the path should have a “/” at end, like this: http://localhost:8080/paraview/. Now the problem I am having is this one:

Access to XMLHttpRequest at 'http://localhost:8080/paraview/' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I am using ng serve. If I make the HTTP request in postman, it works perfectly. Should I change something in launcher.config to not being blocked by CORS policy?

I am not using apache or ngnix, I do not want to build the app. Nontheless, is it necessary to use any of them to create a multi-user server?

Multi-user setup should not be needed for development. But you can create a proxy to your launcher in your ng dev server.

You are right, I tried to use nginx and make direct HTTP request and the fill the config structure for SmartConnect with the response.
I have another problem regarding DELETE, it seems does not work properly, because when I make a DELETE with this url http://localhost:8080/paraview/ I receive a message error from server like this:

{
	"error": "id not provided in DELETE request"
}

But when I provided the id like this http://localhost:8080/paraview/63e544aa-1bde-11ee-95c4-28d0eacffb1a, the server does not found the delete handler, it seems like it recognize this path as a whole new endpoint without handler.

The DELETE is disabled by default.
You need to export WSLINK_LAUNCHER_DELETE=1 to enable it.

Hi again,
I was trying to implement WSS, I activated the command lines suggested in the tutorial with apache but I only get https, a new visualization session is created over ‘ws’ not ‘wss’. Do I have to modify something else?
Thanks

I changed the launcher config file from this "ws://${host}:${port}/ws" to this "sessionURL" : "wss://${host}:443/proxy?sessionId=${id}&path=ws".
It seems to work like this.

For ParaViewWeb indeed, you need to use wss://.... For trame with our client and default config, that protocol mapping is automatic. launcher & client

I was trying to run the apache server on my PC and the launcher.py inside a Docker container but the WSS does not work, it only works like this "ws://${host}:${port}/ws". But if I run both apache server and launcher.py on my PC, it works normally. Why does not it work on a Docker container?

The launcher needs to write a mapping file for Apache. It should work as long that file is properly shared between docker and your host (permission and path).

Thank you so much!

1 Like