set resource limits for an app
541676
function set(appName, limits, callback) {
    if (!isObject(limits)) {
      return callback(new Error('To set a variable pass an object'));
    }

    var keyValues = {};

    if (limits.hasOwnProperty('memory')) {
      keyValues.memory = limits.memory;
    }

    if (limits.hasOwnProperty('cpu')) {
      keyValues.cpu = limits.cpu;
    }

    if (Object.keys(keyValues).length === 0) {
      return callback(new Error('Only cpu and memory limits are valid'));
    }

    commons.post(format('/%s/apps/%s/config/', deis.version, appName), keyValues,
        function onSetResponse(err, result) {
          callback(err, result ? extractLimits(result) : null);
        });
  }
137719
private void setLimit(int from, int size) {
		request.setFrom(from);

		if (size > -1) {
			request.setSize(size);
		}
	}
82888
def _update_limits_from_api(self):
        
        logger.debug('Setting DirectoryService limits from API')
        self.connect()
        resp = self.conn.get_directory_limits()
        directory_limits = resp['DirectoryLimits']
        self.limits['CloudOnlyDirectories']._set_api_limit(
            directory_limits['CloudOnlyDirectoriesLimit']
        )
        self.limits['CloudOnlyMicrosoftAD']._set_api_limit(
            directory_limits['CloudOnlyMicrosoftADLimit']
        )
        self.limits['ConnectedDirectories']._set_api_limit(
            directory_limits['ConnectedDirectoriesLimit']
        )
689914
def throttle(self, key, amount=1, rate=None, capacity=None,
            exc_class=Throttled, **kwargs):
        """"""

        if not self.consume(key, amount, rate, capacity, **kwargs):
            raise exc_class("Request of %d unit for %s exceeds capacity."
                    % (amount, key))
892226
def set_limits(self, min_: typing.Optional[float] = None, max_: typing.Optional[float] = None):
        
        self._min, self._max = min_, max_
811126
def apply_limit(self):
    ''''''
    self._ensure_modification_is_safe()

    if self.query.limit is not None:
      self._iterable = limit_gen(self.query.limit, self._iterable)
356339
public void setLimit(int lim) {
        if(0<=lim && lim<=rep.length()) {
            limit=lim;
        } else {
            limit=rep.length();
        }
        reachedLimit=false;
    }
1174534
def _update_limits_from_api(self):
        
        region_limits = {
            'us-east-1': 70
        }
        self.connect()
        rname = self.conn._client_config.region_name
        if rname in region_limits:
            self.limits['File systems'].default_limit = region_limits[rname]
            logger.debug(
                'Running in region %s; setting EFS "File systems" default '
                'limit value to: %d', rname, region_limits[rname]
            )
616316
private void setUnavailableUntil(long time, boolean isInit) //PM01373
	{
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
            logger.logp(Level.FINE, CLASS_NAME, "setUnavailableUntil", "setUnavailableUntil() : " + time);
        if(isInit){
			state = UNINITIALIZED_STATE;  //PM01373
		}
		else {
        state = UNAVAILABLE_STATE;
		}
        unavailableUntil = time;
        evtSource.onServletUnavailableForService(getServletEvent());
    }
636240
function(app, args) {
  app.set(Constants.RESERVED.ENV, args.env || process.env.NODE_ENV || Constants.RESERVED.ENV_DEV, true);
}
467182
private O setResources(ResourceSpec resources) {
		Preconditions.checkNotNull(resources, "The resources must be not null.");
		Preconditions.checkArgument(resources.isValid(), "The values in resources must be not less than 0.");

		this.minResources = resources;
		this.preferredResources = resources;

		@SuppressWarnings("unchecked")
		O returnType = (O) this;
		return returnType;
	}
941101
def limit_chord_unlock_tasks(app):
    
    task = app.tasks['celery.chord_unlock']
    if task.max_retries is None:
        retries = getattr(app.conf, 'CHORD_UNLOCK_MAX_RETRIES', None)
        task.max_retries = retries
644190
def set_max_clients(limit):
    
    global _dirty, _max_clients

    LOGGER.debug('Setting maximum client limit to %i', limit)
    _dirty = True
    _max_clients = limit
1372597
def do_setDesiredCapacity(self,args):
        """"""
        parser = CommandArgumentParser("setDesiredCapacity")
        parser.add_argument(dest='value',type=int,help='new value');
        args = vars(parser.parse_args(args))

        value = int(args['value'])
        print "Setting desired capacity to {}".format(value)
        client = AwsConnectionFactory.getAsgClient()
        client.set_desired_capacity(AutoScalingGroupName=self.scalingGroup,DesiredCapacity=value,HonorCooldown=True)
        print "Scaling activity in progress"
936032
def set_ylimits(self, min=None, max=None):
        
        self.limits['ymin'] = min
        self.limits['ymax'] = max
539107
def _setuplimits(self, constraints):
        """"""
        self.constraints = tuple(constraints)
        assert len(self.constraints) == self.fmodel.dim_x
        self.goal = None
1219104
def init_app(self, app):
        
        self.enabled = app.config.setdefault(C.ENABLED, True)
        self._swallow_errors = app.config.setdefault(
            C.SWALLOW_ERRORS, self._swallow_errors
        )
        self._storage_options.update(
            app.config.get(C.STORAGE_OPTIONS, {})
        )
        self._storage = storage_from_string(
            self._storage_uri
            or app.config.setdefault(C.STORAGE_URL, 'memory://'),
            **self._storage_options
        )
        strategy = (
            self._strategy
            or app.config.setdefault(C.STRATEGY, 'fixed-window')
        )
        if strategy not in STRATEGIES:
            raise ConfigurationError("Invalid rate limiting strategy %s" % strategy)
        self._limiter = STRATEGIES[strategy](self._storage)

        conf_limits = app.config.get(C.GLOBAL_LIMITS, None)
        if not self._global_limits and conf_limits:
            self._global_limits = [
                ExtLimit(
                    limit, self._key_func, None, False, None, None, None
                ) for limit in parse_many(conf_limits)
                ]
        app.request_middleware.append(self.__check_request_limit)