Check if systemlog doesn't contain too many rows.
169719
protected function systemlogCheck()
    {
        // Get the number of items in the changelog
        $count = $this->app['storage']->getRepository(LogSystem::class)->count();

        if ($count > $this->logThreshold) {
            $message = sprintf(
                "Bolt's <strong>systemlog</strong> is enabled, and there are more than %s rows in the table.",
                $this->logThreshold
            );
            $info = sprintf(
                "Be sure to clean it up periodically, using a Cron job or on the <a href='%s'>Systemlog page</a>.",
                $this->app['url_generator']->generate('systemlog')
            );
            $notice = json_encode([
                'severity' => 1,
                'notice'   => $message,
                'info'     => $info,
            ]);
            $this->app['logger.flash']->configuration($notice);
        }
    }
41685
def _check_row_size(self, array):
        

        if not self._row_size:
            self._row_size = len(array)
        elif self._row_size != len(array):
            raise ArraySizeError, "array should contain %d elements" \
                % self._row_size
1271542
def check(self, radl):
        """"""

        if not radl.get_system_by_name(self.system):
            raise RADLParseException("Invalid system id '%s'" % self.system, line=self.line)
        if not radl.get_configure_by_name(self.configure):
            raise RADLParseException("Invalid configure id '%s'" % self.configure, line=self.line)
226577
function (latest_log) {
		if (latest_log !== null && latest_log.type !== "SYSTEM_DOWN") {
			LOG.warn("server crashed last time", 'handlers.system');
			LOG.event("SYSTEM_CRASHED", SR.Settings.SERVER_INFO);
		}

		LOG.event("SYSTEM_UP", SR.Settings.SERVER_INFO);
	}
1169725
def check_available_ram(self, requested_ram):
        

        available_ram = int(psutil.virtual_memory().available / (1024 * 1024))
        percentage_left = psutil.virtual_memory().percent
        if requested_ram > available_ram:
            message = '"{}" requires {}MB of RAM to run but there is only {}MB - {}% of RAM left on "{}"'.format(self.name,
                                                                                                                 requested_ram,
                                                                                                                 available_ram,
                                                                                                                 percentage_left,
                                                                                                                 platform.node())
            self.project.emit("log.warning", {"message": message})
960469
def check_for_maintenance(self):
        '''
        
        '''
        numrevs = self.conn.get_one("SELECT count(revnum) FROM csetLog")[0]
        if numrevs >= SIGNAL_MAINTENACE_CSETS:
            return True
        return False
438937
private function checkDaemonLimits(): void
    {
        if ($this->isShutdown) {
            throw new ShutdownException($this->shutdownMessage);
        }

        pcntl_signal_dispatch();

        if (DaemonOptions::NO_LIMIT !== $this->requestLimit) {
            if ($this->requestLimit <= $this->requestCount) {
                throw new ShutdownException('Daemon request limit reached ('.$this->requestCount.' of '.$this->requestLimit.')');
            }
        }

        if (DaemonOptions::NO_LIMIT !== $this->memoryLimit) {
            $memoryUsage = memory_get_usage(true);

            if ($this->memoryLimit <= $memoryUsage) {
                throw new ShutdownException('Daemon memory limit reached ('.$memoryUsage.' of '.$this->memoryLimit.' bytes)');
            }
        }
    }
608079
def rowCount(self, parent):
        """"""
        if not parent.isValid():
            v = self._conf
        else:
            v = self.get_value(parent)
        if isinstance(v, Section):
            return len(v.keys())
        else:
            return 0
824765
def validate_rows_length(data, length, message=None, exception=MatrixError):
    """"""
    if message is None:
        message = 'All rows must have the same length (same number of columns)'
    for row in data:
        if len(row) != length:
            raise exception(message)
604145
def __check_logging_rules(configuration):
    
    valid_log_levels = [
        'debug',
        'info',
        'warning',
        'error'
    ]
    if configuration['logging']['log_level'].lower() not in valid_log_levels:
        print('Log level must be one of {0}'.format(
            ', '.join(valid_log_levels)))
        sys.exit(1)
1133979
def check_limits(self, verbose=False):
        
        # instantiate the class
        checker = AwsLimitChecker()
        # set your overrides
        checker.set_threshold_overrides(AWS_THRESHOLD_OVERRIDES)
        checker.set_limit_overrides(AWS_LIMIT_OVERRIDES)

        print("Checking AWS resource usage; WARNING threshold {w}% of "
              "limit, CRITICAL threshold {c}% of limit".format(
                  w=checker.warning_threshold,
                  c=checker.critical_threshold))

        # check usage against thresholds
        # if we didn't support verbose output, we could just iterate the return
        # value of this to be a bit more efficient.
        checker.check_thresholds()

        # save state for exit code and summary
        warnings = []
        criticals = []

        # iterate the results
        for service, svc_limits in sorted(checker.get_limits().items()):
            for limit_name, limit in sorted(svc_limits.items()):
                have_alarms = False
                # check warnings and criticals for each Limit
                for warn in limit.get_warnings():
                    warnings.append(colored("{service} '{limit_name}' usage "
                                            "({u}) exceeds warning threshold "
                                            "(limit={l})".format(
                                                service=service,
                                                limit_name=limit_name,
                                                u=str(warn),
                                                l=limit.get_limit(),
                                            ), 'yellow'))
                    have_alarms = True
                for crit in limit.get_criticals():
                    criticals.append(colored("{service} '{limit_name}' usage "
                                             "({u}) exceeds critical threshold"
                                             " (limit={l})".format(
                                                 service=service,
                                                 limit_name=limit_name,
                                                 u=str(crit),
                                                 l=limit.get_limit(),
                                             ), 'red'))
                    have_alarms = True
                if not have_alarms and verbose:
                    print("{service} '{limit_name}' OK: {u} (limit={l})".format(
                        service=service,
                        limit_name=limit_name,
                        u=limit.get_current_usage_str(),
                        l=limit.get_limit()
                    ))
        if verbose:
            print("\n\n")
        return (warnings, criticals)
817391
public synchronized boolean hasNext()
    {
        try
        {
            if (!isHasCalledCheck())
            {
                setHasCalledCheck(true);
                setHasNext(getRsAndStmt().m_rs.next());
                if (!getHasNext())
                {
                    autoReleaseDbResources();
                }
            }
        }
        catch (Exception ex)
        {
            setHasNext(false);
            autoReleaseDbResources();
            if(ex instanceof ResourceClosedException)
            {
                throw (ResourceClosedException)ex;
            }
            if(ex instanceof SQLException)
            {
                throw new PersistenceBrokerSQLException("Calling ResultSet.next() failed", (SQLException) ex);
            }
            else
            {
               throw new PersistenceBrokerException("Can't get next row from ResultSet", ex);
            }
        }
        if (logger.isDebugEnabled())
            logger.debug("hasNext() -> " + getHasNext());

        return getHasNext();
    }
842344
def check_for_resize
      while (current_table = table) && MAX_CAPACITY > (table_size = current_table.size) && NOW_RESIZING != (size_ctrl = size_control) && size_ctrl < @counter.sum
        try_in_resize_lock(current_table, size_ctrl) do
          self.table = rebuild(current_table)
          (table_size << 1) - (table_size >> 1) # 75% load factor
        end
      end
    end
754742
def tail(self, since, filter_pattern, limit=10000, keep_open=True, colorize=True, http=False, non_http=False, force_colorize=False):
        

        try:
            since_stamp = string_to_timestamp(since)

            last_since = since_stamp
            while True:
                new_logs = self.zappa.fetch_logs(
                    self.lambda_name,
                    start_time=since_stamp,
                    limit=limit,
                    filter_pattern=filter_pattern,
                    )

                new_logs = [ e for e in new_logs if e['timestamp'] > last_since ]
                self.print_logs(new_logs, colorize, http, non_http, force_colorize)

                if not keep_open:
                    break
                if new_logs:
                    last_since = new_logs[-1]['timestamp']
                time.sleep(1)
        except KeyboardInterrupt: # pragma: no cover
            # Die gracefully
            try:
                sys.exit(0)
            except SystemExit:
                os._exit(130)
527902
def count(self, with_limit_and_skip=False):
        ''' 
        '''
        return self.__get_query_result().cursor.count(with_limit_and_skip=with_limit_and_skip)
36158
private boolean incSlotLimit(JobInfo info, TaskType type, LimitType limit) {
    switch (limit) {
      case MIN:
        if (type == TaskType.MAP) {
          if (info.minMaps < runnableTasks(info, type)) {
            info.minMaps += 1;
            return true;
          }
        } else {
          if (info.minReduces < runnableTasks(info, type)) {
            info.minReduces += 1;
            return true;
          }
        }
        return false;
      case MAX:
        if (type == TaskType.MAP) {
          if (info.maxMaps < runnableTasks(info, type)) {
            info.maxMaps += 1;
            return true;
          }
        } else {
          if (info.maxReduces < runnableTasks(info, type)) {
            info.maxReduces += 1;
            return true;
          }
        }
        return false;
    }
    // Never come here
    return false;
  }
1031065
def monitor(i):
    """"""
    count = 0
    for x in i:
        count+=1
        if count % 10000 == 0:
            logger.info("%d records so far, current record is %s",
                count, x["idx"])
        yield x