LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Only run a node based on a date

    Employee
    Posted 02-22-2015 16:36

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dglavastorm

    Hi, we have a fairly complex graph where one of the sub-Composites inside the Main Composite is only run on a Monday. Currently we are going in Monday morning, enabling the sub-composite and running, then disabling for the rest of the week.

    Is there any node we can place in front of the sub-composite, or any other way to stipulate that this sub-Composite is only run on a Monday ?

    The sub-composite can't error as the main composite it is part of must complete so it will trigger another node attached by a clock wire.

    Also it's not as simple as just passing no data into the Sub-composite - it actually pulls the bulk of it's information from JDBC nodes when it runs.

    Effectively we need something that runs the main nodes but gets to the point where it realises this is not a Monday, then stops that sub-Composite from running but completes the other nodes in the main composite.

    Hope that makes sense :-)

    Regards,

    David


  • 2.  RE: Only run a node based on a date

    Employee
    Posted 03-01-2015 16:27

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dglavastorm

    Bumping this as no answer - is this something that can't be done ?


  • 3.  RE: Only run a node based on a date

    Employee
    Posted 03-04-2015 01:51

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hi,

    This probably depends on the structure of the graph somewhat, and if there are nodes connected to outputs or outclocks of the sub-composite which should or should not run depending on whether or not the sub-composite gets run.
    If the main composite itself needs to complete obut the nodes within the sub-composite to trigger
    However, in general, this sort of behavior can be done via placing a filter node which checks the current day of the week and then uses the BRAINscript setSuccessReturnCode function to determine whether nodes which use the filter nodes output data will execute.

    I've attached an example to show how this can be done.
    Bear in mind that any nodes within the sub-composite which don't take input will execute.

    If you have nodes within the sub-composite which don't take any inputs and which also shouldn't be run on Mondays, then you would need to also connect the output of the filter node to the inclock of the sub-composite and change the setSuccessReturnCode to 200.

    In that case, you would then need to wire the outclocks of all of the other end-point nodes within the main composite (in my example, this would be the node "Other Node", "Some Other data Path", "Some Other Data Path 2") to the composite outclock. This would ensure that nodes clocked to the output of the main-composite node would not execute until those nodes have been executed.

    In such cases, however, you can't configure clocked downstream nodes to execute only after all nodes within the Main composite that should execute have executed. In my example, this means that you could configure the "Additional Clocked Processing" node to wait until all of the nodes except for the sub-composite had completed execution. If it was Monday and the sub-composite was to be executed, then the "Additional Clocked Processing" node would not wait until the sub-composite had completed.

    Hope this helps ... If it makes sense... Not sure I explained well.

    Tim.
    Attachments:
    RunSubCompositeOnlyOnMonday.brg


  • 4.  RE: Only run a node based on a date

    Employee
    Posted 03-05-2015 19:28

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dglavastorm

    Hi Tim - he Subcomposite indeed has nodes that don't take an imput, and they are JDBC nodes so take ages to run.

    How do I connect an output to an inclock ? I've tried connecting drawing wires between the output and the Inclock and vice versa but nothing happens.

    " If you have nodes within the sub-composite which don't take any inputs and which also shouldn't be run on Mondays, then you would need to also connect the output of the filter node to the inclock of the sub-composite and change the setSuccessReturnCode to 200. "


  • 5.  RE: Only run a node based on a date

    Employee
    Posted 03-06-2015 01:46

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hey,

    Sorry - I meant to say to "connect the outclock from the filter node to the inclock of the sub-composite"

    Tim.


  • 6.  RE: Only run a node based on a date

    Employee
    Posted 03-06-2015 07:19

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    Go to Tools/Preferences/DisplayModes and then make sure "Clocks" is checked.
    Then you will see the clocks displayed above each node, and the in/out clocks will be displayed when you are inside of a composite.

    Click on any clock - input or output - it will turn green. Then drag it to the matching clock you'd like to connect it to.

    FYI: To disconnect, you repeat the same action: click on one end, drag it to the other end, it will turn red and disconnect when you let go of the mouse.


  • 7.  RE: Only run a node based on a date

    Employee
    Posted 03-27-2015 11:40

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stevem

    If this is running from a server and not in BRE you could pass a parameter to the graph on Mondays like
    export p_DayOfWeek=`date "+%a"`
    then in the graph have a graph level parameter DayOfWeek set to {{*DayOfWeek*}} # Returns Mon Tue Wed...
    in all the sub nodes or if grouped into a composite, set the "Enabled" to "other" and enter "{{^DayOfWeek"}} == "Mon"

    Then on mondays they will be enabled and all other days disabled


  • 8.  RE: Only run a node based on a date

    Employee
    Posted 03-27-2015 11:44

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    As mentioned previously, I don't believe this will work since the enabled/disabled parameter is evaluated at compile time & disabled nodes are not compiled into the BRX. The server does not look at the enabled parameter to see whether a node should be executed as this calculation is done at the time the graph is compiled.

    [Note - just realized I hadn't mentioned that in this thread - I think it was another one]


  • 9.  RE: Only run a node based on a date

    Employee
    Posted 03-31-2015 08:09

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ltolleson

    You could possibly do this using a MetaCheck node and pass in the parameter value as mentioned before. Check the value of the parameter in a filter node and output a newField based on the value of the parameter. Then you would use the MetaCheck node, along with clocks, to allow or deny the processing of a downstream composite if that newField exist in the output of the filter. The MetaCheck node would be checking to see if the newField exists. The ability to get this to work could depend on if there are nodes to be processed after the composite is skipped. If the composite is a dead end path in your graph, then this should work.

    See attached sample graphs
    Attachments:
    DependentProcess_MetaCheck.brg
    DependentProcess_MetaCheck.brp