Fix undefined basis variable in interface workflow (#7571) - #7878
Fix undefined basis variable in interface workflow (#7571)#7878mohanchen wants to merge 2 commits into
Conversation
The "Create mock data & patch script" step referenced `basis` inside the Python heredoc without defining it: the matrix key `basis` was never exported to the step environment, so the step failed with "NameError: name 'basis' is not defined" before any mock data was generated. Pass matrix.basis through the BASIS environment variable and read it in the heredoc, matching the existing SCRIPT/PREFIX pattern.
Document the upstream repo/issues/PR links and two workflow facts: upstream PRs are opened from personal fork branches, and workflow_dispatch-only workflows cannot be verified by PR CI.
Critsium-xy
left a comment
There was a problem hiding this comment.
The two-line BASIS fix is correct and matches the existing SCRIPT/PREFIX pattern; basis was the only undefined name in the heredoc. But the workflow still fails on all three matrix jobs after this change. I extracted the heredoc and ran it locally against each matrix entry.
1. example_advance.py does not exist (blocks the third job)
.github/workflows/interface.yml:27 sets script: example_advance.py, but the file is interfaces/Wannier90_interface/examples_python/example_advanced.py.
with open(script) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'example_advance.py'
This crashes in the same step, five lines before the basis reference this PR fixes, so the advance (LCAO) job never reaches the fixed code. prefix: Bi2Se3_advanced is already correct and matches BASE_DIR in the script.
2. Mock wannier90.nnkp does not match parse_nnkp (blocks the other two jobs)
With basis fixed, basic and pw complete the mock step, then fail in Run … — dryrun:
>>> Step 2: Preparing ABACUS NSCF input for Wannier90...
[INPUT ERROR] No k-points found in Bi2Se3_pw/wannier/wannier90.nnkp.
Check that the file is a valid wannier90.nnkp.
parse_nnkp (abacusw90/io_utils.py:147) reads k-points between begin kpoints and end kpoints — the same format io_utils.py:121 writes. The mock generator emits a different bare-numeric layout with no delimiters (grep -ci "begin kpoints" returns 0), so kpoints is empty and ValueError is raised. DRY RUN COMPLETE is never printed and Check dryrun completion banner exits 1.
The NameError was the first of several blockers; this workflow appears never to have passed. Either fix both items here, or state in the PR body that the workflow still fails at step2 and open a follow-up issue.
Critsium-xy
left a comment
There was a problem hiding this comment.
Two non-blocking issues in the same mock block, worth folding into this PR.
3. pw branch assigns Bi's pseudopotential to Se
.github/workflows/interface.yml:100:
Bi 208.980 Bi_pbe_fr.upf
Se 78.960 Bi_pbe_fr.upf # should be Se_pbe_fr.upf
The lcao branch (line 108) is correct, and line 183 already creates Se_pbe_fr.upf. This branch was unreachable before — the basis fix activates it for the first time, so it is worth correcting here.
4. Mock nnkp values are internally inconsistent
In the same block: num_bands = 20, num_exclude_bands = 20, num_wann = 30. num_wann exceeds num_bands while every band is excluded. Further evidence the mock was never validated against the real format; fix alongside item 2.
Scoped to issue #7571 (plumb matrix.basis into the heredoc), this PR is correct and can close it. It should not be described as making the interface workflow pass.
Summary
Fixes #7571
The
interfaceworkflow (wannier-interfacejob) defines abasiskey in the build matrix, but the "Create mock data & patch script" step never exported it to the step environment. The Python heredoc in that step referencesbasisdirectly, so each matrix job fails withNameError: name 'basis' is not definedbefore any mock data is generated.Changes
BASIS: ${{ matrix.basis }}to the stepenvbasis = os.environ["BASIS"]inside the heredoc, matching the existingSCRIPT/PREFIXpatternVerification
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/interface.yml'))"workflow_dispatchonly, so it is not triggered by push/PR events; a manual dispatch run is needed to fully verify the fix