Ejemplo n.º 1
0
    def down(self, background=True):
        cmd = [
            "gcloud", "compute", "tpus", "stop",
            "--zone={}".format(self.manager.zone), self.name
        ]
        if background:
            cmd += ["--async"]

        utils.try_call(cmd)
Ejemplo n.º 2
0
    def delete(self, background=True):
        super().delete(background=background)

        if not self.still_exists:
            return

        cmd = ["gcloud", "compute", "tpus", "delete", "--zone={}".format(self.manager.zone), self.name]
        if background:
            cmd += ["--async"]
        cmd += ["--quiet"]  # suppress user confirmation

        utils.try_call(cmd)
Ejemplo n.º 3
0
  def down(self, background=True):
    cmd = ["gcloud", "alpha", "compute", "tpus", "stop", self.name]
    if background:
      cmd += ["--async"]

    utils.try_call(cmd)
Ejemplo n.º 4
0
  def up(self, background=False):
    cmd = ["gcloud", "alpha", "compute", "tpus", "start", self.name]
    if background:
      cmd += ["--async"]

    utils.try_call(cmd)