Skip to content

Commit

Permalink
Modifcations for storing dse results
Browse files Browse the repository at this point in the history
  • Loading branch information
srivatsankrishnan committed Jan 11, 2025
1 parent 2ab9ce4 commit baf553c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
23 changes: 12 additions & 11 deletions src/cloudai/_core/base_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,19 @@ def __init__(self, mode: str, system: System, test_scenario: TestScenario):

def setup_output_directory(self, base_output_path: Path) -> Path:
"""
Set up and return the output directory path for the runner instance.
Set up and return the base output directory path for the runner instance.
Args:
base_output_path (Path): The base output directory.
Returns:
Path: The path to the output directory.
Path: The path to the base output directory.
"""
if not base_output_path.exists():
base_output_path.mkdir()
current_time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
output_subpath = base_output_path / f"{self.test_scenario.name}_{current_time}"
output_subpath.mkdir()
return output_subpath
base_output__path_with_name = base_output_path / self.test_scenario.name
if not base_output__path_with_name.exists():
base_output__path_with_name = base_output__path_with_name
base_output__path_with_name.mkdir(parents=True, exist_ok=True)
return base_output__path_with_name

def register_signal_handlers(self):
"""Register signal handlers for handling termination-related signals."""
Expand Down Expand Up @@ -264,10 +263,12 @@ def get_job_output_path(self, tr: TestRun) -> Path:
job_output_path = Path() # avoid reportPossiblyUnboundVariable from pyright

try:
test_output_path = self.output_path / tr.name
test_output_path.mkdir()
iteration_path = self.output_path / f"iteration_{tr.dse_iteration}"
iteration_path.mkdir(parents=True, exist_ok=True)
test_output_path = iteration_path / f"{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}" / tr.name
test_output_path.mkdir(parents=True, exist_ok=True)
job_output_path = test_output_path / str(tr.current_iteration)
job_output_path.mkdir()
job_output_path.mkdir(parents=True, exist_ok=True)
except PermissionError as e:
raise PermissionError(f"Cannot create directory {job_output_path}: {e}") from e

Expand Down
3 changes: 2 additions & 1 deletion src/cloudai/cli/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def handle_dry_run_and_run(args: argparse.Namespace) -> int:

agent.configure(env.action_space)

for action in agent.get_all_combinations():
for dse_iteration, action in enumerate(agent.get_all_combinations(), start=1):
tr.dse_iteration = dse_iteration
for key, value in action.items():
update_nested_attr(tr.test.test_definition.cmd_args, key, value)
runner = Runner(args.mode, system, test_scenario)
Expand Down

0 comments on commit baf553c

Please sign in to comment.