🎉 🎉 RAPIDMINER 9.10 IS OUT!!! 🎉🎉

Download the latest version helping analytics teams accelerate time-to-value for streaming and IIOT use cases.


How to assign macro values on a server process?

kaymankayman Member Posts: 655   Unicorn
edited November 2018 in Help

Hi, is it possible to run a process with macro values?


In the studio flow I am able to use macros to decide which branches should be executed, eg if a given macro value is 0 it means the whole flow needs to be executed, if it is 1 it means the incremental flow needs to be executed.


On the server part however I can find no way to send this value (so 0 or 1) so it makes the whole logic pretty useless. This looks to me like a very basic thing so I am probably overlooking something. I can see some macro binding options in services, but I do not need an output, just a process to run with a give macro value.


Is this possible ?


Best Answer

  • IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751  RM Founder
    Solution Accepted

    You are close :smileyhappy:  You can not set macros in the scheduler directly (interesting idea!), but you can schedule other processes which do this for you.


    Everything which has been said is correct.  Independent of the output (even if there is none), you can still just create a web service from your parameterized process.  Now you can create processes executing this web service by using the Get Page operator and using the macro value you desired (per scheduled process).


    But there is also an easier way: you can simply build your parameterized process (like you did) and expose the macros to control it in the context of the process.  You can now build multiple processes executing the original process with "Execute Process".  Here you can set the macros to the desired values.  And those new processes (which simply invoke the original one with different macro values) are then scheduled.


    Hope that helps,




  • JEdwardJEdward RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 574   Unicorn

    Yes, it's really straightforward. Simply ensure the macro value you want to set is setup in the Context of the process.


    View -> Show View -> Context. 


    When you publish the process as a webservice then you can change the values of the macros copied from Context as required.  In your case just the switch with values 1 or 2. 

    Give it a try and if stuck at any point refer to this guide in the user docs for server.  :)


    Creating Webservices



  • kaymankayman Member Posts: 655   Unicorn

    Not sure if we are on the same track tbh. I don't want to create a webservice, I just want to run a (scheduled) process using parameters to trigger a dedicated process flow. My output is currently stored in a repository, and I would like to keep it like that. I have no real value on getting an xml or html returned as I would not use the API, but the process scheduler.


    So can I use a macro in the scheduler, or am I forced to make a static process for all of the possible options ? This is possible but looks like an administrational nightmare if you have a lot of variations and branches (as in my case)



  • kaymankayman Member Posts: 655   Unicorn

    Thanks Ingo,


    I indeed figured out in the meantime I can do this in the desktop builder, and schedule this way the parameter driven flow. Works out ok pretty fine, only slight annoyance is that you cannot see the difference in the server application. Let's say I have like 10 different variations then they will all look the same in the server queue even if behind the scene's they have different values. Not a big issue as such but it means I need to wait for all to finalize to see if I didn't miss a combination :-)


    Would be nice to be able do this on server level also, or at least have some visibility on what macro values were assigned to a process in the queue. Something for the wishlist :-)

  • JEdwardJEdward RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 574   Unicorn

    You might find the operator Print to Console useful for that.  You can use it at the start of the process to see what the macros are whilst they are executing. 


    <?xml version="1.0" encoding="UTF-8"?><process version="7.3.000">
    <value>Gini Index!!!!!</value>
    <value>On Server execution this should be the logged in username. </value>
    <operator activated="true" class="process" compatibility="7.3.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="subprocess" compatibility="7.3.000" expanded="true" height="82" name="Classic Version" width="90" x="45" y="34">
    <process expanded="true">
    <operator activated="true" class="print_to_console" compatibility="7.3.000" expanded="true" height="82" name="Macro Value" width="90" x="45" y="34">
    <parameter key="log_value" value="%{myData}"/>
    <operator activated="true" class="print_to_console" compatibility="7.3.000" expanded="true" height="82" name="Macro Value (2)" width="90" x="179" y="85">
    <parameter key="log_value" value="%{myParameter}"/>
    <connect from_port="in 1" to_op="Macro Value" to_port="through 1"/>
    <connect from_op="Macro Value" from_port="through 1" to_op="Macro Value (2)" to_port="through 1"/>
    <portSpacing port="source_in 1" spacing="0"/>
    <portSpacing port="source_in 2" spacing="0"/>
    <portSpacing port="sink_out 1" spacing="0"/>
    <portSpacing port="sink_out 2" spacing="0"/>
    <operator activated="true" class="subprocess" compatibility="7.3.000" expanded="true" height="82" name="Fancy Version" width="90" x="179" y="136">
    <process expanded="true">
    <operator activated="true" class="text:create_document" compatibility="7.3.000" expanded="true" height="68" name="Create Document" width="90" x="45" y="136">
    <parameter key="text" value="Hello &amp; welcome to my fantastic process that is running. &#10;&#10;The executing user is: %{_ra_user}&#10;&#10;This process is executing with the following settings: &#10;MyData is: %{myData}&#10;MyParameter is: %{myParameter}&#10;"/>
    <operator activated="true" class="text:documents_to_data" compatibility="7.3.000" expanded="true" height="82" name="Documents to Data" width="90" x="179" y="34">
    <parameter key="text_attribute" value="macroBlurb"/>
    <operator activated="true" class="extract_macro" compatibility="7.3.000" expanded="true" height="68" name="Extract Macro" width="90" x="380" y="136">
    <parameter key="macro" value="fancyExample"/>
    <parameter key="macro_type" value="data_value"/>
    <parameter key="attribute_name" value="macroBlurb"/>
    <parameter key="example_index" value="1"/>
    <list key="additional_macros"/>
    <operator activated="true" class="print_to_console" compatibility="7.3.000" expanded="true" height="82" name="Print to Console" width="90" x="581" y="187">
    <parameter key="log_value" value="%{fancyExample}"/>
    <connect from_op="Create Document" from_port="output" to_op="Documents to Data" to_port="documents 1"/>
    <connect from_op="Documents to Data" from_port="example set" to_op="Extract Macro" to_port="example set"/>
    <connect from_op="Extract Macro" from_port="example set" to_op="Print to Console" to_port="through 1"/>
    <portSpacing port="source_in 1" spacing="0"/>
    <portSpacing port="source_in 2" spacing="0"/>
    <portSpacing port="sink_out 1" spacing="0"/>
    <operator activated="true" class="retrieve" compatibility="7.3.000" expanded="true" height="68" name="Retrieve Deals" width="90" x="380" y="136">
    <parameter key="repository_entry" value="//Samples/data/Deals"/>
    <connect from_port="input 1" to_op="Classic Version" to_port="in 1"/>
    <connect from_op="Classic Version" from_port="out 1" to_op="Fancy Version" to_port="in 1"/>
    <connect from_op="Retrieve Deals" from_port="output" to_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="source_input 2" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="0"/>

    What it doesn't show you are the macros set whilst the process is waiting to be executed, for that you might need to dig into the qrtz_ tables on the repository... I'd have a look, but a bit busy at the moment. 


Sign In or Register to comment.