def _time_last_active(cluster_summary, steps):
 timestamps = []
 for key in ('creationdatetime', 'readydatetime'):
  value = getattr(cluster_summary.status.timeline, key, None)
  if value:
   timestamps.append(value)
 for step in steps:
  for key in ('creationdatetime', 'startdatetime', 'enddatetime'):
   value = getattr(step.status.timeline, key, None)
   if value:
    timestamps.append(value)
 last_timestamp = max(timestamps)
 return iso8601_to_datetime(last_timestamp)

def _time_last_active ( cluster_summary , steps ) : timestamps = [ ] for key in ( 'creationdatetime' , 'readydatetime' ) : value = getattr ( cluster_summary . status . timeline , key , None ) if value : timestamps . append ( value ) for step in steps : for key in ( 'creationdatetime' , 'startdatetime' , 'enddatetime' ) : value = getattr ( step . status . timeline , key , None ) if value : timestamps . append ( value ) last_timestamp = max ( timestamps ) return iso8601_to_datetime ( last_timestamp )
when did something last happen with the given cluster? things we look at: * cluster .