Quick forms and Server execution -scheduler

Hi,

I have a workflow published on the Knime server that uses quick forms to get user inputs for its execution.

In parallel to this type of execution, I would like to be able to use the job scheduler to run this workflow on a regular basis. In that case, I will use default values for user input parameters.

How can I do this with the same workflow? My understanding is that if I want to run the workflow with the scheduler, I should use global variables that I will set up when I schedule the job – I do not need quick forms then. Is there a way to enable/disable usage of global variables depending on the execution mode (batch scheduler/interactive mode)? A workaround is to make a copy of that workflow, set default values for quick form entries, set up the scheduler and uncheck the “reset before execution” option but we then have 2 different versions of the same workflow for similar usage. I am not sure this is the best approach.

Thanks in advance for your help,

Regards,

Claire

Hi @Claire

this is currently not supported out of the box.

What you can do is the following

  1. Setup the Workflow Variables for scheduling (one for each Quickform you want to have in the workflow controllable)
  2. Control the default Value of the Quickform with the value of the Workflow Variable. As in the image below. You need to go to the flow variable tab and need to open the default Value and set the value inside. E.g. in the image it is the double quickform so it is a double.

image

What happens than, if you execute the workflow via the webportal the default will be overwritten by the user input.
If you schedule the workflow, the defaults are taken from the set workflow variables, as there are no interaction which can overwrite it.

Let me know if this did work for you!
Best, Iris

Hi Iris,
Would you have a basic workflow to illustrate this?
Thks,
Claire

Hi Claire,

yes please find the workflow attached. WebportalAndScheduling.knwf (29.5 KB)

Let me go with you through the steps.

  1. Add a new workflow variable. (Right Click on the workflow and choose Workflow Variables… the workflow must be opened to be able to do so)

  2. Add the Workflow Variables in the dialog.

image

Afterwards save the settings with OK.

  1. Add Quickforms to your workflow. You can find them in my workflow inside the Inputs via Webportal Wrapped metanode.
    image

  2. Inside the wrapped metanode, add the Workflow Variables to be visible inside the Wrapped Metanode. This must be done in the WrappedNode Input Node Dialog.

  1. Connect the wrappedNodeInput with the Quickforms via FlowVariable Ports, to send over the variables.

image

  1. Inside the quickforms dialog, go to the flow variable tab and choose a flow variable for the default value from the Workflow Variables.

  1. Make sure to give the quickform a different variable names to the ones you have given in the workflow variables.

  2. Send the variables to the outside with the Wrapped Node Output. Here as well you need to configure in the dialog to send the variables to the toplevel workflow.

image

Afterwards, the defaults will be used, if there is no interaction from the webportal. The defaults are the Workflow Variables.

I hope this helps, I know this is a little bit tricky. We will continue to improve the usability of this.

Cheers, Iris

2 Likes

Hi Iris,
Thanks a lot it helps. I got confused and posted this question because in a previous workflow I developed, I used a global variable (no quick form at all). I published the workflow and this global variable is displayed in the web portal just below the meta information. See screenshot. Do you have any idea why it behaves this way? I made a copy of your workflow and removed the quick forms, leaving only the global variables. When I publish this copy it runs with its default values – global variables are not displayed. I do not understand why the global variable of my 1st workflow show up in the web portal. Any idea?
Thanks,
Regards,
Claire

Hi Claire,

that is a legacy feature. Before we introduced the Power of the quickforms. One could use the Workflow variables to control the workflow.

This still works, if you have really no Quickform and new JavaScript node in your workflow. Than it will use the old mechanism and display the Workflow Variables.

This is marked to be deprecated in the future.

Best wishes, Iris

Hi Iris, Ok - thanks for the clarification.
Regards, Claire

Hi Iris,
I have additional questions regarding the workflow you proposed. I followed your instructions for my workflow and got the results described below:

  • When I publish the workflow, I want the data fields to be empty – as most of the time, users will run it with their own parameters from the web portal interface. Therefore, what I did with my own example was to remove data in the QF fields. When I ran the workflow interactively, it was ok, global variables did not populate the quick form fields.
  • Then I scheduled this workflow to run every 5 minutes. I did not change the global variable values proposed per default. Note that my workflow is supposed to send me by mail an excel file when done. I left unchanged the default values, as they are the ones I want to use per default. The workflow did not send me the expected output file. Looking on the server, I found that it did not create the file that was to be send by mail. The temporary directory was empty.
  • The only way I made it run “properly” was to change it and made it propose the default values in the quick form fields (values from the global variables). OK then, when I ran it in batch mode, it sent me the excel file that time.
  • Then, what I wanted to do was to reschedule it with different values for the global variables. I created a new schedule and changed values for the global variables. What I got was a result file where data was the same as the one obtained with the original global variable values. It did not used the new values for the global variables.
    I do not know if I missed something in your explanations and/or if there is another setting to consider but I have not been able to make it work. The scheduler in my tests ignores global variables values; it uses in fact values that are proposed in the quick form fields.
    Any idea what I did wrong?
    Thanks in advance for your help,
    Regards,
    Claire

Hi Iris,
I found why the global variables were ignored. I unchecked the “Change” check box in the wrapped metanode configuration and it worked. Now, since I want the fields to be empty when users run the workflow interactively, I added java code. I test one of my global variables set to a dummy value (global variables should have default values - empty/null values are not allowed). This dummy value won’t exist when I schedule the job, so if detected that means the workflow is run interactively; I can overwrite global variables with empty values.
Regards,
Claire

Hi Claire,

that sounds great!
Do you have anything open for this problem? Or are you all working :slight_smile:

Best wishes, Iris

Hi Iris,
No, you can close it. Thanks again for your help.
Cheers,
Claire

Hi Iris,

With knime server 4.8, we will not be able to use global variables. How can I achieve the same thing without using global variable settings? I should be able to launch my workflow from another workflow (where I will use the ‘Call workflow’ (table based) node), but I’ve been unsuccessful. I tried to use the Container Input (variable) node without success. Could you help?

Thanks,

Regards,

Claire

Hi Claire,

no this is still possible. It is just important than when you add the mountpoint do not check the “Use Rest” Checkbox. We will continue to support global variable for 4.8 and also our next release 4.9.

Best wishes, Iris

Hi Iris,
Yes I saw that but what about after 4.9 release?
Thanks,
Regards,
Claire

Hi Claire,

we will continue to support workflow variables also with 4.9, and most probably at least with one further release.
Afterwards there will be a similar methodology to schedule workflows with parameters.
In the future it will be possible to control something similar to our quickforms via the scheduler. This still has to be implemented, so I do not know the exact usage.

Best regards, Iris

Best wishes, Iris