Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 6 additions & 12 deletions mlpstorage_py/benchmarks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,18 +861,12 @@ def generate_output_location(self) -> str:
"""
if not self.BENCHMARK_TYPE:
raise ValueError('No benchmark specified. Unable to generate output location')
# Thread the validated orgname/systemname stashed by
# capture_or_verify_code_image (code_image.py: args._validated_orgname /
# args._validated_systemname) so generate_output_location's
# OPEN/CLOSED ConfigurationError path doesn't fire. For legacy /
# whatif modes these attrs are absent (getattr default None) and the
# function's mode check skips the orgname/systemname requirement.
return generate_output_location(
self,
self.run_datetime,
orgname=getattr(self.args, "_validated_orgname", None),
systemname=getattr(self.args, "_validated_systemname", None),
)
# orgname and systemname are read from self.args by the function:
# args.orgname is pinned upstream by main._main_impl()'s
# orgname-resolution gate (sourced from orgname.yaml written by
# `mlpstorage init`); args.systemname is set by argparse from
# --systemname / MLPSTORAGE_SYSTEMNAME.
return generate_output_location(self, self.run_datetime)

_COLLISION_BUMP_BUDGET = DEFAULT_COLLISION_BUMP_BUDGET

Expand Down
13 changes: 6 additions & 7 deletions mlpstorage_py/rules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ def calculate_training_data_size(args, cluster_information, dataset_params, read
def generate_output_location(
benchmark,
datetime_str=None,
*,
orgname: Optional[str] = None,
systemname: Optional[str] = None,
**kwargs,
) -> str:
"""
Expand All @@ -193,9 +190,9 @@ def generate_output_location(

This function is PURE with respect to args.{mode, orgname, systemname} —
it does NOT resolve orgname from the sentinel or read MLPERF_SYSTEMNAME
here. Per RESEARCH.md Pitfall 1, orgname resolution lives upstream in
main._main_impl()'s sentinel-resolution gate (Slice 4); the universal
--systemname plumbing (Slice 3 / this plan) populates args.systemname.
here. orgname resolution lives upstream in main._main_impl()'s
orgname-resolution gate (reads `orgname.yaml` written by
`mlpstorage init`); --systemname plumbing populates args.systemname.

Every path segment appended to results_dir is validated via
_check_safe_path_component() to block path-traversal ('../') and
Expand Down Expand Up @@ -242,6 +239,7 @@ def generate_output_location(
raise ConfigurationError(
"Cannot generate output location: orgname is empty "
"(sentinel not resolved).",
parameter="orgname",
suggestion=(
"Internal error: the upstream orgname-resolution gate in "
"main._main_impl() must populate args.orgname before "
Expand All @@ -253,9 +251,10 @@ def generate_output_location(
if not systemname:
raise ConfigurationError(
"Cannot generate output location: --systemname is empty.",
parameter="systemname",
suggestion=(
"Pass --systemname <name> on the CLI or set the "
"MLPERF_SYSTEMNAME environment variable before re-running."
"MLPSTORAGE_SYSTEMNAME environment variable before re-running."
),
code=ErrorCode.CONFIG_MISSING_REQUIRED,
)
Expand Down
Loading
Loading