Skip to content

Commit 9bfc463

Browse files
committed
fix lints
1 parent 2a858bd commit 9bfc463

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

neps/plot/tensorboard_eval.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class tblogger: # noqa: N801
3939
@classmethod
4040
def initiate_internal_configurations(
4141
cls,
42-
root_directory: Path | None = None,
43-
pipeline_directory: Path | None = None,
44-
previous_pipeline_directory: Path | None = None,
42+
root_directory: Path | str | None = None,
43+
pipeline_directory: Path | str | None = None,
44+
previous_pipeline_directory: Path | str | None = None,
4545
) -> None:
4646
"""Initialize internal directories and configuration for TensorBoard logging.
4747
@@ -71,6 +71,26 @@ def initiate_internal_configurations(
7171
if trial.metadata.previous_trial_location
7272
else None
7373
)
74+
else:
75+
# Convert str paths to Path objects
76+
root_directory = (
77+
Path(root_directory)
78+
if isinstance(root_directory, str)
79+
else root_directory
80+
)
81+
pipeline_directory = (
82+
Path(pipeline_directory)
83+
if isinstance(pipeline_directory, str)
84+
else pipeline_directory
85+
)
86+
previous_pipeline_directory = (
87+
Path(previous_pipeline_directory)
88+
if isinstance(previous_pipeline_directory, str)
89+
else previous_pipeline_directory
90+
)
91+
92+
if previous_pipeline_directory and not previous_pipeline_directory.exists():
93+
previous_pipeline_directory = None
7494

7595
register_notify_trial_end("NEPS_TBLOGGER", cls.end_of_config)
7696

neps/runtime.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@ def _set_workers_neps_state(state: NePSState) -> None:
111111
global _WORKER_NEPS_STATE # noqa: PLW0603
112112
_WORKER_NEPS_STATE = state
113113

114+
114115
def is_in_progress_trial_set() -> bool:
115116
"""Check if the currently running trial in this process is set."""
116117
return _CURRENTLY_RUNNING_TRIAL_IN_PROCESS is not None
117118

119+
118120
def get_in_progress_trial() -> Trial:
119121
"""Get the currently running trial in this process."""
120122
if _CURRENTLY_RUNNING_TRIAL_IN_PROCESS is None:

0 commit comments

Comments
 (0)