Skip to content

Conversation

@xylar
Copy link
Collaborator

@xylar xylar commented Dec 30, 2025

Instead of hard-coding the regular expressions used to discover machines from their host names, make these config options. This makes it much easier to add new machines.

This merge also takes an optional package or path where it will search for additional config files that may define machines and the regular expressions used to identify their hostnames.

Checklist

  • Tests pass and new features are covered by tests
  • Testing comment, if appropriate, in the PR documents testing used to verify the changes

Instead of hard-coding the regular expressions used to discover
machines from their host names, make these config options.  This
makes it much easier to add new machines.

This merge also takes an optional package or path where it will
search for additional config files that may define machines and
the regular expressions used to identify their hotnames.
@xylar xylar requested a review from andrewdnolan December 30, 2025 17:32
@xylar xylar self-assigned this Dec 30, 2025
@xylar xylar added the clean-up Cleanup or maintenance of code that does not alter behavior or functionality label Dec 30, 2025
@xylar
Copy link
Collaborator Author

xylar commented Dec 30, 2025

Testing

It will be tedious to test this on each machine, so I will follow up with fixes in later PRs if problems arise.

I tested on my laptop, katara, which is defined in Polaris but not in mache:

$ python -c "import mache; print(mache.discover.discover_machine())"
None

$ python -c "import mache; print(mache.discover.discover_machine(path='/home/xylar/code/e3sm/polaris/add-mache-deploy/polaris/machines'))"
katara

@xylar
Copy link
Collaborator Author

xylar commented Dec 30, 2025

@andrewdnolan, would you be willing to test this out on Chrysalis whenever you are back from vacation? It should be as trivial as setting up the dev environment and running the same expression as I did above.

Note that I switched to pixi in #342, so you'll need to do:

# one-time pixi install on each machine
curl -fsSL https://pixi.sh/install.sh | sh

# set up the dev environment
pixi install
pixi shell
python -m pip install --no-deps --no-build-isolation -e .

# the actual test
python -c "import mache; print(mache.discover.discover_machine())"

# leave the pixi shell
exit

@andrewdnolan
Copy link
Collaborator

Testing

I've confirmed that this works for me on chrysalis. After setting up the pixi environment as described above, I can run:

$ python -c "import mache; print(mache.discover.discover_machine())"
# chrysalis

Copy link
Collaborator

@andrewdnolan andrewdnolan left a comment

Choose a reason for hiding this comment

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

This all looks good to me. I've only taken a quick look, but feel confident with this based on the testing.

@xylar
Copy link
Collaborator Author

xylar commented Jan 5, 2026

Thanks so much @andrewdnolan!

@xylar xylar merged commit 2950498 into E3SM-Project:main Jan 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clean-up Cleanup or maintenance of code that does not alter behavior or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants