def regenerate_all_pages_related_to_videos(video_ids): """Same as above, but on a list of videos""" paths_to_regenerate = set() # unique set for video_id in video_ids: for video_path in topic_tools.get_video_page_paths(video_id=video_id): paths_to_regenerate = paths_to_regenerate.union( generate_all_paths(path=video_path, base_path=topic_tools.get_topic_tree()["path"]) ) # start at the root for exercise_path in topic_tools.get_exercise_page_paths(video_id=video_id): paths_to_regenerate = paths_to_regenerate.union( generate_all_paths(path=exercise_path, base_path=topic_tools.get_topic_tree()["path"]) ) # start at the root # Now, regenerate any page. for path in paths_to_regenerate: create_cache(path=path, force=True) return paths_to_regenerate
def regenerate_all_pages_related_to_videos(video_ids): """Same as above, but on a list of videos""" paths_to_regenerate = set() # unique set for video_id in video_ids: for video_path in topic_tools.get_video_page_paths(video_id=video_id): paths_to_regenerate = paths_to_regenerate.union( generate_all_paths(path=video_path, base_path=topic_tools.get_topic_tree() ['path'])) # start at the root for exercise_path in topic_tools.get_exercise_page_paths( video_id=video_id): paths_to_regenerate = paths_to_regenerate.union( generate_all_paths(path=exercise_path, base_path=topic_tools.get_topic_tree() ['path'])) # start at the root # Now, regenerate any page. for path in paths_to_regenerate: create_cache(path=path, force=True) return paths_to_regenerate
def invalidate_all_pages_related_to_video(video_id=None): """Given a video file, recurse backwards up the hierarchy and invalidate all pages. Also include video pages and related exercise pages. """ # Expire all video files and related paths video_paths = topic_tools.get_video_page_paths(video_id=video_id) exercise_paths = topic_tools.get_exercise_page_paths(video_id=video_id) leaf_paths = set(video_paths).union(set(exercise_paths)) for leaf_path in leaf_paths: all_paths = generate_all_paths(path=leaf_path, base_path=topic_tools.get_topic_tree()["path"]) for path in filter(has_cache_key, all_paths): # start at the root expire_page(path=path)
def invalidate_all_pages_related_to_video(video_id=None): """Given a video file, recurse backwards up the hierarchy and invalidate all pages. Also include video pages and related exercise pages. """ # Expire all video files and related paths video_paths = topic_tools.get_video_page_paths(video_id=video_id) exercise_paths = topic_tools.get_exercise_page_paths(video_id=video_id) leaf_paths = set(video_paths).union(set(exercise_paths)) for leaf_path in leaf_paths: all_paths = generate_all_paths( path=leaf_path, base_path=topic_tools.get_topic_tree()['path']) for path in filter(has_cache_key, all_paths): # start at the root expire_page(path=path)
import topic_tools TOPICS = topic_tools.get_topic_tree() NODE_CACHE = topic_tools.get_node_cache()