Skip to content

Conversation

@mkavulich
Copy link
Collaborator

As part of a new set of suite naming guidelines (see NCAR/ccpp-doc#72), we are removing the requirement that suite definition file names begin with the literal string suite_. Currently this requirement is hard-coded into CCPP prebuild (but not in capgen), so the changes in this PR are necessary to remove them.

I included some back-compatibility logic to allow for the previous naming convention to work as well. So if a user attempts to use ccpp_prebuild.py with a suite named "suitename", it will first look for an SDF named "suitename.xml", and then (if not found) look for an SDF named "suite_suitename.xml".

User interface changes?: Yes, but not required; see above back-compatibility description.

Fixes: #568 Remove requirement that suite files begin with "suite_"

Testing:
test removed: None
unit tests: Renamed the SDF for test_blocked_data so that it tests the new suite naming conventions. Other tests were left alone, so the old naming conventions also get tested
system tests: ??
manual testing: Ran many different tests with SCM; see NCAR/ccpp-scm#477 for more details

Copy link
Collaborator

@gold2718 gold2718 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay although I have a question about an error message still being correct.

logging.debug(f"Filename {os.path.basename(self._sdf_name)}")
logging.debug(f"Suite name {format(self._name)}")
else:
logging.critical("Invalid suite name {0} in suite definition file {1}.".format(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it invalid or just not found?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is for inconsistency between the SDF filename and the <suite name=> tag which actually defines the name of the suite (Suite._name). So when reading in a file suite_abcd.xml, the only two valid values for Suite._name would be suite_abcd or abcd. Any other value is invalid.

If you think this error message is too unclear I could update it to be more precise, since it's really about inconsistency and not necessarily "validity".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I misunderstood what you were checking, I now think the message is okay. Thanks for the explanation.

@mkavulich mkavulich added the capgen-unification Issues/PRs necessary for capgen/prebuild unification label May 30, 2024
Copy link
Collaborator

@climbfuji climbfuji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are more suites that should be renamed in test_prebuild?

# If suite file not found, check old filename convention (suite_[suitename].xml)
sdf_file_legacy=os.path.join(suites_dir, f"suite_{sdf}")
if os.path.exists(sdf_file_legacy):
logging.info("Parsing suite definition file using legacy naming convention")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be logging.warn (or warning, whatever the correct syntax is)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion, I have made that addition here.

return success
if not (os.path.basename(self._sdf_name) == '{}.xml'.format(self._name)):
if (os.path.basename(self._sdf_name) == 'suite_{}.xml'.format(self._name)):
logging.debug("Parsing suite using legacy naming convention")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, should this be warning? Or leave it as debug if it throws a warning in the first place anyway?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my thinking: I wanted a message here, but since it's already mentioned in a higher-priority message earlier I figured debug-level was appropriate here.

@mkavulich mkavulich force-pushed the feature/suite_names_update branch 2 times, most recently from 9ad2c20 to 3a9c061 Compare June 3, 2024 15:43
Copy link
Collaborator

@climbfuji climbfuji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mkavulich
Copy link
Collaborator Author

@climbfuji regarding the suite names, since we are still supporting the legacy naming convention I thought retaining a mix of old and new suite names in our unit tests was appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capgen-unification Issues/PRs necessary for capgen/prebuild unification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove requirement that suite files begin with "suite_"

3 participants