Pages: [1]
  Print  
Author Topic: Batch mode with JAR file  (Read 2752 times)
chris_ml
Newbie
*
Posts: 17


« on: October 18, 2008, 10:58:12 AM »

Hi,

I'd like to use RapidMiner in batch mode without the GUI.
With the bash script "scripts/rapidminer CONTROL.xml" this works
fine. However, I would prefer to use the shipped JAR file
from the "lib" directory "rapidminer.jar". Starting it with
"java -jar lib/rapidminer.jar CONTROL.xml" ends up in the
invocation of the GUI without executing the provided xml
file.

Is there a way to start RapidMiner in batch mode with
the JAR file? Or can the JAR file be adjusted to do so?

Greetings,
Chris
Logged
steffen
Sr. Member
****
Posts: 376



« Reply #1 on: October 18, 2008, 01:02:09 PM »

Hello

Assuming that you are a linux guy...
I am no bash expert, but did you take a look at the file "rapidminer"

The interesting part is this one:
Code:
BUILD="${RAPIDMINER_HOME}/build"
RAPIDMINER_JAR="${RAPIDMINER_HOME}/lib/rapidminer.jar"
RAPIDMINER_CLASSPATH=""

if [ -d "${BUILD}" ] ; then
    RAPIDMINER_CLASSPATH=${BUILD}
elif [ -f "${RAPIDMINER_JAR}" ] ; then
    RAPIDMINER_CLASSPATH=${RAPIDMINER_JAR}
else
    echo "Neither ${BUILD} nor ${RAPIDMINER_JAR} was found."
    echo "Try 'ant build' or 'ant dist' first or check the value of RAPIDMINER_HOME!"
    exit 1
fi

To avoid using the build - directory (I do not know why you want to do this...) replace the if-condition with this assignment:
Code:
RAPIDMINER_CLASSPATH=${RAPIDMINER_JAR}

The final java command is at the bottom of the script (as an inspiration for further changes).

On windows (rapidminer.bat), these are the interesting lines:
Code:
if exist "%RAPIDMINER_JAR%" set RAPIDMINER_CLASSPATH=%RAPIDMINER_JAR%
if exist "%BUILD%" set RAPIDMINER_CLASSPATH=%BUILD%
if "%RAPIDMINER_CLASSPATH%"=="" goto error1



Please note that the command you have posted does not include the libraries in the /bin - directory. This can cause some serious trouble...

Maybe I got you wrong...in this case please specify what do you want to achieve

greetings,

Steffen


Logged

"I want to make computers do what I mean instead of what I say"
Read The Fantastic Manual
chris_ml
Newbie
*
Posts: 17


« Reply #2 on: October 19, 2008, 11:56:52 AM »

Hi Steffen,

Quote
Assuming that you are a linux guy...
Yep.  Wink

Quote
To avoid using the build - directory (I do not know why you want to do this...) replace the if-condition with this assignment:

My idea was to just copy the single archive "lib/rapidminer.jar" to an arbitrary
Linux machine and execute it there with "java -jar" to apply some models
learned previously. Is this not feasible? Do I always have to provide all the
libraries from the "lib" directory when invoking java with "-cp ${CLASSPATH}"
and in addition the class "com.rapidminer.RapidMinerCommandLine" ?

Regards,
Chris
Logged
steffen
Sr. Member
****
Posts: 376



« Reply #3 on: October 19, 2008, 01:18:12 PM »

Hello again

Quote from: chris_ml
Do I always have to provide all the libraries from the "lib" directory when invoking java with "-cp ${CLASSPATH}"
I guess it depends on the process you want to perform since I do not have a dependency graph available  Grin. You will know that something is missing when a RuntimeException occurs ... beside: It is such a big deal to copy the libraries, too ?

Quote from: chris_ml
and in addition the class "com.rapidminer.RapidMinerCommandLine" ?
This class is part of rapidminer.jar. It is part of the command to specify which main method shall be executed to start rapidminer...

I did some similar a few months ago, when my "terminal" was slow and a linux computer was available as test machine. I copied all the libraries, modified the starting script and it worked...there is nothing more annoying than to see how  a weekend-long-process is crushing in the last steps because you forgot to add some libraries to the classpath  Angry ... so why risk it ?

greetings,

Steffen
Logged

"I want to make computers do what I mean instead of what I say"
Read The Fantastic Manual
chris_ml
Newbie
*
Posts: 17


« Reply #4 on: October 19, 2008, 05:26:44 PM »

Hi,

Quote
It is such a big deal to copy the libraries, too ?


The lib directory has something more than 22 MB, I think that's OK. :-)

Quote
I did some similar a few months ago, when my "terminal" was slow and a linux computer was available as test machine. I copied all the libraries, modified the starting script and it worked...there is nothing more annoying than to see how  a weekend-long-process is crushing in the last steps because you forgot to add some libraries to the classpath  Angry ... so why risk it ?

OK, you convinced me. :-)

Just another question going into the same direction. When I run the GUI, I see in the bottom
bar the status of the currently running progress. This is very useful since it also indicates
that RapidMiner is still working. However, when I run RapidMiner in the batch mode, I
just see how RapidMiner was invoked but there is no real information about the current process.
Is there a possibility to indicate the state of progress in batch mode as well?

Regards,
Chris
Logged
Pages: [1]
  Print  
 
Jump to: