Pages: [1]
  Print  
Author Topic: Issue on the programmatic usage of Subprocess Operator  (Read 332 times)
jaysonpryde
Newbie
*
Posts: 20


« on: February 10, 2012, 04:04:03 PM »

Hi,

    I am currently coding, in Java, a module that utilizes a rapid miner process I've created. The said process contains a Subprocess operator, which in turn, contains operators whose parameters are to be set in the code (i.e filename, csv file, etc).

    I was able to that using the below code:

   
Code:
         Process process = new Process(new File([i]filename of the rapidminer process[/i]));
         ...
         ...
         OperatorChain oc = (OperatorChain)process.getOperator([i]label of the subprocess[/i]);
oc.getSubprocess(0).getOperatorByName("Log").setParameter("filename", [i]log filename[/i]);
         ...
         ...
         process.run()
   

    The code is OK and the module is working perfectly. Only, it HANGS and it never terminates.
    Based on my testing and observation, I am quite sure that this is caused by the usage of the Subprocess operator
    because when tried and moved out the operators inside the subprocess and just connect it in the main process,
    the module is no longer hanging (both during debug and running as a JAR)

Any ideas on this? Thank you!

   
Logged
jaysonpryde
Newbie
*
Posts: 20


« Reply #1 on: February 11, 2012, 02:33:11 AM »

Any ideas from anybody? Thanks!
Logged
jaysonpryde
Newbie
*
Posts: 20


« Reply #2 on: February 11, 2012, 08:24:12 AM »

Anybody?
Logged
haddock
Hero Member
*****
Posts: 759



WWW
« Reply #3 on: February 11, 2012, 11:31:35 AM »

Hi,

Put yourself in our position. With what you've provided we can only guess. Perhaps the problem is in the XML, or the combination of the XML and Java call. Perhaps, perhaps, perhaps.
Logged

Where is the wisdom we have lost in knowledge?
Where is the knowledge we have lost in information?

T.S.Eliot ~ Choruses from the Rock 1934
jaysonpryde
Newbie
*
Posts: 20


« Reply #4 on: February 11, 2012, 04:27:39 PM »

Thanks for feedback haddock! Smiley

Like what I mentioned, it's working fine in the rapidMiner GUI. So i think that eliminates/nullifies your hypothesis that it has something to do with the XML.

To somehow rephrase my question/inquiry/request, can someone kindly provide an example on how to access a Subprocess operator on a given process and inside that Subprocess operator, set some parameters of some operators inside it (e.g. filename, csv file, etc)

Again, thank you! Smiley
Logged
haddock
Hero Member
*****
Posts: 759



WWW
« Reply #5 on: February 11, 2012, 05:28:19 PM »

Hi,

I misinterpreted
Quote
The code is OK and the module is working perfectly. Only, it HANGS and it never terminates.

So I was interested in ....

Quote
or the combination of the XML and Java call

Good luck with that.
Logged

Where is the wisdom we have lost in knowledge?
Where is the knowledge we have lost in information?

T.S.Eliot ~ Choruses from the Rock 1934
Marco Boeck
Administrator
Sr. Member
*****
Posts: 264


WWW
« Reply #6 on: February 15, 2012, 12:17:05 PM »

Hi,

just a quick&dirty example of how to access the parameters of operators in any subprocess:

Code:
Operator operator = process.getOperator("Subprocess");
SimpleOperatorChain chain = (SimpleOperatorChain) operator;
for (Operator op : chain.getSubprocess(0).getOperators()) {
if (op.getName().equals("YOUR_DESIRED_OPERATOR_NAME")) {
for (ParameterType paramType : op.getParameters().getParameterTypes()) {
// do something here
                        // or access the needed parameter directly via the operator
}
}
}

Regards,
Marco
Logged

Did you try our new Marketplace? Upload or download new Extensions, add comments, and organize your operators. Have a look at  http://marketplace.rapid-i.com
jaysonpryde
Newbie
*
Posts: 20


« Reply #7 on: February 15, 2012, 01:23:40 PM »

Thank you very much! Smiley
Logged
Pages: [1]
  Print  
 
Jump to: