示例#1
0
  def Run(self, args):
    start = time_utils.CurrentTimeSec()
    group_ref = self.CreateGroupReference(args)

    while True:
      responses, errors = self._GetResources(group_ref)
      if errors:
        utils.RaiseToolException(errors)
      if wait_info.IsGroupStableAlpha(responses[0]):
        break
      log.out.Print(wait_info.CreateWaitTextAlpha(responses[0]))
      time_utils.Sleep(WaitUntilStableAlpha._TIME_BETWEEN_POLLS_SEC)

      if args.timeout and time_utils.CurrentTimeSec() - start > args.timeout:
        raise utils.TimeoutError('Timeout while waiting for group to become '
                                 'stable.')
    log.out.Print('Group is stable')
  def Run(self, args):
    """Issues requests necessary to wait until stable on a MIG."""
    holder = base_classes.ComputeApiHolder(self.ReleaseTrack())
    client = holder.client
    start = time_util.CurrentTimeSec()
    group_ref = self.CreateGroupReference(client, holder.resources, args)

    while True:
      responses, errors = self._GetResources(client, group_ref)
      if errors:
        utils.RaiseToolException(errors)
      if wait_info.IsGroupStableAlpha(responses[0]):
        break
      log.out.Print(wait_info.CreateWaitTextAlpha(responses[0]))
      time_util.Sleep(WaitUntilStableAlpha._TIME_BETWEEN_POLLS_SEC)

      if args.timeout and time_util.CurrentTimeSec() - start > args.timeout:
        raise utils.TimeoutError('Timeout while waiting for group to become '
                                 'stable.')
    log.out.Print('Group is stable')