I have a python boto3 script that does the ff:
- create a list of tasks with 'RUNNING' status for a service via
- do a for loop for the list of tasks above and stop each via
- describe the service to get the runningCount and desiredCount
- while loop if runningCount < desiredCount -- meaning a task is currently being stopped and has not been replaced yet, so don't stop the next task yet!
while myservice['services']['runningCount'] < myservice['services']['desiredCount']:
If the while loop is not true anymore -- meaning both running and desired counts are equal, stop the next task in the list.
This is the actual flow and I am unable to show the actual code as I'm still employed by my current job and all my code belong to them :)