Skip to content

Commit

Permalink
attempt at verifying yaml files for systems (not working)
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibelp committed Oct 10, 2024
1 parent 5a74914 commit 0f8d8b0
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions lib/benchpark/cmd/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@

import os
import pathlib
import re
import sys

import benchpark.paths
import benchpark.repo
import benchpark.system as system
from benchpark.runtime import RuntimeResources

bootstrapper = RuntimeResources(benchpark.paths.benchpark_home) # noqa
bootstrapper.bootstrap() # noqa

import ramble.config as cfg # noqa

import ramble.config as cfg

sys_repo = benchpark.repo.paths[benchpark.repo.ObjectTypes.systems]
exp_repo = benchpark.repo.paths[benchpark.repo.ObjectTypes.experiments]
Expand Down Expand Up @@ -40,18 +47,43 @@ def _find_yaml_files(d):
return yaml_files


# TODO: when .template_dir is fixed, this won't be needed
def _path_for_system_class(sys_cls):
name = sys_cls.__name__
component = ""
components = []
for letter in name:
if re.match("[A-Z]", letter):
if component:
components.append(component)
component = letter
else:
component += letter
if component:
components.append(component)
system_dirname = "-".join(x.lower() for x in components)
basedir = pathlib.Path(sys_repo.filename_for_object_name(sys_cls.__name__)).parent.parent
assert basedir.exists()
return basedir / system_dirname


def audit_system(sys_cls):
errors = list()
basedir = pathlib.Path(sys_repo.filename_for_object_name(sys_cls.__name__)).parent
basedir = _path_for_system_class(sys_cls)
externals = basedir / "externals"
if externals.exists():
for f in _find_yaml_files(externals):
cfg.read_config_file(f, system.packages_schema)
pass
# TODO: this fails for reasons I don't understand, even though
# this duplicates logic from system.py
# cfg.read_config_file(f, system.packages_schema)

compilers = basedir / "compilers"
if compilers.exists():
for f in _find_yaml_files(compilers):
cfg.read_config_file(f, system.compilers_schema)
pass
# cfg.read_config_file(f, system.compilers_schema)
# TODO: same problem as prior loop
return errors


Expand Down

0 comments on commit 0f8d8b0

Please sign in to comment.