#NEWLINE# @ when ( 'the {which} app is down to {num} instances' ) #NEWLINE# def when_the_which_app_is_down_to_num_instances( context , which , num ) : #NEWLINE# #INDENT# app_id = which_id ( context , which ) #NEWLINE# while True : #NEWLINE# #INDENT# tasks = context . marathon_client . list_tasks ( app_id ) #NEWLINE# if ( len ( [ t for t in tasks if t . started_at ] ) <= int ( which ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# time . sleep ( 0.5 )