Skip to content

Commit 927488c

Browse files
committed
[script] add class methods
1 parent b5d0d2c commit 927488c

File tree

1 file changed

+11
-3
lines changed
  • vtr_flow/scripts/python_libs/vtr

1 file changed

+11
-3
lines changed

vtr_flow/scripts/python_libs/vtr/util.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ class RunDir:
3232
# If it is None, the latest run directory will be parsed.
3333
g_run_dir_name = None
3434

35+
@classmethod
36+
def set_run_dir_name(cls, run_dir_name):
37+
cls.g_run_dir_name = run_dir_name
38+
39+
@classmethod
40+
def get_run_dir_name(cls):
41+
return cls.g_run_dir_name
42+
3543

3644
class RawDefaultHelpFormatter(
3745
argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter
@@ -240,7 +248,7 @@ def set_global_run_dir(current_run_dir_name):
240248
"""
241249
Set the global run directory name.
242250
"""
243-
RunDir.g_run_dir_name = current_run_dir_name
251+
RunDir.set_run_dir_name(current_run_dir_name)
244252

245253

246254
def check_cmd(command):
@@ -583,8 +591,8 @@ def get_latest_run_dir_name(base_dir):
583591
Returns the highest run number of all run directories with in base_dir
584592
"""
585593
latest_run_dir_name = ""
586-
if RunDir.g_run_dir_name is not None:
587-
latest_run_dir_name = RunDir.g_run_dir_name
594+
if RunDir.get_run_dir_name() is not None:
595+
latest_run_dir_name = RunDir.get_run_dir_name()
588596
else:
589597
run_number = 1
590598
run_dir = Path(base_dir) / run_dir_name(run_number)

0 commit comments

Comments
 (0)