call a workflow and not receive an answer

Hi,

I would like to have an application on a KNIME Server, where the user can drop a file which will be passed to a backend workflow for a longer calculation. The results are sent later by email. The caller workflow application should finish at this point, while the backend calculates.

I implemented a caller and receiver workflow pairs with the Call Workflow (Table Based) and the Container Input (Table) nodes. I could nicely pass all data I wanted to. However, the Call Workflow (Table Based) node waits until the backend workflow finishes. How should I configure them so that the caller workflow just starts the other one, but does not wait for the other to finish? There is no need to pass back any information to the caller workflow and the application will not be open as long as the calculation is running. Do I need a different workflow invocation?

Thanks
Agnes

Hi Agnes,
For this you will need a different way of invoking the backend workflow that does the processing. You can use your server’s REST API for that. I think it is best if you store the file in a folder in your server repository and then call the workflow passing the path to the file as JSON.
To execute a workflow via REST, make a POST request to /knime/rest/v4/repository/path/to/your/workflow:execution and send the required data as JSON. The called workflow needs a Container Input (Variable) node to be able to get the file path. From your workflow, you can invoke the workflow via REST using the POST Request node.
I hope this helps!
Alexander

1 Like

Hi @AlexanderFillbrunn ,

Thanks for the quick reply. I tried your method, I can pass the variables and can start the workflow. However, the job is always discarded upon execution, even if there is an error. I’d like to debug, get an email upon failure and be able to interact with the failed workflow, like for other server deployed jobs. Can I set the post request somehow so that the job does not get discarded? I tried to append these parameters to the URL in the post request:
/the_path_to_my_workflow:execution?timeout=-1&asyncLoading=false&discardAfterSuccessfulExec=false&discardAfterFailedExec=false

Agnes

Hi,
In that case, you can do a POST request to /the_path_to_my_workflow:jobs instead. This will initialize a job without executing it. You get back a JSON including a job id. Now you can execute the job with a POST request to /jobs/. I hope that helps!
Alexander

do I add the ID as a parameter to the URL or as a JSON body?

You add it to the URL:

1 Like

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