def dump_data_every_thread(func, delay_minutes, save_thread_ptr):
 try:
  func()
 except KeyboardInterrupt:
  pass
 save_thread = threading.Timer((delay_minutes * 60), dump_data_every_thread, args=(func, delay_minutes, save_thread_ptr))
 save_thread.name = 'ProfilingDumpData'
 save_thread.daemon = True
 save_thread.start()
 if save_thread_ptr:
  save_thread_ptr.pop(0)
 save_thread_ptr.append(save_thread)

def dump_data_every_thread ( func , delay_minutes , save_thread_ptr ) : try : func ( ) except KeyboardInterrupt : pass save_thread = threading . Timer ( ( delay_minutes * 60 ) , dump_data_every_thread , args = ( func , delay_minutes , save_thread_ptr ) ) save_thread . name = 'ProfilingDumpData' save_thread . daemon = True save_thread . start ( ) if save_thread_ptr : save_thread_ptr . pop ( 0 ) save_thread_ptr . append ( save_thread )
this is a thread target which every x minutes .