Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename TestRun-related var and method in src/cloudai/_core/test_scenario_parser.py #292

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/cloudai/_core/test_scenario_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,24 @@ def _parse_data(self, data: Dict[str, Any]) -> TestScenario:
total_weight = sum(tr.weight for tr in ts_model.tests)
normalized_weight = 0 if total_weight == 0 else 100 / total_weight

testruns_by_id: dict[str, TestRun] = {
tr.id: self._create_section_test_run(tr, normalized_weight) for tr in ts_model.tests
test_runs_by_id: dict[str, TestRun] = {
tr.id: self._create_test_run(tr, normalized_weight) for tr in ts_model.tests
}

tests_data: dict[str, _TestRunTOML] = {tr.id: tr for tr in ts_model.tests}
for section, tr in testruns_by_id.items():
for section, tr in test_runs_by_id.items():
test_info = tests_data[section]
tr.dependencies = {
dep.type: TestDependency(test_run=testruns_by_id[dep.id]) for dep in test_info.dependencies
dep.type: TestDependency(test_run=test_runs_by_id[dep.id]) for dep in test_info.dependencies
}

return TestScenario(
name=ts_model.name,
test_runs=list(testruns_by_id.values()),
test_runs=list(test_runs_by_id.values()),
job_status_check=ts_model.job_status_check,
)

def _create_section_test_run(self, test_info: _TestRunTOML, normalized_weight: float) -> TestRun:
def _create_test_run(self, test_info: _TestRunTOML, normalized_weight: float) -> TestRun:
"""
Create a section-specific Test object by copying from the test mapping.

Expand Down