in src/slurm_plugin/instance_manager.py [0:0]
def _update_slurm_node_addrs(self, slurm_nodes: List[str], launched_instances: List[EC2Instance]):
"""Update node information in slurm with info from launched EC2 instance."""
try:
# When using a cluster DNS domain we don't need to pass nodehostnames
# because they are equal to node names.
# It is possible to force the use of private hostnames by setting
# use_private_hostname = "true" as extra json parameter
node_hostnames = (
None if not self._use_private_hostname else [instance.hostname for instance in launched_instances]
)
update_nodes(
slurm_nodes,
nodeaddrs=[instance.private_ip for instance in launched_instances],
nodehostnames=node_hostnames,
)
logger.info(
"Nodes are now configured with instances %s",
print_with_count(zip(slurm_nodes, launched_instances)),
)
except subprocess.CalledProcessError:
logger.error(
"Encountered error when updating nodes %s with instances %s",
print_with_count(slurm_nodes),
print_with_count(launched_instances),
)
raise NodeAddrUpdateError