[solved] Assign repository in JAVA

radone
radone New Altair Community Member
edited November 5 in Community Q&A
How can I assign repository location to JAVA application?

Where is my problem:
I would like to run external "execute_process" process from my current process.

Notification:
INFO: Cannot access file system in execution mode UNKNOWN. Not loading repositories.

JAVA Code

               RapidMiner.init();
try {
RepositoryManager.getInstance(null).addRepository(new LocalRepository("MyRepo", new File("processes")));
} catch (RepositoryException e1) {
e1.printStackTrace();
}
Process process = null;
try {
process = RapidMiner.readProcessFile(new File(annotationProcess));
// RepositoryProcessLocation loc = new RepositoryProcessLocation(new RepositoryLocation(annotationProcess));
                       // process = loc.load(null);
                       
                       IOContainer results = process.run();

} catch (Exception e) {
e.printStackTrace();
RapidMiner.quit(RapidMiner.ExitMode.ERROR);
}
"execute_process" operator definition:

<operator activated="true" class="execute_process" compatibility="5.3.000" expanded="true" height="76" name="Execute ExtracGlobaltFeatures (3)" width="90" x="246" y="120">
       <parameter key="process_location" value="RMModule/processes/ExtracGlobaltFeatures"/>
       <parameter key="use_input" value="true"/>
       <parameter key="store_output" value="false"/>
       <parameter key="propagate_metadata_recursively" value="true"/>
       <parameter key="cache_process" value="true"/>
       <list key="macros"/>
     </operator>
Error:
com.rapidminer.operator.UserError: Cannot resolve relative repository location 'ExtracGlobaltFeatures'. Process is not associated with a repository.

Thanks for any help.

Radim

Answers

  • radone
    radone New Altair Community Member
    The solution was to add: (the processes are in "processes" directory):

                    try {
    RepositoryManager.getInstance(null).addRepository(
    new LocalRepository("MyRepo", new File("processes")));
    } catch (RepositoryException e1) {
    e1.printStackTrace();
    }
    and to change to //MyRepo/ExtractFeatures:
    <operator activated="true" class="execute_process" compatibility="5.3.000" expanded="true" height="76" name="Execute ExtracGlobaltFeatures (3)" width="90" x="246" y="120">
            <parameter key="process_location" value="//MyRepo/ExtracGlobaltFeatures"/>
            <parameter key="use_input" value="true"/>
            <parameter key="store_output" value="false"/>
            <parameter key="propagate_metadata_recursively" value="true"/>
            <parameter key="cache_process" value="true"/>
            <list key="macros"/>
          </operator>
  • Thanks, it's been very usefull to me