NotebookFinder#

class mobu.services.notebook_finder.NotebookFinder(*, repo_path, repo_config, exclude_dirs=None, collection_rules=None, applications=None, logger)#

Bases: object

A helper to select which notebooks to execute based on config.

This config can come from many places, like flock config, or an in-repo config file.

Parameters:
  • repo_path (Path) – The local path on disk of a cloned repository of notebooks.

  • repo_config (RepoConfig) – Config from a config file in the notebook repo.

  • exclude_dirs (Optional[set[Path]], default: None) – DEPRECATED: A set of paths relative to the repo root in which any descendant notebooks will not be executed.

  • collection_rules (Optional[list[CollectionRule]], default: None) – A set of rules describing which notebooks in a repo to run.

  • applications (Optional[list[str]], default: None) – A list of Phalanx applications that are available in the environment.

  • logger (BoundLogger) – A structlog logger.

Methods Summary

find()

Return a list of notebooks to execute.

Methods Documentation

find()#

Return a list of notebooks to execute. :rtype: set[Path]

  • Start with all notebooks in the repo.

  • For each collection rule, remove notebooks:

    • Intersect rules will remove notebooks that are not in the intersection of:

      • The current set

      • The union of the matched patterns.

    • Exclude rules will remove notebooks from the current set that are in the union of the matched patterns.

  • Remove any remaining notebooks that require unavailable applications.