Skip to content

Conversation

@jasonb5
Copy link
Collaborator

@jasonb5 jasonb5 commented Jul 1, 2025

Querying a variable whose value is a reference that exists
in a different subgroup would fail with ERROR: Entry HIST_N was listed as type int but value '$STOP_N' is not valid int.

This PR changes the behavior so a variable that cannot
be resolved within the current subgroup will try to resolve
from any subgroup. Finally if still not resolvable an exception
is raised.

Test suite: pytest CIME/tests/test_unit*
Test baseline:
Test namelist changes:
Test status: [bit for bit, roundoff, climate changing]

Fixes #4646

User interface changes?:
Update gh-pages html (Y/N)?:

@jasonb5 jasonb5 requested review from jedwards4b and jgfouca July 1, 2025 22:56
@jasonb5
Copy link
Collaborator Author

jasonb5 commented Jul 1, 2025

@jedwards4b @jgfouca The original solution discussed for this issue was to "namespace" the value e.g. HIST_N=<subgroup>::STOP_N. I'm wondering if this complexity is required? The change I have right now simply falls back to resolving the reference without a subgroup. Is there a scenario when a variable would be defined more than twice?

@jasonb5 jasonb5 marked this pull request as ready for review July 1, 2025 23:04
Copy link
Contributor

@jedwards4b jedwards4b left a comment

Choose a reason for hiding this comment

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

I would suggest adding a test for a variable which is in a subgroup, for example
JOB_WALLCLOCK_TIME

 ./xmlquery JOB_WALLCLOCK_TIME
Results in group case.cupid
	JOB_WALLCLOCK_TIME: 48:00:00
Results in group case.st_archive
	JOB_WALLCLOCK_TIME: 00:20:00
Results in group case.test
	JOB_WALLCLOCK_TIME: 48:00:00

@jasonb5
Copy link
Collaborator Author

jasonb5 commented Jul 2, 2025

@jedwards4b The test is there but it's not clear, will fix.

@jasonb5
Copy link
Collaborator Author

jasonb5 commented Jul 3, 2025

Looks like a subgroup reference would be needed for the following example.

Results in group case.cupid
	JOB_WALLCLOCK_TIME: $JOB_WALLCLOCK_TIME@case.cupid
Results in group case.st_archive
	JOB_WALLCLOCK_TIME: 00:20:00
Results in group case.test
	JOB_WALLCLOCK_TIME: 48:00:00

@jedwards4b @jgfouca Any recommendations for the delimiter? Originally it was suggested to use :: like c++, another alternative could be @.

@jgfouca
Copy link
Contributor

jgfouca commented Jul 7, 2025

@jasonb5 , I think :: would be best. We use that in Eamxx tools already.

@jasonb5 jasonb5 force-pushed the fix_mixed_subgroup_resolve branch from 02ea4d3 to f3e1ddf Compare August 19, 2025 19:05
@github-actions
Copy link
Contributor

@jasonb5 jasonb5 merged commit 8bce799 into master Aug 21, 2025
9 checks passed
@jasonb5 jasonb5 deleted the fix_mixed_subgroup_resolve branch August 21, 2025 19:45
jgfouca added a commit that referenced this pull request Sep 2, 2025
@jgfouca jgfouca mentioned this pull request Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xmlquery issue when values are set to match another variable

4 participants