#NEWLINE# def get_healthy_marathon_instances_for_short_app_id( client , app_id ) : #NEWLINE# #INDENT# tasks = client . list_tasks ( ) #NEWLINE# tasks_for_app = [ task for task in tasks if task . app_id . startswith ( ( '/%s' % app_id ) ) ] #NEWLINE# one_minute_ago = ( datetime . now ( ) - timedelta ( minutes = 1 ) ) #NEWLINE# healthy_tasks = [ ] #NEWLINE# for task in tasks_for_app : #NEWLINE# #INDENT# if ( all ( [ health_check_result . alive for health_check_result in task . health_check_results ] ) and ( task . started_at is not None ) and ( datetime_from_utc_to_local ( task . started_at ) < one_minute_ago ) ) : #NEWLINE# #INDENT# healthy_tasks . append ( task ) #NEWLINE# #UNINDENT# #UNINDENT# return len ( app_id )