10
10
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
11
11
# See the License for the specific language governing permissions and limitations under the License.
12
12
import logging
13
+ import socket
13
14
14
15
import pytest
15
16
@@ -58,7 +59,7 @@ def test_mpi(scheduler, region, os, instance, pcluster_config_reader, clusters_f
58
59
)
59
60
60
61
61
- @pytest .mark .regions (["eu-west-1 " ])
62
+ @pytest .mark .regions (["us-east-2 " ])
62
63
@pytest .mark .instances (["c5.xlarge" ])
63
64
@pytest .mark .schedulers (["slurm" , "sge" , "torque" ])
64
65
@pytest .mark .usefixtures ("region" , "instance" )
@@ -79,12 +80,25 @@ def _test_mpi_ssh(remote_command_executor, scheduler, os, test_datadir):
79
80
compute_node = scheduler_commands .get_compute_nodes ()
80
81
assert_that (len (compute_node )).is_equal_to (1 )
81
82
remote_host = compute_node [0 ]
83
+
84
+ # Gets remote host ip from hostname
85
+ remote_host_ip = remote_command_executor .run_remote_command (
86
+ "getent hosts {0} | cut -d' ' -f1" .format (remote_host )
87
+ ).stdout
88
+
89
+ # Below job will timeout if the IP address is not in known_hosts
90
+ mpirun_out_ip = remote_command_executor .run_remote_script (
91
+ str (test_datadir / "mpi_ssh.sh" ), args = [mpi_module , remote_host_ip ]
92
+ ).stdout .splitlines ()
93
+
94
+ # mpirun_out_ip = "ip-10-0-127-71"
95
+ assert_that (len (mpirun_out_ip )).is_equal_to (1 )
96
+ assert_that (mpirun_out_ip [- 1 ]).is_equal_to (remote_host )
97
+
82
98
mpirun_out = remote_command_executor .run_remote_script (
83
99
str (test_datadir / "mpi_ssh.sh" ), args = [mpi_module , remote_host ]
84
100
).stdout .splitlines ()
85
101
86
- # mpirun_out =
87
- # "Warning: Permanently added the RSA host key for IP address '10.0.127.71' to the list of known hosts.\n
88
- # ip-10-0-127-71"
89
- assert_that (len (mpirun_out )).is_greater_than_or_equal_to (1 )
102
+ # mpirun_out = "ip-10-0-127-71"
103
+ assert_that (len (mpirun_out )).is_equal_to (1 )
90
104
assert_that (mpirun_out [- 1 ]).is_equal_to (remote_host )
0 commit comments