def locate_latest_recipe_outputs()

in cpp/ext/recipeext.py [0:0]


def locate_latest_recipe_outputs():
    base_dir = os.path.join(os.path.dirname(__file__), '..')
    matches = list(Path(base_dir).rglob('recipes_out.arrow'))
    if len(matches) == 0:
        raise Exception(
            f"Could not find any recipes_out.arrow files in {base_dir}.  Have you run the C++ tests/recipes?")

    matches_with_mtimes = [
        {'path': str(match), 'mtime': os.path.getmtime(str(match))} for match in matches]
    sorted_matches = [match['path'] for match in sorted(
        matches_with_mtimes, key=lambda x: x['mtime'])]
    for match_with_mtime in matches_with_mtimes:
        path = match_with_mtime['path']
        mtime = match_with_mtime['mtime']
        logger.info(f'Considering recipe file {path} last updated at {mtime}')
    return sorted_matches[-1]