Get workflow and workflow group location on knime server in a flow variable


I want to get the workflow and workflow group location on Knime server.

for example, if I have a workflow WF1 inside workflow group WG2 (which is inside workflow group WG1), I want a method that allows me to get the location WG1/WG2/WF1 in a flow variable.

It is possible through Extract Context Properties on KAP, but I am getting temporary locations when I use the same on knime server.

Thanks for helping

Hello, welcome to the KNIME Forum!

The reason you are seeing a different output on a job run on the server is because the job is actually being stored in a different location while the executor runs it. Thus, the context.workflow.path is showing where the job is being run from.

What is the use-case you need the path for? I can maybe help you find a different solution on how to achieve it.



So the idea is to get a output file storage structure (preferably on S3 or something similar) which is similar to the file/folder structure for workflows on knime server. This would help to maintain and organize outputs.

To achieve this, we want to create a component, that can be attached to any workflow and will automatically generate the path for storage of output, without any specific user intervention.



So the problem here is that when a job is being run on an executor, it doesn’t know the directory structure from where it came from. You’ll need to pull that information from the server in a call. You can do this via REST, but the easiest way IMO would be using the KNIME Server Connection and List Remote Files nodes to pull the directory as a data table. From there you can apply some additional logic to match it with the results from the variable given from the Context Properties node.

Let me know if this helps you in what you are trying to achieve!

1 Like