示例#1
0
 def _validate_autoscale(self):
     min_workers = self._params.get('min_workers')
     max_workers = self._params.get('max_workers')
     if min_workers:
         if not str(min_workers).isdigit():
             raise exceptions.DaemonPropertiesError(
                 'min_workers is supposed to be a number '
                 'but is: {0}'.format(min_workers))
         min_workers = int(min_workers)
     if max_workers:
         if not str(max_workers).isdigit():
             raise exceptions.DaemonPropertiesError(
                 'max_workers is supposed to be a number '
                 'but is: {0}'.format(max_workers))
         max_workers = int(max_workers)
     if min_workers and max_workers:
         if min_workers > max_workers:
             raise exceptions.DaemonPropertiesError(
                 'min_workers cannot be greater than max_workers '
                 '[min_workers={0}, max_workers={1}]'.format(
                     min_workers, max_workers))
示例#2
0
 def _validate_deployment_id(self):
     queue = self._params.get('queue')
     host = self._params.get('deployment_id')
     if not queue and not host:
         raise exceptions.DaemonPropertiesError(
             'deployment_id must be supplied when queue is omitted')