Guest User

Untitled

a guest
Oct 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. file_path_list = [os.path.join(sample.analysis.directory or '', file_name) for file_name in sample.status_files_upload.keys()]
  2. max_timeout = time() + Sample.TIMEOUT_SEG
  3. files_ready = lambda files: all([base_handler.exists_dir(file_path) for file_path in files])
  4.  
  5. while not files_ready(file_path_list) and time() < max_timeout:
  6. sleep(60) # espera 1 minuto antes de testar de novo
  7.  
  8. if not files_ready(file_path_list):
  9. celery_logger.info('[!] Sample files not found')
  10. sample.status = Sample.STATUS_TYPE.ERROR.value
  11. sample.save(update_fields=['status'])
  12. raise Exception('[!] Sample files not found')
  13.  
  14. # SEM ELSE!!
  15. # ...
  16. sample.execute()
Add Comment
Please, Sign In to add comment