knime batch mode

Hi everyone,

I run “C:\Program Files\KNIME\knime.exe” -consoleLog -noexit -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION -preferences=“C:\Users\NACAD49312\knime-workspace\preferences.epf” -workflowDir=“C:/Users/NACAD49312/knime-workspace/CENPES_rev2_avaliacao”

I have got this error:
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

I hope anyone tell me a tip to solve this.
Thanks.

Hi @Alexandre1,

this is just a typical logger output and not an error. Does the workflow run as expected?

Best,

Christian

Hi Christian,

Workflow does not run as expected. But i tried to implement -reset and now it runs. Now I need to implement the command -workflow.variable=itemdesejado,“REGULADOR PRESSÃO P/SUPR.INSTR.”,STRING. And I have got this: ERROR main BatchExecutor Couldn’t parse -workflow.variable argument: -workflow.variable=itemdesejado,REGULADOR PRESS?O P/SUPR.INSTR.,STRING: Invalid type for workflow variable itemdesejado: STRING. Any help for that?

Thanks for your support

Hi Alexandre1,

check Check https://www.knime.com/faq#q12. I guess you have to do lower-case “STRING” or similar.

Cheers,

Christian

Hi @christian.dietz,

today, I spend some 6 hrs using trial-and-error approach to figure our, how the KNIME batch mode works on a windows machine in general. Even if I finally managed to run my workflow (hints: set PATH-environment to KNIME.EXE, rewrite windows-styled paths from backslash to slash, " or ’ for paths etc.) I wasn’t able to redirect the console log into a text file. Is there any hint from your side how to solve this in particular? And in general, is there any more detailed description for the batch-mode than FAQ#12?
The batch-mode capability is so powerful, I’d love to use it more often…!

Thanks in advance and kind regards,

Patrick

Hi @Patrick1974,

unfortunately, we don’t have any further documentation of the batch mode. The best we can offer is typing knime -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION​, which gives you a full overview of the batch executor capabilities. Regarding the log output: Can you pipe the output to a textfile (e.g. > mylog.txt)?

Cheers,

Christian

Hi @christian.dietz,

after adding “-consoleLog” and “-noexit”, I managed to see the batch parameter. However, > log.txt didn’t do the trick - the ConsoleOutput is not under control of the CMD-windows and therefore not part of redirectable output - see command line below:
knime -consoleLog -nosplash -noexit -application org.knime.product.KNIME_BATCH_APPLICATION > log.txt

However, I was able to copy-paste the output to a file and for conveniences I added the output (see below).

Again, I’d love to capture the consoleLog output to a file in order to have a kind of a trace log when using KNIME in a productive environment - any idea, how to perform this? Is there a “Console-Redirector-Bode” available?

CompilerOracle: exclude javax/swing/text/GlyphView.getBreakSpot
ERROR    main KNIMECorePlugin    Error while starting workbench, some setting may not have been applied properly: null
Usage: The following options are available:
 -nosave           => do not save the workflow after execution has finished
 -reset            => reset workflow prior to execution
 -failonloaderror  => don't execute if there are errors during workflow loading
 -updateLinks      => update metanode links to latest version
 -credential=name[;login[;password]] => for each credential enter credential
                      name and optional login/password, otherwise its prompted for
 -masterkey[=...]  => prompt for master password (used in e.g. database nodes),
                      if provided with argument, use argument instead of prompting
 -preferences=...  => path to the file containing eclipse/knime preferences,
 -workflowFile=... => ZIP file with a ready-to-execute workflow in the root
                      of the ZIP
 -workflowDir=...  => directory with a ready-to-execute workflow
 -destFile=...     => ZIP file where the executed workflow should be written to
                      if omitted the workflow is only saved in place
 -destDir=...      => directory where the executed workflow is saved to
                      if omitted the workflow is only saved in place
 -workflow.variable=name,value,type => define or overwrite workflow variable
                      'name' with value 'value' (possibly enclosed by quotes). The
                      'type' must be one of "String", "int" or "double".
Some KNIME settings can also be adjusted by Java properties;
they need to be provided as last option in the command line:
 -vmargs -Dorg.knime.core.maxThreads=n => sets the maximum
                  number of threads used by KNIME

The following return codes are defined:
        0       upon successful execution
        2       if parameters are wrong or missing
        3       when an error occurs during loading a workflow
        4       if an error during execution occurred

Kind regards,

Patrick.

2 Likes

Hi @Patrick1974,

do we know any update about how to stored logs from Knime in a batch mode? I’ve always found Knime a really cool tool, but I feel a bit disappointing that the batch-mode’s logs are not stored directly. If everything’s ran corrrect, Knime is great. If not, is a bit hard to finding out why it failed. :sa:

thanks a lot Patrick!

I did this several times using a custom log4j configuration, where you can redirect and prioritize your logs to different sources (e.g. show only info level on console, but log debug to file).

You would create log4j.xml file and specify this as VM args at the end of the knime command:

… -vmargs -Dlog4j.configuration=log4j.xml

– Philipp

2 Likes

… and there are also the logs that are stored in the usual location under the workspace’s .metadata directory.

Did you ever get a Workflow to run without error in Windows via a batch file? If so, can you share what you bat file looks like?

Hi there!

I’m no Patrick but I got workflows running without error on Windows via batch file. Example is attached.

Hope it helps.

Batch_example.zip (334 Bytes)

Br,
Ivan

Thanks a lot!

1 Like

I try this solution , this works for me.
but newly opened cmd window is not closing !!

i am trying to automate with windows sheduler
this window is not closing

Try removing the -noexit command line parameter.

it didnt work…

start " " adding in script working…

i got solution

start “” “C:\Users\Navin Jadhav\Documents\knime_4.0.0.win32.win32.x86_64\knime_4.0.0\knime.exe” -noexit -nosplash -nosave -reset -application org.knime.product.KNIME_BATCH_APPLICATION -workflowDir=“C:\Users\Navin Jadhav\knime-workspace\Srini_CSV”

Hi,
I am new to Knime and i created sample workflow ,its executing fine . when i tried to create and execute batch file (Batch file contains knime -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION -workflowDir=“D:\knime-workspace\KNIME_project-xls-tbl”) its giving Error
“Java was started but returned Exit code=3”

Please help me in this regard…
Thanks

Hi ravindra,

Try using :
knime -nosplash -reset -application org.knime.product.KNIME_BATCH_APPLICATION -workflowDir=“knime-workspace\KNIME_project-xls-tbl”

And dont run the command prompt as administrator.

run_knime.bat.zip (711 Bytes)

Also give that a try. It should suppress error windows and write output to log files. I use it like this directly in windows task scheduler as the “Action” or from the command line:

c:\> run_knime.bat workflow_1

You can just add more case sections for workflows and of course update the paths to the correct locations throughout the script.