-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #546 from climbfuji/feature/merge_feature_capgen_i…
…nto_main_20240308 Merge feature/capgen into main as of 2024-03-08
- Loading branch information
Showing
88 changed files
with
7,023 additions
and
2,008 deletions.
There are no files selected for viewing
This file contains 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,17 @@ | ||
name: Capgen Unit Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [feature/capgen, main] | ||
|
||
jobs: | ||
unit_tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: update repos and install dependencies | ||
run: sudo apt-get update && sudo apt-get install -y build-essential gfortran cmake python3 git | ||
- name: Run unit tests | ||
run: cd test && ./run_fortran_tests.sh | ||
|
This file contains 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
Validating CODEOWNERS rules …
This file contains 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 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 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 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,87 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
Define the CCPPDatabaseObj object | ||
Object definition and methods to provide information from a run of capgen. | ||
""" | ||
|
||
from host_model import HostModel | ||
from ccpp_suite import API | ||
|
||
class CCPPDatabaseObjError(ValueError): | ||
"""Error class specific to CCPPDatabaseObj. | ||
All uses of this error should be internal (i.e., programmer error, | ||
not user error).""" | ||
|
||
def __init__(self, message): | ||
"""Initialize this exception""" | ||
super().__init__(message) | ||
|
||
class CCPPDatabaseObj: | ||
"""Object with data and methods to provide information from a run of capgen. | ||
""" | ||
|
||
def __init__(self, run_env, host_model=None, api=None, database_file=None): | ||
"""Initialize this CCPPDatabaseObj. | ||
If <database_file> is not None, all other inputs MUST be None and | ||
the object is created from the database table created by capgen. | ||
To initialize the object from an in-memory capgen run, ALL other | ||
inputs MUST be passed (i.e., not None) and it is an error to pass | ||
a value for <database_file>. | ||
""" | ||
|
||
runtime_obj = all([host_model is not None, api is not None]) | ||
self.__host_model = None | ||
self.__api = None | ||
self.__database_file = None | ||
if runtime_obj and database_file: | ||
emsg = "Cannot provide both runtime arguments and database_file." | ||
elif (not runtime_obj) and (not database_file): | ||
emsg = "Must provide either database_file or all runtime arguments." | ||
else: | ||
emsg = "" | ||
# end if | ||
if emsg: | ||
raise CCPPDatabaseObjError(f"ERROR: {emsg}") | ||
# end if | ||
if runtime_obj: | ||
self.__host_model = host_model | ||
self.__api = api | ||
else: | ||
self.db_from_file(run_env, database_file) | ||
# end if | ||
|
||
def db_from_file(self, run_env, database_file): | ||
"""Create the necessary internal data structures from a CCPP | ||
datatable.xml file created by capgen. | ||
""" | ||
metadata_tables = {} | ||
host_name = "host" | ||
self.__host_model = HostModel(metadata_tables, host_name, run_env) | ||
self.__api = API(sdfs, host_model, scheme_headers, run_env) | ||
raise CCPPDatabaseObjError("ERROR: <database_file> not supported") | ||
|
||
def host_model_dict(self): | ||
"""Return the host model dictionary for this CCPP DB object""" | ||
if self.__host_model is not None: | ||
return self.__host_model | ||
# end if | ||
raise CCPPDatabaseObjError("ERROR: <database_file> not supported") | ||
|
||
def suite_list(self): | ||
"""Return a list of suites built into the API""" | ||
if self.__api is not None: | ||
return list(self.__api.suites) | ||
# end if | ||
raise CCPPDatabaseObjError("ERROR: <database_file> not supported") | ||
|
||
def constituent_dictionary(self, suite): | ||
"""Return the constituent dictionary for <suite>""" | ||
return suite.constituent_dictionary() | ||
|
||
def call_list(self, phase): | ||
"""Return the API call list for <phase>""" | ||
if self.__api is not None: | ||
return self.__api.call_list(phase) | ||
# end if | ||
raise CCPPDatabaseObjError("ERROR: <database_file> not supported") |
This file contains 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.