Options

[SOLVED] errors using ExecutionMode.EMBEDDED_WITHOUT_UI but COMMAND_LINE works

sixofonesixofone Member Posts: 9 Contributor II
edited July 2019 in Help
Hi I am new at working with RapidMiner and Java and am banging my head on this problem.

I am building a web application that will  execute RapidMiner, 5.3.005, several times in a process flow and we need to avoid the startup time on each execution.  To avoid this, I am attempting to write a Java application that will act as a server to RapidMiner.  

The short story is, I have been able to succesful in integrate simple Java code with my RapidMiner process using
RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
but that doesn't avoid the startup time on each Process.run().  When I try to use
RapidMiner.setExecutionMode(ExecutionMode.EMBEDDED_WITHOUT_UI);
I get many errors with parameter unknown for operator type.  My Java code that  demonstrates this:

import com.rapidminer.Process;
import com.rapidminer.RapidMiner;
import com.rapidminer.RapidMiner.ExecutionMode;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.tools.XMLException;

import java.io.File;
import java.io.IOException;

public class RMserver {

public static void main(String[] args) throws OperatorException, IOException, XMLException {
System.out.println("hello world");
RapidMiner.setExecutionMode(ExecutionMode.EMBEDDED_WITHOUT_UI);
RapidMiner.init();
Process rm5 = new Process(new File("/home/petes/Documents/NewRmRepository/FindObjectsStep3Clusters.rmp"));
rm5.run();
}

}
A partial listing of the errors are get are:

Mar 18, 2013 1:43:24 PM com.rapidminer.io.process.XMLImporter addMessage
INFO: The parameter '<code>parallelize_else</code>' is unknown for operator '<var>Branch</var>' (<code>Branch</code>).
Mar 18, 2013 1:43:24 PM com.rapidminer.io.process.XMLImporter addMessage
INFO: The parameter '<code>parallelize_nested_chain</code>' is unknown for operator '<var>Prep Dimension Data</var>' (<code>Subprocess</code>).
Mar 18, 2013 1:43:24 PM com.rapidminer.io.process.XMLImporter addMessage
INFO: The parameter '<code>parallelize_nested_chain</code>' is unknown for operator '<var>Join, Prep Full Table</var>' (<code>Subprocess</code>).
Mar 18, 2013 1:43:24 PM com.rapidminer.io.process.XMLImporter addMessage
INFO: The parameter '<code>parallelize_nested_chain</code>' is unknown for operator '<var>Trim Prefixes</var>' (<code>Subprocess</code>).
Mar 18, 2013 1:43:24 PM com.rapidminer.io.process.XMLImporter addMessage
INFO: <em class="error">The output port <var>output</var> is unknown at operator <var>Read Document</var>.</em>
Mar 18, 2013 1:43:24 PM com.rapidminer.tools.WrapperLoggingHandler log
INFO: No filename given for result file, using stdout for logging results!
Mar 18, 2013 1:43:24 PM com.rapidminer.Process run
INFO: Process /home/petes/Documents/NewRmRepository/FindObjectsStep3Clusters.rmp starts
Exception in thread "main" com.rapidminer.operator.UserError: The dummy operator Read Document (replacing text:read_document) cannot be executed.
at com.rapidminer.operator.DummyOperator.doWork(DummyOperator.java:88)
at com.rapidminer.operator.Operator.execute(Operator.java:855)
at com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:51)
at com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:711)
at com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:379)
at com.rapidminer.operator.Operator.execute(Operator.java:855)
at com.rapidminer.Process.run(Process.java:949)
at com.rapidminer.Process.run(Process.java:873)
at com.rapidminer.Process.run(Process.java:832)
at com.rapidminer.Process.run(Process.java:827)
at com.rapidminer.Process.run(Process.java:817)
at RMserverPackage.RMserver.main(RMserver.java:29)
Thanks for any guidance you may provide.
Pete
Tagged:

Answers

  • Options
    Nils_WoehlerNils_Woehler Member Posts: 463 Maven
    Hi Pete,

    I'm not totally sure what you mean by 'startup time on each Process.run()' because normally this startup time is
    introduced by RapidMiner.init(). But I think I can help you with the below error. The execution mode EMBEDDED_WITHOUT_UI does not load plugins.
    Thus you get the error you mentioned when trying to load a process with an operator from the text extension. This said in your case the COMMAND_LINE execution mode seems to be the correct choice.

    Best,
    Nils
  • Options
    sixofonesixofone Member Posts: 9 Contributor II
    Thanks for the reply and sorry for confusion. 

    On startup time, currently inside our web application we are "exec"ing RapidMiner via command line and on each execution of RapidMiner we were getting hit with starting the JVM and RM initialization for a total response time in the area of 12-15 seconds and that is expensive in terms of user experience.

    When we run the RapdiMiner processes on command line or GUI, RapidMiner reports times of 3-6 seconds; if we can get the total time down to close to 3-6 seconds our application will be usable.  Therefore we thought writing a "server" that would be running and would take requests to run the RapidMiner processes we could eliminate the JVM startup time. 

    Hope this makes sense. if you have any thoughts or guidance on this, they would be appreciated.
    Thanks
    Pete
  • Options
    sixofonesixofone Member Posts: 9 Contributor II
    I just reread my reply and see a need to clarify something.

    When we run the RapidMiner processes on command line or in GUI, RapidMiner reports successful completion in the 3-6 second range.  When we run it on the command line the total time to complete is in the 12 second range and that is consistent with what we are seeing when we "exec" RapidMiner from our web app. 

    thanks
    Pete
  • Options
    Nils_WoehlerNils_Woehler Member Posts: 463 Maven
    For me your approach sounds like a duplication of our RapidAnalytics Server. It already does the same thinks you want to archive.
    Take a look here: http://rapid-i.com/content/view/182/196/
    There you also can create web services that allow execution of RapidMiner processes without having to develop a new server on your own.

    Best,
    Nils
  • Options
    sixofonesixofone Member Posts: 9 Contributor II
    not sure if what I am doing is really a duplicate or a subset  ;D but since it seems there is a community edition for Rapid Analytics, it is something to investigate.

    A follow-up question on EMBEDDED_WITHOUT_UI does not loading plugins, it would seem that we should be able to do the loading of plugins via setting some property or calling functions, is that true?  At this point, it might be more for my learning and experimenting but I would like to understand this a bit better and see if I could get my little test to work.

    thanks
    Pete
  • Options
    Nils_WoehlerNils_Woehler Member Posts: 463 Maven
    Okay, duplicate might be wrong. It is actually more a subset ;)

    Regarding the execution mode: If you use EMBEDDED_WITHOUT_UI managed extensions are never loaded (see initAll() in Plugin class of RapidMiner).
    But don't be fooled by the enum constant names. The execution mode just sets some options and in fact has nothing to do how you really want to use RapidMiner.
    So if you want to load managed extensions you should use COMMAND_LINE. I would recommend you to take a look at the declaration of ExecutionMode yourself.

    Best,
    Nils
  • Options
    sixofonesixofone Member Posts: 9 Contributor II
    thanks, I think I have a decent path to pursue now

    Pete
Sign In or Register to comment.