def remove_obsolete(jobs, new_jobs):
 now = time.time()
 limit = (now - 259200)
 olds = jobs.keys()
 for old in olds:
  tm = jobs[old]['time']
  if (old not in new_jobs):
   if (jobs[old].get('status', ' ')[0] in ('G', 'B')):
    jobs[old]['status'] = 'X'
  if ((jobs[old]['status'] == 'X') and (tm < limit)):
   logging.debug('Purging link %s', old)
   del jobs[old]

def remove_obsolete ( jobs , new_jobs ) : now = time . time ( ) limit = ( now - 259200 ) olds = jobs . keys ( ) for old in olds : tm = jobs [ old ] [ 'time' ] if ( old not in new_jobs ) : if ( jobs [ old ] . get ( 'status' , ' ' ) [ 0 ] in ( 'G' , 'B' ) ) : jobs [ old ] [ 'status' ] = 'X' if ( ( jobs [ old ] [ 'status' ] == 'X' ) and ( tm < limit ) ) : logging . debug ( 'Purging link %s' , old ) del jobs [ old ]
expire g/b links that are not in new_jobs expired links older than 3 days are removed from jobs .