def thread_get_and_update_file_from_Project():
    """Fetches one item from the Project and updates it with a new file."""
    
    while syn.test_keepRunning:
        id = get_all_ids_from_Project()
        if len(id) <= 0:
            continue
            
        id = id[random.randrange(len(id))]
        entity = syn.get(id)
        
        # Replace the file and re-store
        path = utils.make_bogus_data_file()
        schedule_for_cleanup(path)
        entity.path = path
        entity = store_catch_412_HTTPError(entity)
        if entity is not None:
            # print("I updated %s" % entity.id)
            assert os.stat(entity.path) == os.stat(path)
            
        sleep_for_a_bit()
    
####################
## Thread Helpers ##
####################
dataset/ETHPy150Open Sage-Bionetworks/synapsePythonClient/tests/integration/test_caching.py/thread_get_and_update_file_from_Project/original