Dir Database

Manage ‘id’ directories. The name of the directory is an integer, which essentially serves as a filesystem primary key.

Managing Private Key Directories

pavilion.dir_db.create_id_dir(id_dir: pathlib.Path) -> (<class 'int'>, <class 'pathlib.Path'>)
In the given directory, create the lowest numbered (positive integer)
directory that doesn’t already exist.
Parameters:

id_dir (Path) – Path to the directory that contains these ‘id’ directories

Returns:

The id and path to the created directory.

Raises:
  • OSError – on directory creation failure.
  • TimeoutError – If we couldn’t get the lock in time.
pavilion.dir_db.make_id_path(base_path, id_)

Create the full path to an id directory given its base path and the id.

Parameters:
  • base_path (Path) – The path to where id directories are stored.
  • id (int) – The id number
Return type:

Path

pavilion.dir_db.select(id_dir: pathlib.Path, filter_func: Callable[[pathlib.Path], bool] = <function default_filter>) → List[pathlib.Path]

Return a list of all test paths in the given id_dir that pass the given filter function. The paths returned are guaranteed (within limits) to be an id directory, and only paths that pass the filter function are returned.