Options

Replace ProcessRootOperator or inject functionality

phbphb Member Posts: 5 Contributor II
edited November 2018 in Help
Hello all,

my problem is that i want to replace the processRootOperator because i want to execute some code at the end of a process execution. my idea was that i replace the function sendemail which is executed at the end and therefore i wanted to replace the processrootoperator. i tried this by creating a plugin with a new processrootoperator which works only if i create a new operator "process" in an existing process but not if i create a new process itself. are there other solutions or did i missed something? any help is welcome.

regards
philipp
Tagged:

Answers

  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi Phillip,
    you simply cannot change the root operator. That was a simple solution, wasn't it? :)
    Ok, for implementing a function at the end of the process, you should simply create an own operator and add it as last operator in the process. If you want to override the standard behavior of the sendmail parameter, just leave it blank and implement your own behavior.

    Greetings,
      Sebastian
  • Options
    phbphb Member Posts: 5 Contributor II
    i forgot something to add:
    it has to be implemented through a plugin due to distribution and convenience reasons.
    @sebastian
    i changed the processrootoperator already. the problem is, that the changes i made, affect only the operator. if i create a new workflow the standard processrootoperator will be loaded, if i create an operator "ProcessRootOperator" aka "Process" inside this process then the new/changed one will be loaded.
    perhaps the only solution for my problem is to implement this functionality in all the evaluation operators, to be sure that it will be executed in all workflows automatically.
  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi Phillip,
    perhaps I didn't make myself clear: It isn't allowed to create a second Process Root Operator!

    If you are going to execute always the same operators at the end of the process, you could either add them every time, for example using a Building Block. Or you could save them in an own process file and use the ProcessEmbedder to execute always the same process.

    If you have a different intention, you should tell me, because otherwise I cannot help you anyway.

    Greetings,
      Sebastian
  • Options
    phbphb Member Posts: 5 Contributor II
    hi sebastian,
    first i want to thank you for your quick responses.
    i think i have to clarify my intentions for doing these things. i want to give my colleagues a plugin, which will send me information about the workflows they will execute. for their convenience and for the completeness of the received data i wanted to make this invisible for my colleagues, so that they are not disturbed in their daily routine and dont have to add every time an extra operator. my first idea was to use the existing function sendemail of the processrootoperator. but this will only work, regardless of allowed or not, if this operator is inserted in a process, not if i create a new process using the gui. short: it works if i use the create new operator dialogue and insert the process operator which i changed by a plugin, but then its not the root operator.
    to add my own operator via plugin is not my problem.

    i hope i could clarify my intentions and my problem
    regards
    philipp

  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi Philipp,
    I don't think this is possible to achieve with a plug in at all. I don't think there is any hook for a plugin to get the information, when the process is finished. And there is no possibility to overwrite the ProcessRoot operator at all.

    But depending on what you are going to do with the processes, the process repository functionality of the upcoming RapidMiner 5 already suits your needs?

    Greetings,
      Sebastian
  • Options
    steffensteffen Member Posts: 347 Maven
    Stumbling across...

    What about the method processFinished() in class Operator ? From the javadoc -description I would say it is exactly what you need. I would implement such an operator like this:

    apply(){
    // collect all data and store it in this object instance
    }

    processFinished(){
    // send the data
    }
    However, I am also not sure why you want to do this. I smell surveillance ;)

    Another option is to change (not extend or something like this) the ProcessRootOperator and  hence create your own distribution of RapidMiner. I would not do something like this (at least for such a small feature), but I do not know how important this is for you.

    kind regards,

    Steffen
  • Options
    phbphb Member Posts: 5 Contributor II
    @steffen: dont panic, it has nothing to do with surveillance ;)

    i implemented the feature in the processrootoperator in the sendmail function and made my own rapidminer.jar. its not as convenient as i wished it to be, but with a batch script i think its still easy enough for my colleagues to install it. why i used the sendmail function is because of the result iocontainer which is given as a parameter to this function. why i used the processrootoperator is because it is executed once in every process.
    i want to thank you very much for your time and your help.

    regards
    philipp
Sign In or Register to comment.