-
Notifications
You must be signed in to change notification settings - Fork 43
Custom repos in benchpark #1190
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
Merged
Merged
Changes from 20 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
bf91426
refactoring option handling
scheibelp c352e6d
reorg code (no logic change)
scheibelp 3f2b828
help str is auto generated
scheibelp 56811de
update help and add todo
scheibelp a1872be
initial config logic
scheibelp a8f198d
config construction
scheibelp 8826abb
config construction
scheibelp 62edf96
plumb config into repos (not working yet)
scheibelp 4ad65e7
plumb config into repos (not working yet)
scheibelp 6aebdd1
ref errors
scheibelp 6a7463b
add default repo config
scheibelp 25e2eb6
move saxpy into separate repo to demonstrate support for multiple exp…
scheibelp 7530e44
use benchpark config to determine ramble applicatinos and extra spack…
scheibelp 2e0508c
style format
scheibelp 278c157
Merge branch 'develop' into custom-repos
scheibelp a7bced6
forgot test repo yaml descriptor
scheibelp 2d23644
import formatting
scheibelp b1714b9
add license
scheibelp 9e1459e
imports and license
scheibelp 030f803
yamlfix
scheibelp dffe3d6
license
scheibelp 4f0c6bb
restore help generation interrupting import order
scheibelp bbd528f
restore check
scheibelp 23e4140
allow configure command to interact with config system (and integrate…
scheibelp 5aeec3e
missing files from last commit
scheibelp 8e2cf16
fix issue w/ configure
scheibelp ec1d116
only append .benchpark to config name if not user-specified
scheibelp 43d626c
auto style
scheibelp e16e809
better checking of config
scheibelp 1aafb22
fix some bugs
scheibelp e5d7099
restore prior handling of version option
scheibelp 9ee1581
add license to config
scheibelp 12a3f35
update ci check given that you have to name all subdir components whe…
scheibelp 0cbd10f
update imports
scheibelp c6b8bdb
I messed up the system info command
scheibelp 2478795
scripts outside of main can now import accounting
scheibelp dbb1054
merge from develop
scheibelp 2ed35fd
docs review comments
scheibelp 2e7bf29
add docs
scheibelp 1cb11c9
mention benchpark configure in config docs section
scheibelp 3d92e15
auto style
scheibelp 68b9218
Merge branch 'develop' into custom-repos
scheibelp bf315e7
merge from develop (minor conflicts)
scheibelp 995d9bc
update docs according to review
scheibelp 8b34b3a
docstrfmt
scheibelp a7fa807
docstrfmt wants to edit the license...
scheibelp 5f2e26e
update docs for configure command based on review
scheibelp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| repos: | ||
scheibelp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| experiments: [../experiments, ../experiments/test] | ||
| systems: [../systems] | ||
| applications: [../repo] | ||
| packages: [../repo] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Copyright 2023 Lawrence Livermore National Security, LLC and other | ||
| # Benchpark Project Developers. See the top-level COPYRIGHT file for details. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| repo: | ||
| namespace: test | ||
| subdirectory: '' |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| # Copyright 2023 Lawrence Livermore National Security, LLC and other | ||
| # Benchpark Project Developers. See the top-level COPYRIGHT file for details. | ||
| # | ||
| # Copyright 2022-2024 The Ramble Authors | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import pathlib | ||
|
|
||
| import yaml | ||
|
|
||
| import benchpark.paths | ||
|
|
||
|
|
||
| class RequiredClassAttr: | ||
| def __init__(self, name): | ||
| self.name = name | ||
|
|
||
| def __get__(self, obj, owner): | ||
| raise NotImplementedError( | ||
| f"{owner.__name__} must define class attribute '{self.name}'" | ||
| ) | ||
|
|
||
|
|
||
| class ConfigSection: | ||
| def __init__(self, data, path): | ||
| self.data = data | ||
| self.path = pathlib.Path(path) | ||
|
|
||
| filename = RequiredClassAttr("filename") | ||
| name = RequiredClassAttr("name") | ||
|
|
||
| @classmethod | ||
| def try_load(cls, cfg_dir): | ||
| cfg_path = pathlib.Path(cfg_dir) / cls.filename | ||
| if cfg_path.exists(): | ||
| with open(cfg_path, "r") as f: | ||
| data = yaml.safe_load(f) | ||
| return cls(data[cls.name], cfg_path) | ||
|
|
||
| def resolve_path(self, value): | ||
| path = pathlib.Path(value) | ||
| if not path.is_absolute(): | ||
| return (self.path.parents[0] / path).resolve() | ||
|
|
||
|
|
||
| class PropertyDict: | ||
| def __getattr__(self, name): | ||
| val = self.data[name] | ||
| if isinstance(val, dict): | ||
| return PropertyDict(val) | ||
| return val | ||
|
|
||
|
|
||
| class Repos(ConfigSection, PropertyDict): | ||
| filename = "repos.yaml" | ||
| name = "repos" | ||
|
|
||
|
|
||
| _section_types = [Repos] | ||
|
|
||
|
|
||
| class Configuration: | ||
| section_names = [st.name for st in _section_types] | ||
|
|
||
| def __init__(self, cfg_dir): | ||
| self.sections = {} | ||
| for st in _section_types: | ||
| attempt = st.try_load(cfg_dir) | ||
| if attempt: | ||
| self.sections[st.name] = attempt | ||
|
|
||
| def __getattr__(self, name): | ||
| if name in self.sections: | ||
| return self.sections[name] | ||
| elif name in Configuration.section_names: | ||
| raise Exception("This section is not present in this config") | ||
| else: | ||
| raise AttributeError("No such section") | ||
|
|
||
|
|
||
| _unset = object() | ||
|
|
||
|
|
||
| _user_input_cfg = _unset | ||
|
|
||
|
|
||
| def determine_config(): | ||
| """ | ||
| Benchpark configs don't merge or override like Spack/Ramble. You | ||
| just point it at a directory and that's where all your config is. | ||
| """ | ||
| if _user_input_cfg is _unset: | ||
| raise Exception("Internal error: config initialization") | ||
| elif _user_input_cfg: | ||
| if not _user_input_cfg.exists(): | ||
| raise Exception(f"Specific config dir does not exist: {_user_input_cfg}") | ||
| else: | ||
| return Configuration(_user_input_cfg) | ||
|
|
||
| possible_dirs = [ | ||
| benchpark.paths.invocation_working_dir / "benchpark-config", | ||
| benchpark.paths.benchpark_root / "config", | ||
| ] | ||
| for pd in possible_dirs: | ||
| if pd.exists(): | ||
| return Configuration(pd) | ||
|
|
||
|
|
||
| _configuration = None | ||
|
|
||
|
|
||
| def configuration(): | ||
| global _configuration | ||
| if not _configuration: | ||
| _configuration = determine_config() | ||
|
|
||
| return _configuration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.