-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from xylar/add_discover_machine_function
Break out `discover_machine()` as separate function
- Loading branch information
Showing
17 changed files
with
346 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include mache/cime_machine_config/*.xml | ||
include mache/machines/*.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{% set name = "mache" %} | ||
{% set version = "1.0.0" %} | ||
|
||
package: | ||
name: {{ name|lower }} | ||
version: {{ version }} | ||
|
||
source: | ||
path: .. | ||
|
||
build: | ||
number: 0 | ||
script: {{ PYTHON }} -m pip install . --no-deps -vv | ||
noarch: python | ||
|
||
requirements: | ||
host: | ||
- python >=3.6 | ||
- pip | ||
run: | ||
- python >=3.6 | ||
- lxml | ||
|
||
test: | ||
|
||
imports: | ||
- mache | ||
|
||
|
||
about: | ||
home: https://github.com/E3SM-Project/mache | ||
license: BSD-3-Clause | ||
license_family: BSD | ||
license_file: LICENSE | ||
summary: A package for providing configuration data relate to E3SM supported machines | ||
doc_url: https://github.com/E3SM-Project/mache/README.rst | ||
dev_url: https://github.com/E3SM-Project/mache | ||
|
||
extra: | ||
recipe-maintainers: | ||
- xylar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env python | ||
from mache import MachineInfo, discover_machine | ||
|
||
machine = discover_machine() | ||
|
||
machinfo = MachineInfo(machine='anvil') | ||
print(machinfo) | ||
|
||
machinfo = MachineInfo(machine='unknown') | ||
print(machinfo) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from mache.machine_info import MachineInfo | ||
from mache.discover import discover_machine | ||
|
||
__version_info__ = (1, 0, 0) | ||
__version__ = '.'.join(str(vi) for vi in __version_info__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import socket | ||
import warnings | ||
|
||
|
||
def discover_machine(): | ||
""" | ||
Figure out the machine from the host name | ||
Returns | ||
------- | ||
machine : str | ||
The name of the current machine | ||
""" | ||
hostname = socket.gethostname() | ||
if hostname.startswith('acme1'): | ||
machine = 'acme1' | ||
elif hostname.startswith('andes'): | ||
machine = 'andes' | ||
elif hostname.startswith('blueslogin'): | ||
machine = 'anvil' | ||
elif hostname.startswith('ba-fe'): | ||
machine = 'badger' | ||
elif hostname.startswith('chrlogin'): | ||
machine = 'chrysalis' | ||
elif hostname.startswith('compy'): | ||
machine = 'compy' | ||
elif hostname.startswith('cooley'): | ||
machine = 'cooley' | ||
elif hostname.startswith('cori'): | ||
warnings.warn('defaulting to cori-haswell. Use -m cori-knl if you' | ||
' wish to run on KNL.') | ||
machine = 'cori-haswell' | ||
elif hostname.startswith('gr-fe'): | ||
machine = 'grizzly' | ||
else: | ||
machine = None | ||
return machine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.