View running services.
169209
def view_running_services(self, package: str='') -> str:
        ''''''
        output, _ = self._execute(
            '-s', self.device_sn, 'shell', 'dumpsys', 'activity', 'services', package)
        return output
414069
def _processJobsWithRunningServices(self):
        """"""
        while True:
            jobGraph = self.serviceManager.getJobGraphWhoseServicesAreRunning(0)
            if jobGraph is None: # Stop trying to get jobs when function returns None
                break
            logger.debug('Job: %s has established its services.', jobGraph.jobStoreID)
            jobGraph.services = []
            self.toilState.updatedJobs.add((jobGraph, 0))
181748
def run(self):
        

        services = Service.objects.all()
        for service in services:
            service_metric_sync.apply_async(
                kwargs={"service_id": str(service.id)})

            key = "services.downtime.%s.sum" % (
                utils.normalise_string(service.name))
            check = WidgetData.objects.filter(service=None, key=key)
            if not check.exists():
                WidgetData.objects.create(
                    key=key,
                    title="TEMP - Pending update"
                )

        return "Queued <%s> Service(s) for Metric Sync" % services.count()
760067
def run(self, dw, m, area):
        """"""
        return _fitz.DisplayList_run(self, dw, m, area)
378153
function(cb) {
          docker.listContainers({
            all : 1,
          // filters: '{"status":["running"]}'
          }, function(err, containers) {
            if (err) {
              return cb(err);
            }

            var container = null;

            for (var c = 0; c < containers.length; c++) {
              if (containers[c].Image.indexOf(utils.qualifiedImageName(tag,
                  options.registry, null)) === 0) {
                // If the current container is running or terminated
                if (utils.getContainerStatus(containers[c]) === "RUNNING"
                    || utils.getContainerStatus(containers[c]) === "STOPPED") {
                  container = containers[c];
                  break;
                }
              }
            }

            cb(null, container);
          });
        }
175065
def list(self, request, *args, **kwargs):
        
        return super(ServicesViewSet, self).list(request, *args, **kwargs)
61041
def map_services(self):
        """"""
        # the Vera rest API is a bit rough so we need to make 2 calls
        # to get all the info e need
        self.get_simple_devices_info()

        j = self.data_request({'id': 'status', 'output_format': 'json'}).json()

        service_map = {}

        items = j.get('devices')

        for item in items:
            service_map[item.get('id')] = item.get('states')

        self.device_services_map = service_map
127438
public void listRunningServices() {
        try {
            final List<String> formatedOutput =
                SecurityContext.executeWithSystemPermissions(new Callable<List<String>>() {
                    @Override
                    public List<String> call() throws Exception {
                        List<String> tmp = new ArrayList<String>();

                        List<ServiceReference<Domain>> listServiceReferences =
                            osgiUtilsService.listServiceReferences(Domain.class);
                        for (ServiceReference<Domain> ref : listServiceReferences) {
                            Domain service = bundleContext.getService(ref);
                            tmp.add(OutputStreamFormater.formatValues(
                                ref.getProperty(org.osgi.framework.Constants.SERVICE_PID).toString(), service
                                    .getAliveState().toString()));
                        }
                        return tmp;
                    }
                });
            for (String s : formatedOutput) {
                OutputStreamFormater.printValue(s);
            }
        } catch (ExecutionException ex) {
            ex.printStackTrace();
            System.err.println("Could not get services");
        }
    }
166799
def run(self):
        """"""
        for wsock in self.wsocks:
            wsock.run()
        for api in self.apis:
            api.run()
663391
def services(cls):
        """"""
        return cls.json_get('%s/services' % cls.api_url, empty_key=True,
                            send_key=False)
461633
def services(self):
        """"""
        services = []
        if self._services is None:
            self.__init()
        for service in self._services:
            url = "%s/%s/%s" % (self.root, service['name'], service['type'])
            if service['type'] == "GPServer":
                services.append(GPService(url=url,
                                          securityHandler=self._securityHandler,
                                          proxy_url=self._proxy_url,
                                          proxy_port=self._proxy_port))
            elif service['type'] == "MapServer":
                services.append(MapService(url=url,
                                           securityHandler=self._securityHandler,
                                           proxy_url=self._proxy_url,
                                           proxy_port=self._proxy_port))
            elif service['type'] == "ImageServer":
                services.append(ImageService(url=url,
                                             securityHandler=self._securityHandler,
                                             proxy_url=self._proxy_url,
                                             proxy_port=self._proxy_port))
            elif service['type'] == "FeatureServer":
                if self.currentFolder == 'root':
                    serviceName = service['name']
                else:
                    serviceName = service['name'].split('/')[1]
                url = "%s/%s/%s" % (self.location, serviceName, service['type'])
                services.append(FeatureService(url=url,
                                               securityHandler=self._securityHandler,
                                               proxy_url=self._proxy_url,
                                               proxy_port=self._proxy_port))
            elif service['type'] == "GeometryServer":
                url = "%s/%s/%s" % (self.root, service['name'], service['type'])
                services.append(GeometryService(url=url,
                                               securityHandler=self._securityHandler,
                                               proxy_url=self._proxy_url,
                                               proxy_port=self._proxy_port))
            elif service['type'] == "MobileServer":
                services.append(MobileService(url=url,
                                              securityHandler=self._securityHandler,
                                              proxy_url=self._proxy_url,
                                              proxy_port=self._proxy_port))
            elif service['type'] == "NAServer":
                services.append(NetworkService(url=url,
                                               securityHandler=self._securityHandler,
                                               proxy_port=self._proxy_port,
                                               proxy_url=self._proxy_url))
            elif service['type'] == "GeocodeServer":
                services.append(GeocodeService(url=url,
                                               securityHandler=self._securityHandler,
                                               proxy_port=self._proxy_port,
                                               proxy_url=self._proxy_url))
            elif service['type'] == "GeoDataServer":
                services.append(GeoDataService(url=url,
                                               securityHandler=self._securityHandler,
                                               proxy_port=self._proxy_port,
                                               proxy_url=self._proxy_url))
            elif service['type'] == "GlobeServer":
                services.append(GlobeService(url=url,
                                               securityHandler=self._securityHandler,
                                               proxy_port=self._proxy_port,
                                               proxy_url=self._proxy_url))
            elif service['type'] == "StreamServer":
                services.append(StreamService(url=url,
                                             securityHandler=self._securityHandler,
                                             proxy_port=self._proxy_port,
                                             proxy_url=self._proxy_url))                
            elif service['type'] in ("IndexGenerator", "IndexingLauncher", "SearchServer"):
                pass
            else:
                print (service['type'], service['name'])
        return services
287396
def find_usage(self):
        
        logger.debug("Checking usage for service %s", self.service_name)
        self.connect()
        for lim in self.limits.values():
            lim._reset_usage()
        self._find_usage_applications()
        self._find_usage_application_versions()
        self._find_usage_environments()
        self._have_usage = True
        logger.debug("Done checking usage.")
1372935
def _run_services(self, pants_services):
    """"""
    if not pants_services.services:
      self._logger.critical('no services to run, bailing!')
      return

    service_thread_map = {service: self._make_thread(service)
                          for service in pants_services.services}

    # Start services.
    for service, service_thread in service_thread_map.items():
      self._logger.info('starting service {}'.format(service))
      try:
        service_thread.start()
      except (RuntimeError, FSEventService.ServiceError):
        self.shutdown(service_thread_map)
        raise PantsDaemon.StartupFailure('service {} failed to start, shutting down!'.format(service))

    # Once all services are started, write our pid.
    self.write_pid()
    self.write_metadata_by_name('pantsd', self.FINGERPRINT_KEY, ensure_text(self.options_fingerprint))

    # Monitor services.
    while not self.is_killed:
      for service, service_thread in service_thread_map.items():
        if not service_thread.is_alive():
          self.shutdown(service_thread_map)
          raise PantsDaemon.RuntimeFailure('service failure for {}, shutting down!'.format(service))
        else:
          # Avoid excessive CPU utilization.
          service_thread.join(self.JOIN_TIMEOUT_SECONDS)
791154
def show_service_profile(self, flavor_profile, **_params):
        """"""
        return self.get(self.service_profile_path % (flavor_profile),
                        params=_params)
199621
def scan(self):
        """"""

        log.debug("scanning machine: %s..." % self.name)

        deployed = set()
        services = yield self.client.get_children(self.path + "/services")

        for name in services:
            log.debug("checking service: '%s'..." % name)

            try:
                value, metadata = yield self.client.get(
                    self.path + "/services/" + name + "/machines"
                    )
            except NoNodeException:
                log.warn(
                    "missing machines declaration for service: %s." %
                    name
                    )
                machines = []
            else:
                machines = json.loads(value)

            if machines:
                log.debug("machines: %s." % ", ".join(machines))

                if self.name in machines:
                    deployed.add(name)
            else:
                log.debug("service not configured for any machine.")

        count = len(deployed)
        log.debug("found %d service(s) configured for this machine." % count)

        running = yield self.client.get_children(
            self.path + "/machines/" + self.name
            )

        self.stopped = deployed - set(running)

        if self.stopped:
            log.debug("services not running: %s." % ", ".join(
                map(repr, self.stopped)))
        elif running:
            log.debug("all services are up.")
271089
function() {

    // Check if our engine is up
    return kbox.engine.isUp()

    // If we are up check for containers running for an app
    // otherwise return false
    .then(function(isUp) {

      // Engine is up so lets check if the app has running containers
      if (isUp) {

        // Get list of containers
        return kbox.engine.list(app.name)

        // Return running containers
        .filter(function(container) {
          return kbox.engine.isRunning(container.id);
        });

      }

      // Engine is down so nothing can be running
      else {
        return {};
      }

    })

    // Generate information about services if we can
    .then(function(runningServices) {
      if (_.isEmpty(runningServices)) {
        return 'App is not running.';
      }
      else {
        return Promise.map(runningServices, function(service) {
          return getServiceSummary(service);
        });
      }
    });

  }
1038072
def get_status(self):
        """"""
        return {
            "host": self.__hostid,
            "status": self._service_status_announced,
            "statustext": CommonService.human_readable_state.get(
                self._service_status_announced
            ),
            "service": self._service_name,
            "serviceclass": self._service_class_name,
            "utilization": self._utilization.report(),
            "workflows": workflows.version(),
        }