"[SOLVED] start RM process without GUI with java -jar ?"

Unknown
edited November 5 in Community Q&A
Hi

how to start RM without invoking the GUI on linux ?

thx
Tagged:

Answers

  • wessel
    wessel New Altair Community Member
    Why is this different on linux?

    cd Rapid-I\RapidMiner5\lib\
    java -jar rapidminer.jar

    Like this?
  • hi

    nope ...what u wrote starts also the GUI .

    and I am aware of rapidminer.bat -f but i dont want windows.

    cheers
  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    you can use "java -cp rapidminer.jar com.rapidminer.RapidMinerCommandLine"

    Regards,
    Marco
  • Hi Marco

    it always seems to fail.
    I tried a very simple process just to discretize something and I removed any output.
    It still ends with this:

    ....
    May 14, 2012 11:17:44 AM com.rapidminer.RapidMinerCommandLine run
    SEVERE: Here:          Process[1] (Process)
              subprocess 'Main Process'
          ==>  +- Retrieve (2)[1] (Retrieve)
                +- Select Attributes[0] (Select Attributes)
                +- Filter Example Range[0] (Filter Example Range)
                +- Discretize[0] (Discretize by Frequency)
    May 14, 2012 11:17:44 AM com.rapidminer.RapidMinerCommandLine run
    SEVERE: Process not successful

    It does suggest it has been executed.

    any more ideas?
    thx
  • wessel
    wessel New Altair Community Member
    Download Rapid Miner to eclipse http://rapid-i.com/content/view/25/48/ and launch it from there.
  • hi wessel

    thats a bit of a reach I just want the ability to run jobs from command line,
    what Marco suggested seems to be on the right track, but somethings still missing ...
  • wessel
    wessel New Altair Community Member
    If you run from eclipse you can do easier debugging!
    It is very easy to run from eclipse.

    Right, this said.
    Did you check if the process runs with a relative path?
    Maybe the retrieve operator is looking at some file that does not exist.

  • wessel wrote:

    If you run from eclipse you can do easier debugging!
    It is very easy to run from eclipse.

    Right, this said.
    Did you check if the process runs with a relative path?
    Maybe the retrieve operator is looking at some file that does not exist.
    sup w,

    all is in the root of my repository.

    about eclipse: I want to be able to launch RM in simple batch jobs that's why I want to avoid using eclipse.

  • wessel
    wessel New Altair Community Member
    So everything works now?

    What lines of code did you use to get it working?
  • hi w
    thx for axing

    no, it's NOT working   >:(
     java -cp rapidminer.jar com.rapidminer.RapidMinerCommandLine [repository path] -f [process] 
    leads to the error I posted before
    it does start (so it seems at least) the process.... but fails to finish!
  • wessel
    wessel New Altair Community Member
    I managed to run a process successfully:
    May 16, 2012 12:09:07 AM com.rapidminer.RapidMinerCommandLine run
    INFO: Process finished successfully

    But the moment I enter a retrieve operator it fails.

    I'll try and figure out how to get retrieve to work.
    Right now I'm on windows, so I have to install linux again.
    I planned to do this anyway, but takes a bit of time.

    Here is the process (generate data, and log some result, write the log to a file):


    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.004">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <operator activated="true" class="process" compatibility="5.2.004" expanded="true" name="Process">
       <process expanded="true" height="191" width="435">
         <operator activated="true" class="generate_data" compatibility="5.2.004" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30"/>
         <operator activated="true" class="log" compatibility="5.2.004" expanded="true" height="76" name="Log" width="90" x="180" y="30">
           <parameter key="filename" value="C:\Users\wessel\Desktop\z.log"/>
           <list key="log">
             <parameter key="a" value="operator.Generate Data.parameter.target_function"/>
           </list>
         </operator>
         <operator activated="false" class="retrieve" compatibility="5.2.004" expanded="true" height="60" name="Retrieve" width="90" x="315" y="30">
           <parameter key="repository_entry" value="dat/_4ackley"/>
         </operator>
         <connect from_op="Generate Data" from_port="output" to_op="Log" to_port="through 1"/>
         <portSpacing port="source_input 1" spacing="0"/>
         <portSpacing port="sink_result 1" spacing="0"/>
         <portSpacing port="sink_result 2" spacing="0"/>
       </process>
     </operator>
    </process>


  • wessel
    wessel New Altair Community Member
    Can you please double check for me, that if you set a fixed path for the retrieve operator, it still fails?

    So it should give you a warning like this:
    Parameter 'repository entry' accesses a repository by name (//MY_REPOSITORY/SOME_DATA_SET). This may not be portable when sharing processes.

    My process seems to run fine when I have this warning, the moment I set a relative path (which removes the warning) the process fails.

    Best regards,

    Wessel

    edit: I think if you want it to work with a relative path you have to use

    -classpath "%COMPLETE_CLASSPATH%" -Drapidminer.home="%RAPIDMINER_HOME%" -Drapidminer.operators.additional="%RAPIDMINER_OPERATORS_ADDITIONAL%" %RAPIDMINER_JDBC_DRIVER_PARAMETER% com.rapidminer.RapidMinerCommandLine %CMD_LINE_ARGS%
  • Hi wessel

    I tried the other syntax but it still did not work (relative path).
    I tried XML process execution, same thing.

    It does work when ABSOLUTE path in retrieve is used.

    I dont want to be picky but since I move the processes between systems the RELATIVE path is much more desirable solution.

    Else I would have to parse every process I port elsewhere to replace the repo path.

    BUT if I rename all the repositories on the different machines to the SAME name! this may work without the need of parsing and replacing strings ...

    I would say it qualifies as  a BUG, dont u think?

    thanks for ur help appreciated!
  • MariusHelf
    MariusHelf New Altair Community Member
    Hi,
    fritmore wrote:

    nope ...what u wrote starts also the GUI .

    and I am aware of rapidminer.bat -f but i dont want windows.

    cheers
    On linux you can chmod +x $RAPIDMINER_HOME/scripts/rapidminer and use that script to start RapidMiner headless.

    I would say it qualifies as  a BUG, dont u think?
    No. If you use the -f parameter, you provide a process file, that means that you use it independent from any repository. Thus RapidMiner has no idea if the process is attached to any repository at all, and even less where in this repository it lives. But it should be possible to start a process like this:
    rapidminer //REPO_NAME/path/to/process
    Then the process is executed in the repository context, and relative paths can be resolved.

    Best,
    Marius
  • Hi Marius
    On linux you can chmod +x $RAPIDMINER_HOME/scripts/rapidminer and use that script to start RapidMiner headless.
    it complained about missing sys variables.
    when tried to build with ant, it failed.
    version.get:
    init:
    [taskdef] Could not load definitions from resource antlib.xml.
    ...
    ...
    so I could not test the sh script.

    No. If you use the -f parameter, you provide a process file, that means that you use it independent from any repository. Thus RapidMiner has no idea if the process is attached to any repository at all, and even less where in this repository it lives. But it should be possible to start a process like this:
    rapidminer //REPO_NAME/path/to/process
    Do you mean using the sh script rapidminer ? Because java -jar ... doesnt work with the path added like that.

    br
    f
  • MariusHelf
    MariusHelf New Altair Community Member
    Hi,

    if you download the RapidMiner zip from our website, you should already have a scripts directory. If you have problems with the ant scripts we are also happy to assist you, but please open a new thread for that and supply some more detailed information (which ant target etc.).

    Best, Marius
  • Marius wrote:

    Hi,

    if you download the RapidMiner zip from our website, you should already have a scripts directory. If you have problems with the ant scripts we are also happy to assist you, but please open a new thread for that and supply some more detailed information (which ant target etc.).

    Best, Marius
    will the
    ant build
    set all the sys variables so that I can test the sh scripts?
  • MariusHelf
    MariusHelf New Altair Community Member
    "ant build" does not set any system variables, it just compiles RapidMiner, but that's not necessary since the zip already contains the rapidminer.jar. Please post the output of the rapidminer sh script, maybe you have to set some variables manually.
  • Marius,

    i set the missing variables so i executed the script just to realize it builds the same command wessel suggested.
    java -cp rapidminer.jar com.rapidminer.RapidMinerCommandLine [repository path] -f [process]
    You suggested to execute the linux script:
    rapidminer path_to_process/process_name
    that does NOT work (fails to find the process completely).


    So back to square 1.

    That is it (the first command here) runs the process ok if all the paths in the process are ABSOLUTE. It ALWAYS fails if any of them is relative.
  • haddock
    haddock New Altair Community Member
    Hi,

    I think the much missed Gagi zapped this one, here http://rapid-i.com/rapidforum/index.php/topic,2385.0.html . Worth a read as he knew his stuff.

  • wessel
    wessel New Altair Community Member
    I tried to use the rapidminer.no_extension script on Linux, but for me it only works with absolute paths.
    It is important to note that this script is different compared to the windows script.
    This script contains lines of code for updating rapid miner and for running processes without the GUI.
    Furthermore this script contains lots of code for trying to guess environment variables.

    Can you come up with some minimal benchmark that is supposed to work?
    E.g. retrieve a file from the repository, normalize the file, and write it back to the repository?

    The way I see it there are 3 possible approaches:
    1. Somehow modify the script so it also works for relative paths (based on Haddock's comments this should be possible, but for some reason didn't work for me)
    2. Write a script that replaces all relative paths to absolute paths
    3. Recompile the RapidMinerCommandLine class.

    I'll let you know if I get 1 of the 3 working.

    Best regards,

    Wessel
  • haddock wrote:

    Hi,

    I think the much missed Gagi zapped this one, here http://rapid-i.com/rapidforum/index.php/topic,2385.0.html . Worth a read as he knew his stuff.
    sup captain,
    gagi did not find a solution for dealing with RELATIVE paths ...
  • wessel wrote:


    Can you come up with some minimal benchmark that is supposed to work?
    E.g. retrieve a file from the repository, normalize the file, and write it back to the repository?
    yeah :) a retrieve operator with relative path set.
    wessel wrote:

    The way I see it there are 3 possible approaches:
    1. Somehow modify the script so it also works for relative paths (based on Haddock's comments this should be possible, but for some reason didn't work for me)
    2. Write a script that replaces all relative paths to absolute paths
    3. Recompile the RapidMinerCommandLine class.

    I'll let you know if I get 1 of the 3 working.

    Best regards,

    Wessel
    ad1) gagi did not modded the rapidminer script to be able to resolve the relative path problem
    he must have worked with absol paths
    ad2) thats pretty much what I do now,
    ad3) hmmm please go ahead!

  • haddock
    haddock New Altair Community Member
    I was drawing your attention to...
    seems to me, RM executes your process, but since the process is started from file, it isn't attached to any repository at all. Hence you cannot use relative paths inside the process to access a repository.

    Greetings,
      Sebastian