Problem to launch a workflow from command line

Hi guys,

I’m new on Knime Analytics Platform.
I need to launch a workflow from command line/batch mode.
I used in my Debian 11 VM terminal this command:

/home/giuseppe/Downloads/knime_4.7.0/knime -nosplash -consoleLog -reset -nosave -workflowDir=“/home/giuseppe/Knime-workspace/DTLinux/” -application org.knime.product.KNIME_BATCH_APPLICATION

but I receive the error:

JVM terminated. Exit code=2
/home/giuseppe/Downloads/knime_4.7.0//plugins/org.knime.binary.jre.linux.x86_64_17.0.5.20221116/jre/bin/java
-Djava.security.properties=plugins/org.knime.binary.jre.linux.x86_64_17.0.5.20221116/security.properties
-server
-Dsun.java2d.d3d=false
-Dosgi.classloader.lock=classname
-XX:+UnlockDiagnosticVMOptions
-Dsun.net.client.defaultReadTimeout=0
-XX:CompileCommand=exclude,javax/swing/text/GlyphView,getBreakSpot
-Dknime.xml.disable_external_entities=true
–add-opens=java.base/java.lang=ALL-UNNAMED
–add-opens=java.base/java.lang.invoke=ALL-UNNAMED
–add-opens=java.base/java.net=ALL-UNNAMED
–add-opens=java.base/java.nio=ALL-UNNAMED
–add-opens=java.base/java.nio.channels=ALL-UNNAMED
–add-opens=java.base/java.util=ALL-UNNAMED
–add-opens=java.base/sun.nio.ch=ALL-UNNAMED
–add-opens=java.base/sun.nio=ALL-UNNAMED
–add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED
–add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED
-Xmx2048m
-Dorg.eclipse.swt.internal.gtk.disablePrinting
-Dchromium.multi_threaded_message_loop=true
-Darrow.enable_unsafe_memory_access=true
-Darrow.memory.debug.allocator=false
-Darrow.enable_null_check_for_get=false
–add-opens=java.security.jgss/sun.security.jgss.krb5=ALL-UNNAMED
–add-exports=java.security.jgss/sun.security.jgss=ALL-UNNAMED
–add-exports=java.security.jgss/sun.security.jgss.spi=ALL-UNNAMED
–add-exports=java.security.jgss/sun.security.krb5.internal=ALL-UNNAMED
–add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED
-jar /home/giuseppe/Downloads/knime_4.7.0//plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar
-os linux

CompileCommand: exclude javax/swing/text/GlyphView.getBreakSpot bool exclude = true

Jan 23, 2023 10:24:18 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener addExtensions

INFO: Adding the extensions from bundle org.apache.cxf.cxf-rt-frontend-jaxrs (153) [org.apache.cxf.jaxrs.JAXRSBindingFactory]

Jan 23, 2023 10:24:18 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener addExtensions

INFO: Adding the extensions from bundle org.apache.cxf.cxf-rt-transports-http (157) [org.apache.cxf.transport.http.HTTPTransportFactory, org.apache.cxf.transport.http.HTTPWSDLExtensionLoader, org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder, org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder, org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider]

Jan 23, 2023 10:24:18 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener addExtensions

INFO: Adding the extensions from bundle org.apache.cxf.cxf-rt-transports-http-hc (158) [org.apache.cxf.transport.http.HTTPConduitFactory, org.apache.cxf.transport.ConduitInitiator]

Jan 23, 2023 10:24:18 AM org.apache.cxf.bus.blueprint.NamespaceHandlerRegisterer register

INFO: Aries Blueprint packages not available. So namespaces will not be registered

Jan 23, 2023 10:24:18 AM org.apache.cxf.bus.blueprint.NamespaceHandlerRegisterer register

INFO: Aries Blueprint packages not available. So namespaces will not be registered

ERROR main BatchExecutor Workflow directory ‘/home/giuseppe/Knime-workspace/DTLinux/’ is not a directory.

org.knime.core.node.workflow.BatchExecutor$IllegalOptionException: Workflow directory ‘/home/giuseppe/Knime-workspace/DTLinux/’ is not a directory.

at org.knime.core.node.workflow.BatchExecutor.handleCommandlineArgument(BatchExecutor.java:551)

at org.knime.core.node.workflow.BatchExecutor.parseConfigFromArguments(BatchExecutor.java:464)

at org.knime.core.node.workflow.BatchExecutor.processArguments(BatchExecutor.java:445)

at org.knime.core.node.workflow.BatchExecutor.<init>(BatchExecutor.java:415)

at org.knime.core.node.workflow.BatchExecutor.mainRun(BatchExecutor.java:672)

at org.knime.product.headless.KNIMEBatchApplication.runBatchExecutor(KNIMEBatchApplication.java:130)

at org.knime.product.headless.KNIMEBatchApplication.start(KNIMEBatchApplication.java:83)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.base/java.lang.reflect.Method.invoke(Unknown Source)

at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)

at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)

at org.eclipse.equinox.launcher.Main.run(Main.java:1467)

at org.eclipse.equinox.launcher.Main.main(Main.java:1440)

Jan 23, 2023 10:24:19 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener unregister

INFO: Removing the extensions for bundle 153

Jan 23, 2023 10:24:19 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener unregister

INFO: Removing the extensions for bundle 157

Jan 23, 2023 10:24:19 AM org.apache.cxf.bus.osgi.CXFExtensionBundleListener unregister

INFO: Removing the extensions for bundle 158

what it means?

If I try with the option application written in this manner:

-application=“org.knime.product.KNIME_BATCH_APPLICATION”

it opens Knime (no error) but it doens’t execute the workflow.
Can someone help me?
Thanks.

Hi @giuseppeR and welcome to the forum.

Probably your error is in the workflowDir parameter that should end with the workflow name or the workflow .zip file name (if you export the workflow using the .zip file format).
In your case, I see you put a folder path (I see the “/” as ending character) without specifying the workflow name, that could be the error.

I suggest also to read this faq: https://www.knime.com/faq#q12

I hope this helps you.

Hi @morpheusTM,

thank you for your preciuos help. Reading another post I solved using the parameter workflowfile, in this manner:

/home/giuseppe/Downloads/knime_4.7.0/knime -consoleLog -nosplash -nosave -reset -application org.knime.product.KNIME_BATCH_APPLICATION -workflowDir=“/home/giuseppe/knime-workspace/DTLinux” -workflowFile=“/home/giuseppe/knime-workspace/DTLinux/DTLinux.knwf”

and launching in the terminal it works.
If you can…I try to launch it with a python script:

import argparse
import subprocess as sp

def runKnimeWorkflow(workflowPath, workflowFile):
    """
    Run selected workflow in KNIME (batch mode)
    input:
    workflowPath -> Entire workflow path + name to run
    """
    print("Invoke KNIME to run selected workflow: ", workflowPath.split("/")[-1])
    sp.run(["/home/giuseppe/Downloads/knime_4.7.0/knime", "-consoleLog", "-nosplash", "-nosave", "-reset",
            "-application org.knime.product.KNIME_BATCH_APPLICATION",
            "-workflowDir=\""+workflowPath+"\" -workflowFile=\"" + workflowFile+"\""])

    print("Workflow " + workflowPath.split("/")[-1] + " executed successfully.")
    return

def main(config):
    """
    Invokes a KNIME workflow in batch mode
    input:
    config -> contains a list of command line arguments with respective values
    """
    runKnimeWorkflow(config.workflowPath, config.workflowFile)
    return

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("--workflowPath", type=str, required=True)
    parser.add_argument("--workflowFile", type=str, required=True)
    config = parser.parse_args()

    main(config)

But it opens the Knime window…Why, if the command it is the same launched from terminal window, it opens the Knime window? I use the option -nosplash but it seems ignore it.
Thank you.

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