I am looking for a method to determine the excat location of a Workflow to trigger certain different paths.
Example 1:
I need to know if a workflow is stored locally or opened via the remote workflow editor from any HUB Space.
The reason is a configuration made on the HUB Connector, which is configured as “Current KNIME HUB”, but on a local workflow, this configuration is not working, so I need to explicitly call the HUB. This connector is embedded in a component, as we widley use it in a multitude of workflows. So it would be great, if we can build in a logic that can easily determine, where the workflow was opened/is originally stored. (in the Context properties, i could not find a suitable and safe config)
If it is running as a job, it of course can use the current HUB option (this can be done by th job id missing or not)
Example 2:
We want to trigger some components to write into different schemas, depending on their space location.
Let’s assume we have a Space “DEVSpace” and a Space “ProductionSpace”. The Database has a Schema “DEV_Schema” and a Shema “PROD_Schema”. So whenever the workflow runs from the “DEVSpace” I want to have a variable created with “DEV_Schema” and, if it runs on “ProductionSpace” the variable should be set to “PRODSpace”. ideally this can be done in a node, that can be used in every workflow, to ensure the correct “reading and writing” to the database.
Hi @KirkThieme , and welcome to the KNIME community
I don’t know if there is a better way, but if you look at the Context Properties on the Extract Context Properties node, and find the following variables:
context.workflow.absolute-path
knime.workspace
for a locally stored workflow, I believe the workflow.absolute-path will start with the value in knime.workspace, but for a remote (downloaded) workflow it won’t.
I don’t have a business hub to play with at the moment, so I’m taking a few guesses here, but does that help at all?
Of course if the downloaded one then gets saved locally, the path would change to the workspace, so I don’t know if you are also trying to see if that has happened.
this is already a good way, I need to test it if it completely fulfills my need
But basically you are saying if
context.workflow.absolute-path.contains(knime.workflow)
I can assume, somebody using the component is on a local machine.
if it differs, (because absolute path points to a temp space) then it is running on the hub.
Now I only need to determine which space on the HUB
the job id field will be empty when running locally but filled when running on the knime server or knime hub.
In AP 5.4 there are also now additional properties regarding the knime hub which includes the space it is being executed from. these are all also empty when running locally.