CDAT / cdms

8 stars 10 forks source link

Adds workaround when hostname cannot be resolved #393

Closed jasonb5 closed 4 years ago

jasonb5 commented 4 years ago

@forsyth2 @muryanto1 not sure why this didn't occur to me before but since the environment variable MPICH_INTERFACE_HOSTNAME=localhost fixes this we could just set this before calling ESMF.Manager(debug=False) under the correct conditions.

I believe a test for the specific circumstances would be the following raising an exception python -c "import socket; socket.gethostbyname(socket.gethostname())

To test this just install from the repo and test for the specific environment using the above command and the run python -c "import cdms2" which should not longer crash.

My only concern right now is how this would affect users of mpi4py. I don't think this would be an issue, as someone working in this environment would most likely already require their hostname to be resolvable.

What are your thoughts about this fix? About the possible issue? If this works and sounds reasonable, i'll write up some unit tests for this and we can get it merged in.

forsyth2 commented 4 years ago

Thanks @jasonb5. However, I get socket.gaierror: [Errno 8] nodename nor servname provided, or not known when running python -c "import socket; socket.gethostbyname(socket.gethostname())"

jasonb5 commented 4 years ago

@forsyth2 That's the output I would expect if the issue is present, that command is just a test for it. If you install from this branch you should be able to import cdms2 without issue.

muryanto1 commented 4 years ago

@forsyth2 Ryan, I have uploaded cdms2 package with Jason's fix to cdat/label/resolve_hostname channel, so please install this cdms2 to your environment by specifying "-c cdat/label/resolve_hostname" before any other channels. Be on the VPN where running e3sm_diag was giving you problem originally, and verify that the problem is resolved with this cdms2 from cdat/label/resolve_hostname. After you install cdms2 to your env, you can verify that you got the correct cdms2 by running: "conda list --verbose cdms2". Once you verify that the problem is fixed, we will merge this PR.