Skip to content

Commit f0f1ed0

Browse files
authored
Update gcp.py (#39)
1 parent de60004 commit f0f1ed0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cloud/envs/gcp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def _new_name(self, length=5):
288288

289289
def _new_ip(self):
290290
while True:
291-
ip = random.randint(1, 98)
291+
ip = "10.{}.{}.0".format(random.randint(1, 98), random.randint(1, 98))
292292
if ip not in self.ips:
293293
return ip
294294

@@ -321,7 +321,7 @@ def get(self, preemptible=True, name=None, version='v3-8', zone=None):
321321
def _up(self, name, ip, preemptible, version, zone, background):
322322
logger.info("Trying to acquire TPU with name: {} ip: {}".format(name, ip))
323323
cmd = [
324-
"gcloud", "compute", "tpus", "create", name, "--range=10.0.{}.0".format(ip),
324+
"gcloud", "compute", "tpus", "create", name, "--range={}".format(ip),
325325
"--accelerator-type={}".format(version), "--version={}".format(self.tf_version), "--network=default"
326326
]
327327
if zone:

0 commit comments

Comments
 (0)