Skip to content

Commit 770c444

Browse files
committed
Reflect Andrei's comments
1 parent ab76fe9 commit 770c444

File tree

6 files changed

+14
-23
lines changed

6 files changed

+14
-23
lines changed

src/cloudai/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def main() -> None:
274274
system, tests, test_scenario = parser.parse(tests_dir, test_scenario_path)
275275

276276
if output_dir:
277-
system.output_path = Path(output_dir.absolute())
277+
system.output_path = output_dir.absolute()
278278
system.update()
279279

280280
if args.mode in ["install", "uninstall"]:

src/cloudai/parser/system_parser/slurm_system_parser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
import os
1817
from pathlib import Path
1918
from typing import Any, Dict, List
2019

@@ -58,12 +57,12 @@ def str_to_bool(value: Any) -> bool:
5857
install_path = data.get("install_path")
5958
if not install_path:
6059
raise ValueError("Field 'install_path' is required.")
61-
install_path = Path(os.path.abspath(install_path))
60+
install_path = Path(install_path).absolute()
6261

6362
output_path = data.get("output_path")
6463
if not output_path:
6564
raise ValueError("Field 'output_path' is required.")
66-
output_path = Path(os.path.abspath(output_path))
65+
output_path = Path(output_path).absolute()
6766

6867
default_partition = data.get("default_partition")
6968
if not default_partition:

src/cloudai/parser/system_parser/standalone_system_parser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
import os
1817
from pathlib import Path
1918
from typing import Any, Dict
2019

@@ -46,6 +45,6 @@ def parse(self, data: Dict[str, Any]) -> StandaloneSystem:
4645
output_path = data.get("output_path")
4746
if not output_path:
4847
raise ValueError("Field 'output_path' is required.")
49-
output_path = Path(os.path.abspath(output_path))
48+
output_path = Path(output_path).absolute()
5049

5150
return StandaloneSystem(name=name, output_path=output_path)

src/cloudai/report_generator/tool/tensorboard_data_reader.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
import os
1817
from pathlib import Path
1918
from typing import List, Tuple
2019

@@ -43,15 +42,12 @@ def extract_data(self, tag: str) -> List[Tuple[int, float]]:
4342
from tbparse import SummaryReader # lazy import to improve overall performance
4443

4544
data = []
46-
for root, _, files in os.walk(self.directory_path):
47-
for file in files:
48-
if file.startswith("events.out.tfevents"):
49-
path = Path(root) / file
50-
reader = SummaryReader(str(path))
51-
df = reader.scalars
52-
if tag in df["tag"].values:
53-
filtered_data = df[df["tag"] == tag]
54-
data.extend(filtered_data[["step", "value"]].values)
45+
for path in self.directory_path.rglob("events.out.tfevents*"):
46+
reader = SummaryReader(str(path))
47+
df = reader.scalars
48+
if tag in df["tag"].values:
49+
filtered_data = df[df["tag"] == tag]
50+
data.extend(filtered_data[["step", "value"]].values)
5551
return data
5652

5753

src/cloudai/schema/test_template/jax_toolbox/slurm_command_gen_strategy.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def _create_run_script(
216216
env_vars: Dict[str, str],
217217
cmd_args: Dict[str, str],
218218
extra_cmd_args: str,
219-
) -> str:
219+
) -> None:
220220
"""
221221
Generate and writes the run.sh script to the specified output directory.
222222
@@ -230,9 +230,6 @@ def _create_run_script(
230230
cmd_args (Dict[str, str]): Command-line arguments.
231231
extra_cmd_args (str): Additional command-line arguments to be included
232232
in the srun command.
233-
234-
Returns:
235-
str: The path to the run.sh script that was created.
236233
"""
237234
test_name = self.test_name
238235

@@ -267,7 +264,6 @@ def set_xla_flags(test_name: str, profile_enabled: bool):
267264
with open(run_script_path, "w") as run_file:
268265
run_file.write("\n".join(run_script_content))
269266
os.chmod(run_script_path, 0o755)
270-
return str(run_script_path)
271267

272268
def _script_content(
273269
self,

tests/test_slurm_report_generation_strategy.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323

2424

2525
@pytest.fixture
26-
def setup_test_environment(tmpdir):
26+
def setup_test_environment(tmp_path: Path):
2727
# Create a temporary directory for the test
28-
test_dir = tmpdir.mkdir("test_env")
28+
test_dir = tmp_path / "test_env"
29+
test_dir.mkdir()
2930

3031
# Create the mock stdout.txt file
3132
stdout_content = """

0 commit comments

Comments
 (0)