Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a global Operating System variable at import time #1693

Open
john-science opened this issue Apr 24, 2024 · 5 comments
Open

Create a global Operating System variable at import time #1693

john-science opened this issue Apr 24, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request feature request Smaller user request

Comments

@john-science
Copy link
Member

john-science commented Apr 24, 2024

I believe the only functional solution would be something like:

  1. In context.py, at "import armi" time, ARMI should determine if this system is Window. Linux, or Mac, and sets a global variable: armi.context.PLATFORM.
  2. If it's not Windows or Linux, we fail immediately? This seems good, but is debatable.
  3. Use the variable armi.context.PLATFORM throughout the codebase.

The goal here is to remove a ton of existing (and future) duplicate catches all around ARMI:

if "darwin" in sys.platform:
    # this
elif "darwin" in sys.platform:
    # that
elif "linux" in sys.platform:
    # stuff
else:
    raise OSError("xyz")

Instead we can do:

if PLATFORM == WINDOWS:
    # this
else:
    # that
@john-science john-science added enhancement New feature or request feature request Smaller user request labels Apr 24, 2024
@john-science john-science self-assigned this Apr 24, 2024
@jakehader
Copy link
Member

An Enum / Flag might be nice for this versus a string!

@drewj-usnctech
Copy link
Contributor

We have a lot of mac users here despite it not being formally supported, it works well

@john-science
Copy link
Member Author

We have a lot of mac users here despite it not being formally supported, it works well

Well, that's a wrench. Hmm

@john-science
Copy link
Member Author

john-science commented Apr 30, 2024

@drewejohnson I just tried to run the ARMI tests on MacOS and 18 of the 2064 tests failed:

https://github.com/terrapower/armi/actions/runs/8898351718/job/24435316299#step:5:2441

Most of the errors were of the form:

No such file or directory: 'refSmallReactor.yaml'

If that's an easy one to solve, maybe I could add MacOS to the official ARMI CI.

@john-science
Copy link
Member Author

We have a lot of mac users here despite it not being formally supported, it works well

@drewejohnson Just FYI, I just opened a PR to support Macs: #1713

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request Smaller user request
Projects
None yet
Development

No branches or pull requests

3 participants