Hi all,
We have built a couple of workflows which are used by multiple of clients. Whenever a client executes the workflow, it will automatically determine which client is executing the workflow, what their cloud storage locations, preferred databases, etc. are.
This all works for us, but we have an issue since we want clients to be able to schedule these workflows, including choosing the filters & flow variables to use.
With the use of the POST, PUT and DELETE request API calls I’ve made a workflow which let our clients schedule a workflow on the set date and/or interval.
The issue comes when they need to configure schedule with flow variables (including filters and settings). In the API /rest/v4/repository/{path}:scheduled-jobs there is a possibility to set the configuration in JSON format to for example a String Configuration node.
To give you some background information, our clients need to execute the same workflows with different parameters/filters on different intervals (e.g. the workflow will loop through a list of assets and determines which assets to include in the current workflow execution: asset 1, 2 and 3 on weekly basis, asset 4,5,6 on monthly basis, asset 7,8 * 9 on a monthly basis).
When setting this String Configuration from within the KNIME AP, the flow variable is called Workflow Schedule JSON. However, this will not the way our clients will schedule workflows, as they will use the WebPortal.
Unfortunately in the API this String Configuration has the Node ID included in the configuration. In this example the Node ID is 10.
"configuration" : {
"workflow_schedule_JSON-10" : "Here comes the JSON configuration"
},
In the POST request we cannot simply use the flow variable workflow_schedule_JSON, but we have to use workflow_schedule_JSON_10. This means we cannot automate this API configuration dynamically, because in every workflow this Node ID will most likely have another value.
My first question: Is there maybe another way to workaround this issue in the API configuration by not including the Node ID?
My second question: Is there a way to identify if a workflow is executed as a scheduled job (1) or manual execution (2)?
If we could identify if the workflow is executed as a schedule, we could read the configuration (specific for this scheduled job) from an external source (such as a database table). We can link these configuration via the Schedule Job ID/name (we’ve made the names unique) inside the workflow.
With the Extract Context Properties node we can extract the context.job.id variable, but this does not tell if the workflow is executed as schedule or manually executed.
Thanks!
RK