Verify that the server is healthy.

@throws ServerUnhealthy
193574
protected function assertServerHealhy()
    {
        $info = $this->client->manager()->info();
        foreach ($info['nodes'] as $node) {
            if ($node['status'] !== 'healthy') {
                throw new ServerUnhealthy('Server isn\'t ready yet');
            }
        }
    }
619306
def health(self):
        """"""
        return json.dumps(dict(uptime='{:.3f}s'
                               .format((time.time() - self._start_time))))
1095338
@GET
    @Path("/health")
    @Produces(MediaType.APPLICATION_JSON)
    public HealthStatus health() throws ExecutionException, InterruptedException {
        final HealthStatus status = new HealthStatus();

        final Future<HealthDetails> dbStatus = healthDBService.dbStatus();
        final Future<List<HealthDetails>> networkStatus = healthNetworkService.networkStatus();

        status.add(dbStatus.get());
        networkStatus.get().forEach(status::add);

        return status;
    }
1323995
public function safeUp()
    {
        // unique index for 'userMapping' and 'provider'

        $tableName = 'oauth_tokens';

        $tokensTable = $this->dbConnection->schema->getTable('{{'.$tableName.'}}');

        if ($tokensTable)
        {
            $this->dropForeignKey($tableName, 'userId');

            $this->dropIndex($tableName, 'userMapping, provider', true);

            $this->dropIndex($tableName, 'userId, provider', true);

            $this->dropIndex($tableName, 'namespace, provider', true);

            $this->addForeignKey($tableName, 'userId', 'users', 'id', 'CASCADE');
            $this->createIndex($tableName, 'provider, userMapping, namespace', true);
        }

        return true;
    }
1042717
public function check()
    {
        return $this->horizonIsRunning()
            ? $this->makeHealthyResult()
            : $this->makeResult(false, $this->target->getErrorMessage());
    }
666810
private boolean isSeedHeartbeatValid()
  {
    boolean isSeed = false;
    
    for (ServerHeartbeat server : _serverSelf.getCluster().getSeedServers()) {
      if (server.port() > 0) {
        isSeed = true;
        
        if (server.isUp()) {
          return true;
        }
      }
    }

    return ! isSeed;
  }
1308663
def health_check(cls):
        

        try:
            assert isinstance(settings.MIDDLEWARES, list)
        except AssertionError:
            yield HealthCheckFail(
                '00005',
                'The "MIDDLEWARES" configuration key should be assigned '
                'to a list',
            )
            return

        for m in settings.MIDDLEWARES:
            try:
                c = import_class(m)
            except (TypeError, ValueError, AttributeError, ImportError):
                yield HealthCheckFail(
                    '00005',
                    f'Cannot import middleware "{m}"',
                )
            else:
                if not issubclass(c, BaseMiddleware):
                    yield HealthCheckFail(
                        '00005',
                        f'Middleware "{m}" does not implement '
                        f'"BaseMiddleware"',
                    )
894817
def healthcheck(
        transport: 'UDPTransport',
        recipient: Address,
        stop_event: Event,
        event_healthy: Event,
        event_unhealthy: Event,
        nat_keepalive_retries: int,
        nat_keepalive_timeout: int,
        nat_invitation_timeout: int,
        ping_nonce: Dict[str, Nonce],
):
    
    # pylint: disable=too-many-branches

    log.debug(
        'starting healthcheck for',
        node=pex(transport.address),
        to=pex(recipient),
    )

    # The state of the node is unknown, the events are set to allow the tasks
    # to do work.
    last_state = NODE_NETWORK_UNKNOWN
    transport.set_node_network_state(
        recipient,
        last_state,
    )

    # Always call `clear` before `set`, since only `set` does context-switches
    # it's easier to reason about tasks that are waiting on both events.

    # Wait for the end-point registration or for the node to quit
    try:
        transport.get_host_port(recipient)
    except UnknownAddress:
        log.debug(
            'waiting for endpoint registration',
            node=pex(transport.address),
            to=pex(recipient),
        )

        event_healthy.clear()
        event_unhealthy.set()

        backoff = udp_utils.timeout_exponential_backoff(
            nat_keepalive_retries,
            nat_keepalive_timeout,
            nat_invitation_timeout,
        )
        sleep = next(backoff)

        while not stop_event.wait(sleep):
            try:
                transport.get_host_port(recipient)
            except UnknownAddress:
                sleep = next(backoff)
            else:
                break

    # Don't wait to send the first Ping and to start sending messages if the
    # endpoint is known
    sleep = 0
    event_unhealthy.clear()
    event_healthy.set()

    while not stop_event.wait(sleep):
        sleep = nat_keepalive_timeout

        ping_nonce['nonce'] = Nonce(ping_nonce['nonce'] + 1)
        messagedata = transport.get_ping(ping_nonce['nonce'])
        message_id = ('ping', ping_nonce['nonce'], recipient)

        # Send Ping a few times before setting the node as unreachable
        acknowledged = udp_utils.retry(
            transport,
            messagedata,
            message_id,
            recipient,
            stop_event,
            [nat_keepalive_timeout] * nat_keepalive_retries,
        )

        if stop_event.is_set():
            return

        if not acknowledged:
            log.debug(
                'node is unresponsive',
                node=pex(transport.address),
                to=pex(recipient),
                current_state=last_state,
                new_state=NODE_NETWORK_UNREACHABLE,
                retries=nat_keepalive_retries,
                timeout=nat_keepalive_timeout,
            )

            # The node is not healthy, clear the event to stop all queue
            # tasks
            last_state = NODE_NETWORK_UNREACHABLE
            transport.set_node_network_state(
                recipient,
                last_state,
            )
            event_healthy.clear()
            event_unhealthy.set()

            # Retry until recovery, used for:
            # - Checking node status.
            # - Nat punching.
            acknowledged = udp_utils.retry(
                transport,
                messagedata,
                message_id,
                recipient,
                stop_event,
                repeat(nat_invitation_timeout),
            )

        if acknowledged:
            current_state = views.get_node_network_status(
                views.state_from_raiden(transport.raiden),
                recipient,
            )

            if last_state != NODE_NETWORK_REACHABLE:
                log.debug(
                    'node answered',
                    node=pex(transport.raiden.address),
                    to=pex(recipient),
                    current_state=current_state,
                    new_state=NODE_NETWORK_REACHABLE,
                )

                last_state = NODE_NETWORK_REACHABLE
                transport.set_node_network_state(
                    recipient,
                    last_state,
                )
                event_unhealthy.clear()
                event_healthy.set()
174522
public function check()
    {
        $request = Request::createFromGlobals();
        $serverSoftware = $request->server->get('SERVER_SOFTWARE', '');
        $isApache = strpos($serverSoftware, 'Apache') !== false;
        if (!$isApache) {
            return;
        }

        $path = $this->pathResolver->resolve('%web%/.htaccess');
        if (is_readable($path)) {
            return;
        }

        throw new ApacheValidationException();
    }
810340
public function list_health()
    {
        if (!$this->is_loggedin) {
            return false;
        }

        $response = $this->exec_curl('/api/s/' . $this->site . '/stat/health');

        return $this->process_response($response);
    }
696071
def check_health(settings_cls) -> int:
    
    cls_kwargs = get_kwargs(settings_cls)
    loop = asyncio.get_event_loop()
    return loop.run_until_complete(async_check_health(cls_kwargs.get('redis_settings')))
585592
public function serviceHealthCheck()
    {
        $watches = $this->config->get('consul.watches', []);
        foreach ($watches as $watch) {
            $this->consul_service_client[$watch] = new HttpClient(null, 'http://127.0.0.1:8500');
            $this->help_serviceHealthCheck($watch, 0);
        }
    }
1271017
@Override
    protected Result check() throws Exception {

        m_repository.select(Context.DEFAULT_CONTEXT, new Resource("notreal"), Optional.of(Timestamp.fromEpochMillis(0)), Optional.of(Timestamp.fromEpochMillis(0)));

        return Result.healthy();
    }
452824
protected function checkServerAndAbort($server = null)
    {
        $server = $server ? $server : fp_env('ACACHA_FORGE_SERVER');
        if (! $this->checkServer($server)) {
            $this->error('Server ' . $server . ' not valid');
            die();
        }
    }
1258306
public boolean isHealthy() {
        return health()
                .map(health -> !"red".equals(health.path("status").asText()) && indexSetRegistry.isUp())
                .orElse(false);
    }
1326137
def health_check(self):
        """"""
        logger.debug('Health Check on file for: {namespace}'.format(
            namespace=self.namespace
        ))

        return os.path.isfile(self.data_file)
188493
def health_check(self):
        """"""
        logger.debug('Health Check on S3 file for: {namespace}'.format(
            namespace=self.namespace
        ))

        try:
            self.client.head_object(Bucket=self.bucket_name, Key=self.data_file)
            return True
        except ClientError as e:
            logger.debug('Error encountered with S3.  Assume unhealthy')