1
votes

I have a Logic App with an Until action to keep looping until a condition is met (in this case when the Azure Container Instance has the state 'Terminated'). I've changed the limit 'Count' to 600. I left the 'Timeout' on the default value (PT1H). Amongst other actions the Until action contains a Delay action which I've set to 1 second. So in theory the math would be: 600 x 1 sec = 10 minutes max. Right? I triggered the Logic App late in the afternoon and went home. Checked the run when I got home to find out it ran for 26 minutes! See screenshot:

Until action in Logic App

So, can anyone explain this? Thanks in advance for replying.

Update #1: For Each info The For Each inside the Until loops through the Containers in the group (which is just 1 Container) and puts the state of the containers in the variable (which is used for the condition of the Until). That's it.

Update #2: All actions Logic App All the actions of the Logic App:

Logic App actions part 1 Logic App actions part 2 Logic App actions part 3

note: For the keen eyed, I'm indeed not deleting the container group yet. For debugging purposes.

Update #3: Initialize Variable info

Initialize Variable action

note: This "state" is the state of the container group which is simply used to initially fill the variable. In the Until loop it's filled with state of the container instance inside the group.

Update #4: Get Properties in For Each Get Properties For Each

note: Asked in the chat.

1
I would expect that at least one of the loop iterations the other actions (Get properties... and For each) took a longer time than shown in the first iteration, perhaps doing retries. I am not sure how to tell other than clicking Next through all the iterations and checking the durations.Scott Mildenberger
@ScottMildenberger Thnx 4 replying. I'll add an update explaining what the For Each does. Appologies for the ommision.Danny van der Kraan
Can you provide all the actions in the logic app? I cannot see the actions in each step.Charles Xu
@CharlesXu Thank you for replying! Yes of course. See update 2.Danny van der Kraan
How do you initialize the variableCharles Xu

1 Answers

0
votes

For your issue, you need to know that when the action that creates the container group is finished, the container group may not in the terminate state, but the action is finished so that the state will persist and not change any more.

So you need to get the state all the time in your loop. The right sequence for the container group should like this:

  1. create the container group;
  2. initialize the variable currentState;
  3. create the loop, your until setting condition is right, but you need to put the action that gets the property of the container group in your for-each loop. So inside the for-each, get the property, set the variable with the state, then delay.