[codex] Fix GX eik input handling and subprocess errors#2143
Conversation
YigitElma
left a comment
There was a problem hiding this comment.
Thanks for this @rmchurch! I was naively expecting the user to put eik, but I guess people use the same template file for multiple cases.
If this is ready, I can approve/merge it to yge/gx, and create a GX wrapper PR later. Does this sound good to you?
There was a problem hiding this comment.
We actually don't require writing tests for the desc.external module. But these look good to me. We can decide to keep them or not in the actual PR for the yge/gx branch.
| flags=re.MULTILINE, | ||
| ) | ||
| if geo_option_subs == 0: | ||
| data, geo_option_subs = re.subn( |
There was a problem hiding this comment.
In the other branch, I switched to using a loop to update the file content. This is mainly because regex operations are very hard to read, and some other developers wanted that.
@rmchurch Can you switch to the other method when resolving the merge conflicts?
What changed
geo_option = "eik"so DESC's plain-text geometry files match the GX input modestdout.gx/stderr.gxcontextWhy
The GX wrapper was generating a plain-text geometry file while allowing templates to keep
geo_option = "nc". That made GX fail with an opaque nonzero exit, and the callback path surfaced it as a raw subprocess failure instead of a useful GX-specific error.Impact
This makes the GX integration robust against NC-based templates and preserves actionable failure context when GX exits nonzero.
Validation
/global/cfs/projectdirs/m4505/rchurchi/conda-envs/desc-gx/bin/python -m pytest tests/test_external_gx.py -q