def wait_until_file_disappears_from_metax(project, file_path, timeout=30): """ When unfreezing/deleting files, it takes a while for a file to be removed from metax. """ print('Waiting until file disappears from metax...') for i in range(0, timeout): if not metax.find_file_by_project_and_path(project, file_path): print('File is gone!') return True time.sleep(1) if i % 5 == 0 and i > 0: print('File still not gone...') return False
def wait_until_file_appears_in_metax(project, file_path, timeout=30): """ When freezing files, it takes a while for a file to appear in metax. """ print('Waiting until file appears in metax...') for i in range(0, timeout): if metax.find_file_by_project_and_path(project, file_path): print('Found the file!') return True time.sleep(1) if i % 5 == 0 and i > 0: print('Still didnt find...') return False