Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

Issue on the programmatic usage of Subprocess Operator

jaysonprydejaysonpryde Member Posts: 20 Contributor II
edited November 2018 in Help
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:

   

        Process process = new Process(new File(filename of the rapidminer process));
        ...
        ...
        OperatorChain oc = (OperatorChain)process.getOperator(label of the subprocess);
oc.getSubprocess(0).getOperatorByName("Log").setParameter("filename", log filename);
        ...
        ...
        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!

 
Tagged:

Answers

  • jaysonprydejaysonpryde Member Posts: 20 Contributor II
    Any ideas from anybody? Thanks!
  • jaysonprydejaysonpryde Member Posts: 20 Contributor II
    Anybody?
  • haddockhaddock Member Posts: 849 Maven
    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.
  • jaysonprydejaysonpryde Member Posts: 20 Contributor II
    Thanks for feedback haddock! :)

    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! :)
  • haddockhaddock Member Posts: 849 Maven
    Hi,

    I misinterpreted
    The code is OK and the module is working perfectly. Only, it HANGS and it never terminates.
    So I was interested in ....
    or the combination of the XML and Java call
    Good luck with that.
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

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

    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
  • jaysonprydejaysonpryde Member Posts: 20 Contributor II
    Thank you very much! :)
Sign In or Register to comment.