in xlml/utils/gpu.py [0:0]
def get_ip_address(instance: str) -> airflow.XComArg:
# It takes time to be able to use the ssh with the ip address
# even though the creation request is complete. We intentionally
# sleep for 60s to wait for the ip address to be accessible.
time.sleep(60)
instance_client = compute_v1.InstancesClient()
instance = instance_client.get(
project=project_id, zone=zone, instance=instance
)
if len(instance.network_interfaces) > 1:
logging.warning(
f"GPU instance {gpu_name} has more than one network interface."
)
return instance.network_interfaces[0].network_i_p