libAtoms / testing-framework

11 stars 7 forks source link

`run_all.py` script fails default args if `HOSTNAME` not in env #7

Closed stenczelt closed 3 years ago

stenczelt commented 3 years ago

The run_all.py script has a default argument set, which assumes that HOSTNAME environment variable exists. This is mostly satisfied within a submitted batch job, likely not for interactive jobs though (tested on SGE).

$ ../../../scripts/run-all.py -m Tersoff_quippy -s SiC --tests="bulk_Si_simple_hexagonal"
Traceback (most recent call last):
  File "../../../scripts/run-all.py", line 24, in <module>
    default=re.sub('[0-9]*$', '', os.environ['HOSTNAME'].split('.')[0]))
  File "/opt/womble/miniconda3/user_envs/tks32/quip-serial/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'HOSTNAME'

for a hack, exporting it does help

export HOSTANAME=$(hostname)

I am not sure what this functionality is intended for, but particularly getting the hostname is possible to be obtained in a safer way from python.

noambernstein commented 3 years ago

I think it’s only needed if you use it to generate job scripts with my machine independent system. I’ll try to clean it up.

On Sun, Mar 14, 2021 at 6:33 PM Tamas Stenczel @.***> wrote:

The run_all.py script has a default argument set, which assumes that HOSTNAME environment variable exists. This is mostly satisfied within a submitted batch job, likely not for interactive jobs though (tested on SGE).

$ ../../../scripts/run-all.py -m Tersoff_quippy -s SiC --tests="bulk_Si_simple_hexagonal" Traceback (most recent call last): File "../../../scripts/run-all.py", line 24, in default=re.sub('[0-9]*$', '', os.environ['HOSTNAME'].split('.')[0])) File "/opt/womble/miniconda3/user_envs/tks32/quip-serial/lib/python3.8/os.py", line 675, in getitem raise KeyError(key) from None KeyError: 'HOSTNAME'

for a hack, exporting it does help

export HOSTANAME=$(hostname)

I am not sure what this functionality is intended for, but particularly getting the hostname is possible to be obtained in a safer way from python.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/libAtoms/testing-framework/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBMJRWXUI3KZ55P43J3LOLTDU2T3ANCNFSM4ZFOFC5Q .

stenczelt commented 3 years ago

oh, how to do that? is there some other script I need to use, or can you give me some instructions (is this documented anywhere?) how to do that?

On 14 Mar 2021, at 22:35, noambernstein @.***> wrote:

I think it’s only needed if you use it to generate job scripts with my machine independent system. I’ll try to clean it up.

On Sun, Mar 14, 2021 at 6:33 PM Tamas Stenczel @.***> wrote:

The run_all.py script has a default argument set, which assumes that HOSTNAME environment variable exists. This is mostly satisfied within a submitted batch job, likely not for interactive jobs though (tested on SGE).

$ ../../../scripts/run-all.py -m Tersoff_quippy -s SiC --tests="bulk_Si_simple_hexagonal" Traceback (most recent call last): File "../../../scripts/run-all.py", line 24, in default=re.sub('[0-9]*$', '', os.environ['HOSTNAME'].split('.')[0])) File "/opt/womble/miniconda3/user_envs/tks32/quip-serial/lib/python3.8/os.py", line 675, in getitem raise KeyError(key) from None KeyError: 'HOSTNAME'

for a hack, exporting it does help

export HOSTANAME=$(hostname)

I am not sure what this functionality is intended for, but particularly getting the hostname is possible to be obtained in a safer way from python.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/libAtoms/testing-framework/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBMJRWXUI3KZ55P43J3LOLTDU2T3ANCNFSM4ZFOFC5Q .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libAtoms/testing-framework/issues/7#issuecomment-798992802, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJKZU7ELR6QGPCPM5NXVTGDTDU24VANCNFSM4ZFOFC5Q.

noambernstein commented 3 years ago

On Sun, Mar 14, 2021 at 7:08 PM Tamas Stenczel @.***> wrote:

oh, how to do that? is there some other script I need to use, or can you give me some instructions (is this documented anywhere?) how to do that?

Right now it’s neither documented nor released, but if people want, I’ll pull something together. It’s pretty simple.

Noam

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/libAtoms/testing-framework/issues/7#issuecomment-798997389, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBMJRQBMWMVACLR7IYQX7LTDU6YFANCNFSM4ZFOFC5Q .

bernstei commented 3 years ago

Should be fixed in main (too small for a PR, and we don't have CI anyway). Feel free to close if it's OK now. I'll contact you about the universal submission off-line.