My Knime model is running well and I am ready to set it up to run daily. However, there is a little bit of database cleanup I need to do after each run. I have a stored procedure all written and ready to run, but I need my DOS script to "block" (in unix parlance) until Knime is finished executing, and then call SQLCMD with my clean-up procedure.
I am hoping something like this will work:
knime -nosplash ^
-reset -failonloaderror ^
-application org.knime.product.KNIME_BATCH_APPLICATION ^
sqlcmd -d Analytics -S SNGSQLANLTIX01\BIStaging -U <username> ^
-P <password> -Q "exec Meta.MyStoredProc" ^
However, this seems to return control to the DOS prompt immediately, and the two commands are run in parallel, rather than the second waiting for the first to complete.
Is a work-around possible? Or do I need to hack this with an output file that Knime writes into I continually test before proceeding?
Thanks as always,
"start /wait knime -nosplash blah blah blah"
in my batch file, I was able to make the script block while Knime executed. However, now it hangs on a Java error code 4 shown in a pop-up window (which it always has done) and a human has to push the "okay" button to make that window go away before the next DOS command can be executed.
See <http://www.flickr.com/photos/16961824@N08/7997948912/> or the attached file for a screen shot of the pop-up.
Is there a solution for this, to enable knime to live inside a large batch file in DOS and run autonomously?
First, you should run the batch executor with "-consoleLog" as additional argument. This should prevent a dialog to appear if the workflow execution fails but instead prints the error message in the console. Then, if the batch executor exits with an error code of 4 (as in your case) an error occured during execution.
Apart from that, the batch executor does not return to the batch file before it has finished execution (either successfully or with an error).
Thank you Thor,
Eventually I found my mistakes in the Knime environment (I was confused because I was not running the workflow from the command line that I thought I was!). So now things work as advertised, with the exception of blocking.
That is, the program exits cleanly, but does not block the next DOS command from executing. However, beginning the KNIME command with "start /wait knime blah blah blah" and omitting the "-noexit" flag does the trick.
Much thanks as always,