(self, retries)
Validates that preemptible arguments make sense with retries.
Validates that preemptible arguments make sense with retries.
Validates that preemptible arguments make sense with retries .
def validate(self, retries):
    """Validates that preemptible arguments make sense with retries."""
    if int is type(self._max_preemptible_attempts):
      if retries < 0 or self._max_preemptible_attempts < 0:
        raise ValueError('--retries and --preemptible may not be negative')

      if self._max_preemptible_attempts >= 1 and not retries:
        # This means user specified a positive preemptible number
        # but didn't specify a retries number
        raise ValueError(
            'Requesting 1 or more preemptible attempts requires setting retries'
        )

      if self._max_preemptible_attempts > retries:
        raise ValueError(
            'Value passed for --preemptible cannot be larger than --retries.')
def validate ( self , retries ) : if int is type ( self . _max_preemptible_attempts ) : if retries < 0 or self . _max_preemptible_attempts < 0 : raise ValueError ( '--retries and --preemptible may not be negative' ) if self . _max_preemptible_attempts >= 1 and not retries : # This means user specified a positive preemptible number # but didn't specify a retries number raise ValueError ( 'Requesting 1 or more preemptible attempts requires setting retries' ) if self . _max_preemptible_attempts > retries : raise ValueError ( 'Value passed for --preemptible cannot be larger than --retries.' )