I am working on Paraview lite for vtk visualization. With respect to this, I have configured the dataDir in launcher.json file to be loaded as "dataDir": "/home/data/pvw/10"
where 10 is the directory name or number.
The url which is getting loaded in the browser is http://localhost/lite/?data=/10. I am able to see the visualization whenever the URL is triggered.
As there are multiple directories which are to be visualized, I wanted to know if the value provided in the URL can be fetched in the dataDir configuration dynamically. As per my understanding, I think that the value entered in URL (data=/10) is getting assigned to a variable.
Requirement
As per requirement, I am looking to change the dataDir configuration based on the data entered in the URL. For eg, we are looking something as below:
"dataDir": "/home/data/pvw/${variable}"
Note: {variable} - I am expecting this variable will be having the value as “10”, which is passed in URL http://localhost/lite/?data=/10.
Let me know which variable has this data stored? If not, is there any other work around to achieve it?
First of all you need to have the ${variable} in your command line (in launcher config) not in the property section as they won’t be resolved at the same time.
If you use ${variable} in your command line, you will need to provide ?variable=10 in your URL. But if you don’t like the name variable, that is fine, you can use ?sunag=10 and have in your command line ${sunag}.
So, ${variable} or ${sunag} is now assigned in the “cmd” in launch config file.
So, if the user enters different directory numbers like 10, 20, 30 at same time in different url (say, ?sunag=10, ?sunag=20 and so on), how can I get that value assigned to ${sunag} variable.?
This is happening by default and by design. You don’t have to do anything, that is the all point of having a launcher and using the URL to extend the config from it. But that only work when the user connect. Once the process is running for that user, you need to go through the websocket using RPC or pub/sub to ask that process to do more things that were not initially known.
I guess I don’t understand your question or what you are trying to do as for me things are straight forward and I don’t see where you get lost.
To summarize:
the url can be used to provide as many information as your application needs at startup
To me that summary encompass what you are trying to do. After that you just need to tweak your application to leverage that user input the way you want.
Maybe you are missing the point of the launcher. Did you read this?
Okay. I will try to make it clear with what I need.
I have read the documentation and have worked around the launcher for loading a single directory when the url is used. This works well.
What I am trying to make it work is that, the “dataDir” in the “properties” of launcher takes a static argument and opens only that particular directory which is given.
When the URL is provided, the paraview-lite opens with /home/data/pvw/dir1 location.
If at the same time, say, there are users who need to look at different “directory”, for eg:/home/data/pvw/dir2and/home/data/pvw/dir3**.
Since the launcher is static file, I need to kill the process of /home/data/pvw/dir1 instance and change to another directory by tweaking in launcher file and run the start.sh file again everytime.
Remarks:
So, from this understanding, what I observed is that
At a particular time, we can visualize the contents of only one particular directory location
Question
How to modify the launcher config in such a way that we can view different directories at same time where URL endpoint is different for different directories.?
URL eg:
http://localhost/lite/?data=dir1 should show the contents from dir1 location, http://localhost/lite/?data=dir2 should show the contents from dir2 location and so on at same time.
Your point (5) is wrong. Each user connecting is getting a new process. As long as they decide which directory they want to look at from the URL at their startup time, you are good. No need to kill any process or even restart the launcher.
Like I said, you don’t understand the point of the launcher and what it is doing for you, hence your confusion.
Please post the command line section of the launcher so I can post the solution for you.
The launcher config is static but string replacement is happening based on what the user is providing from the URL, that is why you do not need to change such config or restart the launcher.