Skip to content

refactor component runner arg list assembly to handle lists of inputs#140

Merged
gknapp1 merged 2 commits intomainfrom
arglist
Feb 20, 2026
Merged

refactor component runner arg list assembly to handle lists of inputs#140
gknapp1 merged 2 commits intomainfrom
arglist

Conversation

@gknapp1
Copy link
Copy Markdown
Collaborator

@gknapp1 gknapp1 commented Feb 18, 2026

Cherry-picked feature from #133.

This simplifies the configure, execute, and postprocess argument handling and adds capability needed to pass list-values as arguments to these steps.

Example:

Myna input file:

steps:
- calibrate_additivefoam_heatsource:
    class: single_track_calibration
    application: additivefoam
    configure:
      experiments: experiments.yaml
      nvalues: [0.0, 2.0, 5.0, 7.0, 9.0]

Becomes this argument list for the configure step, which is correctly handled by argparse, assuming the --nvalues parameter is configured to take multiple entries:

['--experiments', 'experiments.yaml', '--nvalues', '0.0', '2.0', '5.0', '7.0', '9.0']

The previous implementation would have returned the following, which argparse can't handle:

['--experiments', 'experiments.yaml', '--nvalues', '"[0.0, 2.0, 5.0, 7.0, 9.0]"']

@gknapp1 gknapp1 requested a review from streeve February 18, 2026 21:37
@gknapp1 gknapp1 self-assigned this Feb 18, 2026
@gknapp1 gknapp1 added the enhancement New feature or request label Feb 18, 2026
@gknapp1 gknapp1 removed the request for review from streeve February 18, 2026 21:55
Copy link
Copy Markdown
Collaborator

@streeve streeve left a comment

Choose a reason for hiding this comment

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

So this can be either the list or the individual step now?

@gknapp1
Copy link
Copy Markdown
Collaborator Author

gknapp1 commented Feb 19, 2026

So this can be either the list or the individual step now?

I added an example in the PR summary to illustrate the purpose of this better.

@gknapp1
Copy link
Copy Markdown
Collaborator Author

gknapp1 commented Feb 19, 2026

Sorted out the CI failures. Part of the previous CI failures was actually catching a bug in the code. The other part of it was due to oversubscribing during the AdditiveFOAM examples using mpirun. I'll pull out the unrelated CI changes to a new PR.

@gknapp1
Copy link
Copy Markdown
Collaborator Author

gknapp1 commented Feb 20, 2026

@streeve, I cleaned this up. It should be good to go now.

@gknapp1
Copy link
Copy Markdown
Collaborator Author

gknapp1 commented Feb 20, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the argument list assembly to support list-valued arguments and improve code structure. The introduction of the _get_arglist helper function successfully centralizes argument parsing logic and removes code duplication. However, there is a subtle bug in the implementation of _get_arglist due to the way boolean types are handled in Python, which could lead to incorrect command-line arguments for False values. I've provided a specific comment with a code suggestion to fix this. Overall, this is a good refactoring that improves functionality and maintainability.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@gknapp1 gknapp1 merged commit 6fb757a into main Feb 20, 2026
3 checks passed
@gknapp1 gknapp1 deleted the arglist branch February 20, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants