Skip to content

Project Manager¤

ProjectManager handles all filesystem operations for a run: creating the unique run directory, generating an integer RNG seed, creating subdirectories, and writing the sentinel running.txt file.

ProjectManager¤

nnfe.project_manager.ProjectManager ¤

Manages the on-disk run directory and associated metadata.

Parameters:

Name Type Description Default
config

:class:~nnfe.nnfe_config.ProjectConfig instance. If config.save is True, a unique subdirectory is created under config.parent_dir / config.name and all extra directories listed in config.extra_dirs are created inside it.

required

Attributes:

Name Type Description
config

:class:~nnfe.nnfe_config.ProjectConfig used to build this manager.

save

Whether saving is enabled.

parent

Absolute path to the unique run directory, or None if saving is disabled.

key

Integer RNG seed derived from the directory name, or None if saving is disabled.

paths

Mapping of logical directory names to resolved :class:pathlib.Path objects (populated from config.extra_dirs).

print

Print-progress interval (epochs), or False if disabled.

save_progress

Intermediate-save interval (epochs), or False if disabled.

trained_weights_path

Path to pre-trained weights, if specified in config.

generate_parent_and_rng() ¤

Generate a unique run directory path and integer RNG seed.

Picks a random integer in [0, 1e5) and checks that a correspondingly named subdirectory does not already exist, retrying until a free name is found.

Returns:

Type Description

Tuple of (parent_path, key) where parent_path is a

class:pathlib.Path and key is the integer seed.

create_dirs() ¤

Create all subdirectories listed in config.extra_dirs.

Also writes a running.txt sentinel file (value 1) so monitoring scripts can detect that a run is in progress.

Returns:

Type Description

Dict mapping each key in config.extra_dirs to its resolved

class:pathlib.Path.