@@ -34,6 +34,8 @@ class LoggingConfig(BaseModel):
3434 """Configuration for the logging."""
3535
3636 _run_name = get_run_name ()
37+ _dirpath : Path | None = None
38+ _dump_dir : Path | None = None
3739
3840 project_dir : Path | str | None = Field (None , description = "Path to the directory with different runs." )
3941 """Path to the directory with different runs."""
@@ -51,25 +53,22 @@ class LoggingConfig(BaseModel):
5153 @property
5254 def dirpath (self ) -> Path :
5355 """Path to the directory where the logs will be saved."""
54- if self .project_dir is None :
55- project_dir = Path .cwd () / "runs"
56- else :
57- project_dir = self .project_dir
58-
59- if not hasattr (self , "_dirpath" ):
60- self ._dirpath = Path (project_dir ) / self .get_run_name ()
56+ if self ._dirpath is None :
57+ project_dir = Path .cwd () / "runs" if self .project_dir is None else Path (self .project_dir )
58+ self ._dirpath = project_dir / self .get_run_name ()
6159 return self ._dirpath
6260
6361 @property
6462 def dump_dir (self ) -> Path :
6563 """Path to the directory where the modules will be dumped."""
66- if not hasattr ( self , " _dump_dir" ) :
64+ if self . _dump_dir is None :
6765 self ._dump_dir = self .dirpath / "modules_dumps"
6866 return self ._dump_dir
6967
7068 def get_run_name (self ) -> str :
71- """Get the run name."""
72- return self .run_name or self ._run_name
69+ if self ._run_name is None :
70+ self ._run_name = self .run_name if self .run_name is not None else get_run_name ()
71+ return self ._run_name
7372
7473
7574class VectorIndexConfig (BaseModel ):
0 commit comments