Skip to content

Stop needs_merlin_expansion extending the caller's label list - #601

Open
arpitjain099 wants to merge 1 commit into
llnl:developfrom
arpitjain099:fix/needs-expansion-label-mutation
Open

arpitjain099 wants to merge 1 commit into
llnl:developfrom
arpitjain099:fix/needs-expansion-label-mutation

Conversation

@arpitjain099

Copy link
Copy Markdown

needs_merlin_expansion does labels += sample_keywords, and += on a list extends it in place, so the caller's list gets the four sample keywords appended every time it's called.

MerlinSpec.get_tasks_per_step takes column_labels = self.merlin["samples"]["column_labels"] without copying and then calls this once per step, so a spec with several steps ends up with its own merlin.samples.column_labels carrying four bogus entries per step. The parameter_labels call next to it is safe only because it passes include_sample_keywords=False.

Changed to labels = labels + sample_keywords, which keeps the local view and leaves the argument alone.

Added tests/unit/utils/test_needs_merlin_expansion.py: the list is unchanged after a call, the sample keywords still match with and without the flag, and repeated calls give the same answer. Two of the three fail on develop. tests/unit/utils and tests/unit/spec are 211 passing with the change.

I didn't touch the CHANGELOG since there's no Unreleased section to add to. Say the word if you'd like one.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
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.

1 participant