Forum Discussion

bmcwilliams's avatar
bmcwilliams
New Contributor
21 days ago
Solved

Problem With DM Sequence Parameter Resolution Order

Good afternoon,

I'm encountering an issue and hoping someone could share how they've worked around this in the past.

We have a task that runs over a finite number of Entities.  Historically the underlying Business Rule was kicked off via DM Step with Entity: E#Top.Base.  It's not exactly "Top" but something similar to hopefully capture all relevant Entities to this particular task.  The runtime was always a consideration as it also runs for all remaining periods within our current year.

In an effort to reduce runtime we introduced a "Unique Entity" parameter.  This is defined by a Business Rule that runs and queries a source table to determine only the Entities that this particular task needs to be run on.  In practice this has greatly reduced runtime on the task.  Runs more than 2x faster.

The problem:

The source table that populates the list of "unique entities" is also updated within the same Data Management Sequence.  Something like:

  1) Update source table

  2) Run task described above

Because both Steps are within the same Sequence, the "Unique Entity" business rule is being executed before #1 Update source table happens.  So any changes to the source table versus a previous run could cause an Entity to be missed.

I wish the Filter would get resolved when the Step is executed instead of when the Sequence is executed.

Hopefully that makes sense to everyone? The only workaround that I'm aware of is to kick off the 2nd Step at the end of the 1st step.  This removes a lot of the visibility and, as part of our current process, Step 1 is sometimes executed on its own to preview Stage data before the full Cube posting takes place.

I appreciate anyone who can provide guidance on this matter.

Thanks,

Brandon
  • I see, I misunderstood your initial question.

    Yes, the variables / filters are resolved prior to executing the sequence i.e.: the filters for both your step 1 and step 2 are resolved initially as you are experiencing.
    This means that if you want your Step1 to determine the entities that should run in your Step2 the obvious way would be, as you mention, to trigger your step 2 using the ExecuteCustomCalculateBusinessRule (so you can control the scope / list of entities it should run for).
    If you want to still allow your Step1 to be ran in isolation, you could add an optional parameter (if not specified it would not trigger step2) or define a auxiliar step2 that runs for a single dummy DU (i.e.: E#None, specific period, etc) and its whole purpose would be to call the proper Step 2 logic, for the defined Entities, via the ExecuteCustomCalculateBusinessRule. This way you could keep the same 2 step sequence config while controlling the scope of your step 2 logic.

    Another option would be to have your step 1 saving the list of entities in globals and configure the Step2 to run for all valid entities with an If at the very beginning to check if the api.Pov.Entity.MemberId is meant to run (i.e.: is part of the list) and 
    immediately returning Nothing if not. Depending on the number of valid entities I'd expect this option not to be as optimal from a performance POV when compared with the options above.

5 Replies

  • FredLucas's avatar
    FredLucas
    Icon for OneStream Employee rankOneStream Employee

    Hi Brandon,

    Have you considered using Globals?
    You could try using globals to store the initial list of "unique entities".

    The sequence runs the entities in parallel so you can use synclock to ensure this object is updated one single time (the first time).

    You'd then update your code to get the unique entities list from the globals instead of the table. This way the process is not impacted by any updates to the source table that happen during the execution. 

    Hope this helps.

    Thanks,

    Fred

  • bmcwilliams's avatar
    bmcwilliams
    New Contributor

    I haven't considered Globals.  I don't really have any experience with them, yet, but I'll take a look.

    To your last point.  I actually want the 2nd Step in the Sequence to be impacted by the 1st Step in the Sequence - if that makes sense?  Step 1 updates the Table that determines the entities, and then Step 2 uses a unique list of entities from that Table as an Entity Filter.  Problem I'm running into is that Step 2 is currently using a unique list of entities from the last time the Sequence was ran instead of what's updated from Step 1.  The Filter is resolved before Step 1 of the current sequence is ever kicked off.

    If I'm trying to use this list of entities as an Entity Filter on Step 2 within a Sequence would it get retrieved from Globals before or after Step 1?

    Logically I would think Step 2 filters would get resolved when Step 2 is kicked off but that doesn't appear to be the case.

    My experience (Entity Filter is being set under Data Units on the Step itself; I've tried both parameter and XFBR rule here):

    Unique list of entities in the table before the Sequence is initiated: Entity1, Entity2, Entity5

    Unique list of entities after Step 1 finishes: Entity1, Entity3, Entity5

    Entity Filter that gets ran for Step 2: Entity1, Entity2, Entity5.  This is where I'm getting confused.  I wish it would use after Step 1 finishes.

  • FredLucas's avatar
    FredLucas
    Icon for OneStream Employee rankOneStream Employee

    I see, I misunderstood your initial question.

    Yes, the variables / filters are resolved prior to executing the sequence i.e.: the filters for both your step 1 and step 2 are resolved initially as you are experiencing.
    This means that if you want your Step1 to determine the entities that should run in your Step2 the obvious way would be, as you mention, to trigger your step 2 using the ExecuteCustomCalculateBusinessRule (so you can control the scope / list of entities it should run for).
    If you want to still allow your Step1 to be ran in isolation, you could add an optional parameter (if not specified it would not trigger step2) or define a auxiliar step2 that runs for a single dummy DU (i.e.: E#None, specific period, etc) and its whole purpose would be to call the proper Step 2 logic, for the defined Entities, via the ExecuteCustomCalculateBusinessRule. This way you could keep the same 2 step sequence config while controlling the scope of your step 2 logic.

    Another option would be to have your step 1 saving the list of entities in globals and configure the Step2 to run for all valid entities with an If at the very beginning to check if the api.Pov.Entity.MemberId is meant to run (i.e.: is part of the list) and 
    immediately returning Nothing if not. Depending on the number of valid entities I'd expect this option not to be as optimal from a performance POV when compared with the options above.

  • bmcwilliams's avatar
    bmcwilliams
    New Contributor

    Thank you Fred.  I appreciate the response above.  We'll probably be moving forward with the option to call Step 2 within Step 1.  It's not ideal but it will work.

    Do you know if it's anywhere on the radar to have a toggle within a Step to set filter / parameter resolution on Step execution as opposed to Sequence execution?

    • FredLucas's avatar
      FredLucas
      Icon for OneStream Employee rankOneStream Employee

      Sounds good.
      Not that I know of but you can suggest it on IdeaStream.