Return whether the throughput of the master instance is greater than the
        acceptable threshold
767136
def is_instance_throughput_too_low(self, inst_id):
        
        r = self.instance_throughput_ratio(inst_id)
        if r is None:
            logger.debug("{} instance {} throughput is not "
                         "measurable.".format(self, inst_id))
            return None
        too_low = r < self.Delta
        if too_low:
            logger.display("{}{} instance {} throughput ratio {} is lower than Delta {}.".
                           format(MONITORING_PREFIX, self, inst_id, r, self.Delta))
        else:
            logger.trace("{} instance {} throughput ratio {} is acceptable.".
                         format(self, inst_id, r))
        return too_low
657107
def __threshold(self, ymx_i):
        
        return ymx_i - (self.S * np.diff(self.xsn).mean())
871099
protected void checkAscpThreshold() {

		if (TransferListener.getAscpCount() >= asperaTransferManagerConfig.getAscpMaxConcurrent()) {
			log.error("ASCP process threshold has been reached, there are currently " + TransferListener.getAscpCount() + " processes running");
			throw new AsperaTransferException("ASCP process threshold has been reached");
		}
    }
20967
def zremrangebyscore(self, name, min, max):
        
        with self.pipe as pipe:
            return pipe.zremrangebyscore(self.redis_key(name), min, max)
107009
private boolean checkVmIsStarted() {

		DescribeInstancesRequest dis = new DescribeInstancesRequest();
		dis.setInstanceIds(Collections.singletonList(this.machineId));

		DescribeInstancesResult disresult = this.ec2Api.describeInstances( dis );
		// Obtain availability zone (for later use, eg. volume attachment).
		// Necessary if no availability zone is specified in configuration
		// (because volumes must be attached to instances in the same availability zone).
		this.availabilityZone = disresult.getReservations().get(0).getInstances().get(0).getPlacement().getAvailabilityZone();
		return "running".equalsIgnoreCase( disresult.getReservations().get(0).getInstances().get(0).getState().getName());
	}
1159758
def checkPerformance(self) -> Optional[bool]:
        
        logger.trace("{} checking its performance".format(self))

        # Move ahead only if the node has synchronized its state with other
        # nodes
        if not self.isParticipating:
            return

        if self.view_change_in_progress:
            return

        if not self._update_new_ordered_reqs_count():
            logger.trace("{} ordered no new requests".format(self))
            return

        if self.instances.masterId is not None:
            self.sendNodeRequestSpike()

            master_throughput, backup_throughput = self.monitor.getThroughputs(0)
            if master_throughput is not None:
                self.metrics.add_event(MetricsName.MONITOR_AVG_THROUGHPUT, master_throughput)
            if backup_throughput is not None:
                self.metrics.add_event(MetricsName.BACKUP_MONITOR_AVG_THROUGHPUT, backup_throughput)

            avg_lat_master, avg_lat_backup = self.monitor.getLatencies()
            if avg_lat_master:
                self.metrics.add_event(MetricsName.MONITOR_AVG_LATENCY, avg_lat_master)

            if avg_lat_backup:
                self.metrics.add_event(MetricsName.BACKUP_MONITOR_AVG_LATENCY, avg_lat_backup)

            degraded_backups = self.monitor.areBackupsDegraded()
            if degraded_backups:
                logger.display('{} backup instances performance degraded'.format(degraded_backups))
                self.backup_instance_faulty_processor.on_backup_degradation(degraded_backups)

            if self.monitor.isMasterDegraded():
                logger.display('{} master instance performance degraded'.format(self))
                self.view_changer.on_master_degradation()
                return False
            else:
                logger.trace("{}'s master has higher performance than backups".
                             format(self))
        return True
654120
function checkThresholds(metrics, thresholds) {
  if (!elv(thresholds)) return;

  const target = metrics[thresholds.target];

  for (let i = 0; i < metrics.length; i++) {
    if (i === thresholds.target) continue;

    const other = metrics[i];
    assertThreshold(target.avg, other.avg, thresholds.avg);
    assertThreshold(target.max, other.max, thresholds.max);
    assertThreshold(target.min, other.min, thresholds.min);
  }
}
681120
def vacuum(self, threshold=0.3):
        '''
        

        '''
        url = ("http://{master_addr}:{master_port}/"
               "vol/vacuum?garbageThreshold={threshold}").format(
            master_addr=self.master_addr,
            master_port=self.master_port,
            threshold=threshold)
        res = self.conn.get_data(url)
        if res is not None:
            return True
        return False
648009
def _check_with_socket(self, sock_info):
        
        start = _time()
        try:
            return (sock_info.ismaster(self._pool.opts.metadata,
                                       self._topology.max_cluster_time()),
                    _time() - start)
        except OperationFailure as exc:
            # Update max cluster time even when isMaster fails.
            self._topology.receive_cluster_time(
                exc.details.get('$clusterTime'))
            raise
1030182
def loudness(self):
        
        response = self.renderingControl.GetLoudness([
            ('InstanceID', 0),
            ('Channel', 'Master'),
        ])
        loudness = response["CurrentLoudness"]
        return True if int(loudness) else False
312069
public boolean isMasterSecretValid(final Socket socket) {
        return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
            @Override
            public Boolean run() {
                return privilegedIsMasterSecretValid(socket);
            }
        });
    }
733332
private boolean gainPrimacy() throws Exception {
    // Don't upgrade if this master's primacy is unstable.
    AtomicBoolean unstable = new AtomicBoolean(false);
    try (Scoped scoped = mLeaderSelector.onStateChange(state -> unstable.set(true))) {
      if (mLeaderSelector.getState() != State.PRIMARY) {
        unstable.set(true);
      }
      stopMasters();
      LOG.info("Secondary stopped");
      mJournalSystem.gainPrimacy();
      // We only check unstable here because mJournalSystem.gainPrimacy() is the only slow method
      if (unstable.get()) {
        losePrimacy();
        return false;
      }
    }
    startMasters(true);
    mServingThread = new Thread(() -> {
      try {
        startServing(" (gained leadership)", " (lost leadership)");
      } catch (Throwable t) {
        Throwable root = ExceptionUtils.getRootCause(t);
        if ((root != null && (root instanceof InterruptedException)) || Thread.interrupted()) {
          return;
        }
        ProcessUtils.fatalError(LOG, t, "Exception thrown in main serving thread");
      }
    }, "MasterServingThread");
    mServingThread.start();
    if (!waitForReady(10 * Constants.MINUTE_MS)) {
      ThreadUtils.logAllThreads();
      throw new RuntimeException("Alluxio master failed to come up");
    }
    LOG.info("Primary started");
    return true;
  }
657939
def check_master(self):
        '''
        
        '''
        if not os.path.exists(
                os.path.join(
                    self.opts['sock_dir'],
                    'publish_pull.ipc'
                    )
                ):
            return False
        return True
904069
function checkThreshold(item, ctx) {
		if (item.count >= item.opts.minRequestCount) {
			const rate = item.failures / item.count;
			if (rate >= item.opts.threshold)
				trip(item, ctx);
		}
	}
738565
def threshold(np, acc, stream_raster, threshold=100., workingdir=None,
                  mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
        """"""
        fname = TauDEM.func_name('threshold')
        return TauDEM.run(FileClass.get_executable_fullpath(fname, exedir),
                          {'-ssa': acc}, workingdir,
                          {'-thresh': threshold},
                          {'-src': stream_raster},
                          {'mpipath': mpiexedir, 'hostfile': hostfile, 'n': np},
                          {'logfile': log_file, 'runtimefile': runtime_file})
326221
def _GetSubFlowNetworkLimit(self):
    """"""

    subflow_network_limit = None

    if self.runner_args.per_client_network_limit_bytes:
      subflow_network_limit = self.runner_args.per_client_network_limit_bytes

    if self.runner_args.network_bytes_limit:
      remaining_network_quota = (
          self.runner_args.network_bytes_limit -
          self.context.network_bytes_sent)
      if subflow_network_limit is None:
        subflow_network_limit = remaining_network_quota
      else:
        subflow_network_limit = min(subflow_network_limit,
                                    remaining_network_quota)

    return subflow_network_limit
1164867
def is_instance_avg_req_latency_too_high(self, inst_id):
        
        avg_lat, avg_lat_others = self.getLatencies()
        if not avg_lat or not avg_lat_others:
            return False

        d = avg_lat - avg_lat_others
        if d < self.Omega:
            return False

        if inst_id == self.instances.masterId:
            logger.info("{}{} found difference between master's and "
                        "backups's avg latency {} to be higher than the "
                        "threshold".format(MONITORING_PREFIX, self, d))
            logger.trace(
                "{}'s master's avg request latency is {} and backup's "
                "avg request latency is {}".format(self, avg_lat, avg_lat_others))
        return True