Call the service's API action to retrieve limit/quota information, and
        update AwsLimit objects in ``self.limits`` with this information.
429002
def _update_limits_from_api(self):
        
        try:
            self.connect()
            resp = self.conn.get_send_quota()
        except EndpointConnectionError as ex:
            logger.warning('Skipping SES: %s', str(ex))
            return
        except ClientError as ex:
            if ex.response['Error']['Code'] in ['AccessDenied', '503']:
                logger.warning('Skipping SES: %s', ex)
                return
            raise
        self.limits['Daily sending quota']._set_api_limit(resp['Max24HourSend'])
56235
def recheck_limits(self):
        

        limit_data = self.control_daemon.get_limits()

        try:
            # Get the new checksum and list of limits
            new_sum, new_limits = limit_data.get_limits(self.limit_sum)

            # Convert the limits list into a list of objects
            lims = database.limits_hydrate(self.db, new_limits)

            # Build a new mapper
            mapper = routes.Mapper(register=False)
            for lim in lims:
                lim._route(mapper)

            # Save the new data
            self.limits = lims
            self.limit_sum = new_sum
            self.mapper = mapper
        except control.NoChangeException:
            # No changes to process; just keep going...
            return
        except Exception:
            # Log an error
            LOG.exception("Could not load limits")

            # Get our error set and publish channel
            control_args = self.conf['control']
            error_key = control_args.get('errors_key', 'errors')
            error_channel = control_args.get('errors_channel', 'errors')

            # Get an informative message
            msg = "Failed to load limits: " + traceback.format_exc()

            # Store the message into the error set.  We use a set
            # here because it's likely that more than one node
            # will generate the same message if there is an error,
            # and this avoids an explosion in the size of the set.
            with utils.ignore_except():
                self.db.sadd(error_key, msg)

            # Publish the message to a channel
            with utils.ignore_except():
                self.db.publish(error_channel, msg)
1166724
def get_limits(self):
        
        vals = self._hook_manager.call_hook('task_limits', course=self.get_course(), task=self, default=self._limits)
        return vals[0] if len(vals) else self._limits
40584
def clean_limit(self):
        ""
        limit = self.cleaned_data.get('limit', None)
        if (settings.SELECTABLE_MAX_LIMIT is not None and
            (not limit or limit > settings.SELECTABLE_MAX_LIMIT)):
            limit = settings.SELECTABLE_MAX_LIMIT
        return limit
1031866
def update_one(self, filter, update, **kwargs):
        
        self._arctic_lib.check_quota()
        return self._collection.update_one(filter, update, **kwargs)
647316
def do_updateCapacity(self,args):
        """"""
        parser = CommandArgumentParser("updateMinMax")
        parser.add_argument('-m','--min',dest='min',type=int,help='new values');
        parser.add_argument('-M','--max',dest='max',type=int,help='new values');
        parser.add_argument('-d','--desired',dest='desired',type=int,help='desired');
        args = vars(parser.parse_args(args))

        minSize = args['min']
        maxSize = args['max']
        desired = args['desired']
        
        print "Setting desired capacity to {}-{}, {}".format(minSize,maxSize,desired)
        client = AwsConnectionFactory.getAsgClient()
        client.update_auto_scaling_group(AutoScalingGroupName=self.scalingGroup,MinSize=minSize,MaxSize=maxSize,DesiredCapacity=desired)
        #client.set_desired_capacity(AutoScalingGroupName=self.scalingGroup,DesiredCapacity=value,HonorCooldown=True)
        print "Scaling activity in progress"
324504
def apply_rate_limit?(env)
      @exceptions.none? { |e| e.call(env) } && @conditions.all? { |c| c.call(env) }
    end
413686
async def service_observable(self, limit) -> int:
        
        if not self.isReady():
            return 0
        o = self._service_observable_out_box(limit)
        i = await self._observable.serviceQueues(limit)
        return o + i
1002375
def quota(self):
		

		response = self._call(
			mm_calls.ClientState,
			self.uploader_id
		)
		client_state = response.body.clientstate_response

		return (client_state.total_track_count, client_state.locker_track_limit)
1116485
def get_limits(self):
        
        logger.debug("Gathering %s's limits from AWS", self.service_name)

        if self.limits:
            return self.limits
        limits = {}

        limits['Trails Per Region'] = AwsLimit(
            'Trails Per Region',
            self,
            5,
            self.warning_threshold,
            self.critical_threshold,
            limit_type=self.aws_type
        )

        limits['Event Selectors Per Trail'] = AwsLimit(
            'Event Selectors Per Trail',
            self,
            5,
            self.warning_threshold,
            self.critical_threshold,
            limit_type=self.aws_type,
            limit_subtype='AWS::CloudTrail::EventSelector'
        )

        limits['Data Resources Per Trail'] = AwsLimit(
            'Data Resources Per Trail',
            self,
            250,
            self.warning_threshold,
            self.critical_threshold,
            limit_type=self.aws_type,
            limit_subtype='AWS::CloudTrail::DataResource'
        )

        self.limits = limits
        return limits
322836
def update_available(self, name):
        """"""
        quota = self.usages.get(name, {}).get('quota', float('inf'))
        available = quota - self.usages[name]['used']
        if available < 0:
            available = 0
        self.usages[name]['available'] = available
178762
def limit(self, limit):
        
        if self._limit != limit:
            self.dirty = True
            self._limit = limit
        return self
684237
def limits(action)
      @limits ||= {}
      limits = @limits[action.to_sym]
      raise TrafficJam::LimitNotFound.new(action) if limits.nil?
      limits
    end
540725
def load_limits(self, config=None):
        """"""
        # For each plugins, call the load_limits method
        for p in self._plugins:
            self._plugins[p].load_limits(config)
670343
def _search(self, limit, format):
        '''
        
        '''
        limit = min(limit, self.MAX_SEARCH_PER_QUERY)
        payload = {
          'q' : self.query,
          'count' : limit, #currently 50 is max per search.
          'offset': self.current_offset,
        }
        payload.update(self.CUSTOM_PARAMS)

        headers = { 'Ocp-Apim-Subscription-Key' : self.api_key }
        if not self.silent_fail:
            QueryChecker.check_web_params(payload, headers)
        response = requests.get(self.QUERY_URL, params=payload, headers=headers)
        json_results = self.get_json_results(response)
        packaged_results = [NewsResult(single_result_json) for single_result_json in json_results["value"]]
        self.current_offset += min(50, limit, len(packaged_results))
        return packaged_results
736397
def get_rate_limit(self):
        
        headers, data = self.__requester.requestJsonAndCheck(
            'GET',
            '/rate_limit'
        )
        return RateLimit.RateLimit(self.__requester, headers, data["resources"], True)
882146
def refresh_entitlement(owner, repo, identifier, show_tokens):
    """"""
    client = get_entitlements_api()

    with catch_raise_api_exception():
        data, _, headers = client.entitlements_refresh_with_http_info(
            owner=owner, repo=repo, identifier=identifier, show_tokens=show_tokens
        )

    ratelimits.maybe_rate_limit(client, headers)
    return data.to_dict()