Relative URLs

My production is on Linux and my local machine is Windows. So, if I use local URL, then every time I have to change the URL before uploading the workflow for the report to be generated. Hence, I setup a similar folder structure in my workspace so I can use relative URLs. When I create a workflow in local environment with relative URL, my expectation is that it should work on the production environment as well. However, even though it works on local (Windows environment), it miserably fails on production (Linux environment). The message I receive is:

  • ERROR URL to File Path 3:20: Execute failed: URL does not point to a local file: knime://knime.mountpoint/bm_repo/WFlow_Logs/CARA/Reports/Branch/BR100_Dormant_Acct_Activated.xlsx

But when I login to the server from Knime AP, and copies the relative URL, it is exactly the same as above which is as below:
knime://knime.mountpoint/bm_repo/WFlow_Logs/CARA/Reports/Branch/BR100_Dormant_Acct_Activated.xlsx

I am not sure what mistake I am doing but I am unable to make it work with relative URLs.

I am actually reading the location for files using “List Files/Folders” node and allowing the user to select a file using a “Value Selection Widget” node, finally passing the URL details to “File Download Widget” node.

This whole thing works perfectly on local machine but not on server.

Hi,
The problem is that on the server this knime://knime.mountpoint URL cannot be translated to a file path, as the files sit on the server and not the local file system. The workflow is executed on the executor, which does not contain all the files in the server repository. Therefore knime://knime.mountpoint URLs are translated to HTTP requests to the server’s REST API to retrieve the files. A File Path to them does not exist. What do you need the file path for? I am sure there is a different way of doing what you try to achieve. The Column Expression node, for example, has several functions for extracting parts of a KNIME Path object under the “Path” category.
Kind regards,
Alexander

Thank you @AlexanderFillbrunn for your response. I need the file path to provide the download option for the user. The user should be able to click the download link and download the file to his/her machine.

Hi,
Can’t you also create this download link from the output of the List Files/Folders node? You can construct the download link like this:

https://yourknimeserver.com/knime/rest/v4/repository/bm_repo/WFlow_Logs/CARA/Reports/Branch/path/to/file:data

Here you need to replace yourknimeserver.com with the correct domain name and path/to/file with the path to the file to download in your repository. You should be able to assemble these URLs using a String Manipulation node.
Kind regards,
Alexander

Oh! That’s an excellent suggestion. I tried manually and it worked. So, I can automate it. One more quick question. Is there way, I can get the URL until the “bm_repo” folder in an automatic way or do I need to manually append it? Basically, the URL for rest.

Hi,
Unfortunately, I do not know a way of infering the URL on the executor. I would suggest adding a String Configuration node to your workflow for configuring the server URL (https://yourknimeserver.com/knime) the /rest/v4/repository/ part is always the same, so you can hardcode it into your workflow. The advantage of the configuration node is that when you run your job or create a schedule via AP, you can change the URL under “Configuration Options”. That way even when the server domain changes, you can reuse the workflow without changing it.
Kind regards,
Alexander

Thank you @AlexanderFillbrunn, I was thinking of using the String Manipulator to join the string. But just want to check if there is a better way of doing things.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.