Check that at least one service has been entered.
355975
def clean(self):
        """"""
        super(AtLeastOneRequiredInlineFormSet, self).clean()
        if any(self.errors):
            return
        if not any(cleaned_data and not cleaned_data.get('DELETE', False) for cleaned_data in self.cleaned_data):
            raise forms.ValidationError('Прикрепите не менее одного документа')
1086793
def wait_for_service_endpoint(service_name, timeout_sec=120):
    """"""

    master_count = len(get_all_masters())
    return time_wait(lambda: service_available_predicate(service_name),
                     timeout_seconds=timeout_sec,
                     required_consecutive_success_count=master_count)
1141788
def _service_heartbeat_if_due(self):
        ''''''
        due = False
        if self._service_registry:
            if not hasattr(self, "status_info"):
                due = True
            else:
                d = doublethink.utcnow() - self.status_info["last_heartbeat"]
                due = d.total_seconds() > self.HEARTBEAT_INTERVAL

        if due:
            self._service_heartbeat()
411742
def check(self):
        """"""

        for i in [f for fs in [self.networks, self.ansible_hosts, self.systems, self.deploys,
                               self.configures, [self.contextualize]] for f in fs]:
            i.check(self)

        snames = [s.name for s in self.systems]
        if len(set(snames)) != len(snames):
            raise RADLParseException("Some System name duplicated.")

        nids = [s.id for s in self.networks]
        if len(set(nids)) != len(nids):
            raise RADLParseException("Some Network name duplicated.")

        return True
226884
public static void ensureServiceSsoAccessIsAllowed(final RegisteredService registeredService, final Service service,
                                                       final TicketGrantingTicket ticketGrantingTicket) {
        ensureServiceSsoAccessIsAllowed(registeredService, service, ticketGrantingTicket, false);
    }
287753
def is_service_selected(self, service):
        
        service_uid = api.get_uid(service)
        for arnum in range(self.ar_count):
            analyses = self.fieldvalues.get("Analyses-{}".format(arnum))
            if not analyses:
                continue
            service_uids = map(self.get_service_uid_from, analyses)
            if service_uid in service_uids:
                return True
        return False
1150886
public static boolean checkForRunningService(Context ctx, String serviceClassName) {
        ActivityManager manager = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE);
        for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
            if (serviceClassName.equals(service.service.getClassName())) {
                return true;
            }
        }
        return false;
    }
1331893
def _computeStatus(self, dfile, service):
        """"""

        # If only one service requested
        if service:
            if not dfile['services'].has_key(service):
                return self.ST_UNTRACKED
            else:
                return dfile['services'][service]['status']

        # Otherwise go through all services and compute
        # a sensible status
        first_service_key=dfile['services'].keys()[0]

        # Save off one of the statuses so we can compute
        # if they are all the same between services.
        first_status=dfile['services'][first_service_key]['status']

        all_status_match=True

        # Return ST_COMPLICATED "C" if status
        # differs
        for service in dfile['services']:
            if dfile['services'][service]['status']!=first_status:
                return self.ST_COMPLICATED

        return first_status
132287
def check(self, url_data):
        """"""
        self.timer.check_w3_time()
        session = url_data.session
        try:
            body = {'uri': url_data.url, 'output': 'soap12'}
            response = session.post('http://validator.w3.org/check', data=body)
            response.raise_for_status()
            if response.headers.get('x-w3c-validator-status', 'Invalid') == 'Valid':
                url_data.add_info(u"W3C Validator: %s" % _("valid HTML syntax"))
                return
            check_w3_errors(url_data, response.text, "W3C HTML")
        except requests.exceptions.RequestException:
            pass # ignore service failures
        except Exception as msg:
            log.warn(LOG_PLUGIN, _("HTML syntax check plugin error: %(msg)s ") % {"msg": msg})
605537
def run(self):
        """"""
        self.log.debug("Entered main loop")
        while not self.shutdown:
            # If no service is running slow down the main loop
            if not self._pipe_service:
                time.sleep(0.3)
            self.update_status()
            # While a service is running, check for incoming messages from that service
            if self._pipe_service and self._pipe_service.poll(1):
                try:
                    message = self._pipe_service.recv()
                    if isinstance(message, dict) and "band" in message:
                        # only dictionaries with 'band' entry are valid messages
                        try:
                            handler = getattr(self, "parse_band_" + message["band"])
                        except AttributeError:
                            handler = None
                            self.log.warning("Unknown band %s", str(message["band"]))
                        if handler:
                            #              try:
                            handler(message)
                    #              except Exception:
                    #                print('Uh oh. What to do.')
                    else:
                        self.log.warning("Invalid message received %s", str(message))
                except EOFError:
                    # Service has gone away
                    error_message = False
                    if self._service_status == CommonService.SERVICE_STATUS_END:
                        self.log.info("Service terminated")
                    elif self._service_status == CommonService.SERVICE_STATUS_ERROR:
                        error_message = "Service terminated with error code"
                    elif self._service_status in (
                        CommonService.SERVICE_STATUS_NONE,
                        CommonService.SERVICE_STATUS_NEW,
                        CommonService.SERVICE_STATUS_STARTING,
                    ):
                        error_message = (
                            "Service may have died unexpectedly in "
                            + "initialization (last known status: %s)"
                            % CommonService.human_readable_state.get(
                                self._service_status, self._service_status
                            )
                        )
                    else:
                        error_message = (
                            "Service may have died unexpectedly"
                            " (last known status: %s)"
                            % CommonService.human_readable_state.get(
                                self._service_status, self._service_status
                            )
                        )
                    if error_message:
                        self.log.error(error_message)
                    self._terminate_service()
                    if self.restart_service:
                        self.exponential_backoff()
                    else:
                        self.shutdown = True
                        if error_message:
                            raise workflows.Error(error_message)

            with self.__lock:
                if (
                    self._service is None
                    and self.restart_service
                    and self._service_factory
                ):
                    self.update_status(status_code=CommonService.SERVICE_STATUS_NEW)
                    self.switch_service()

            # Check that the transport is alive
            if not self._transport.is_connected():
                self._terminate_service()
                raise workflows.Error("Lost transport layer connection")
        self.log.debug("Left main loop")
        self.update_status(status_code=CommonService.SERVICE_STATUS_TEARDOWN)
        self._terminate_service()
        self.log.debug("Terminating.")
1222057
def _process_service_check(
        self, data, url, tag_by_host=False, services_incl_filter=None, services_excl_filter=None, custom_tags=None
    ):
        ''' 
        '''
        custom_tags = [] if custom_tags is None else custom_tags
        service_name = data['pxname']
        status = data['status']
        haproxy_hostname = to_string(self.hostname)
        check_hostname = haproxy_hostname if tag_by_host else ''

        if self._is_service_excl_filtered(service_name, services_incl_filter, services_excl_filter):
            return

        if status in Services.STATUS_TO_SERVICE_CHECK:
            service_check_tags = ["service:%s" % service_name]
            service_check_tags.extend(custom_tags)
            hostname = data['svname']
            if data['back_or_front'] == Services.BACKEND:
                service_check_tags.append('backend:%s' % hostname)

            status = Services.STATUS_TO_SERVICE_CHECK[status]
            message = "%s reported %s:%s %s" % (haproxy_hostname, service_name, hostname, status)
            self.service_check(
                self.SERVICE_CHECK_NAME, status, message=message, hostname=check_hostname, tags=service_check_tags
            )
560509
function checkServices(servicesJson) {
	//console.log(util.inspect(servicesJson))
	for (serviceId in servicesJson) {
		service=servicesJson[serviceId]
		if (service.uuid === blueRadiosService) {
			console.log('BlueRadios service UUID found!')
			//check for characteristics?
			return true;
		}
	}
}
1322920
public static function checkNeeded(): void
    {
        set_time_limit(0);
        ignore_user_abort(true);
        ini_set('memory_limit', '1G');

        $services_collection = new ServiceEntityRepository;
        $services_collection
            ->setWhereRunning(0)
            ->setWhereAutoStart(1);

        /** @var ServiceEntity $service_entity */
        foreach ($services_collection->getAsArrayOfObjects() as $service_entity) {
            if (NOW - $service_entity->getLastTs() >= $service_entity->getPeriod()) {
                self::run($service_entity->getId());
            }
        }
    }
910089
private boolean checkFailover() throws InterruptedException {
    boolean isPrimary = isPrimaryServiceCached();
    if (!isPrimary && isPrimaryService()) {
      this.servicePair.setPrimaryOfferService(this);
      return true;
    }
    return false;
  }
357654
def check(self, request, consumer, token, signature):
        """"""
        built = self.sign(request, consumer, token)
        return built == signature
281336
def service(self):
        """"""
        if not self._service:
            self._service = self._client.service(id=self.service_id)
        return self._service
784380
def run_checked (self):
        """"""
        self.start_time = time.time()
        self.setName("Status")
        # the first status should be after a second
        wait_seconds = 1
        first_wait = True
        while not self.stopped(wait_seconds):
            self.log_status()
            if first_wait:
                wait_seconds = self.wait_seconds
                first_wait = False