performs data collection for qpid broker
427139
def setup(self):
        
        options = ""
        amqps_prefix = ""  # set amqps:// when SSL is used
        if self.get_option("ssl"):
            amqps_prefix = "amqps://"
        # for either present option, add --option=value to 'options' variable
        for option in ["ssl-certificate", "ssl-key"]:
            if self.get_option(option):
                amqps_prefix = "amqps://"
                options = (options + " --%s=" % (option) +
                           self.get_option(option))
        if self.get_option("port"):
            options = (options + " -b " + amqps_prefix +
                       "localhost:%s" % (self.get_option("port")))

        self.add_cmd_output([
            "qpid-stat -g" + options,  # applies since 0.18 version
            "qpid-stat -b" + options,  # applies to pre-0.18 versions
            "qpid-stat -c" + options,
            "qpid-stat -e" + options,
            "qpid-stat -q" + options,
            "qpid-stat -u" + options,
            "qpid-stat -m" + options,  # applies since 0.18 version
            "qpid-config exchanges" + options,
            "qpid-config queues" + options,
            "qpid-config exchanges -b" + options,  # applies to pre-0.18 vers.
            "qpid-config queues -b" + options,  # applies to pre-0.18 versions
            "qpid-config exchanges -r" + options,  # applies since 0.18 version
            "qpid-config queues -r" + options,  # applies since 0.18 version
            "qpid-route link list" + options,
            "qpid-route route list" + options,
            "qpid-cluster" + options,  # applies to pre-0.22 versions
            "qpid-ha query" + options,  # applies since 0.22 version
            "ls -lanR /var/lib/qpidd"
        ])

        self.add_copy_spec([
            "/etc/qpidd.conf",  # applies to pre-0.22 versions
            "/etc/qpid/qpidd.conf",  # applies since 0.22 version
            "/var/lib/qpid/syslog",
            "/etc/ais/openais.conf",
            "/var/log/cumin.log",
            "/var/log/mint.log",
            "/etc/sasl2/qpidd.conf",
            "/etc/qpid/qpidc.conf",
            "/etc/sesame/sesame.conf",
            "/etc/cumin/cumin.conf",
            "/etc/corosync/corosync.conf",
            "/var/lib/sesame",
            "/var/log/qpidd.log",
            "/var/log/sesame",
            "/var/log/cumin"
        ])
301552
def process(self):
    
    client = self._get_client_by_hostname(self.host)
    self._await_flow(client, self.flow_id)
    collected_flow_data = self._download_files(client, self.flow_id)
    if collected_flow_data:
      print('{0:s}: Downloaded: {1:s}'.format(
          self.flow_id, collected_flow_data))
      fqdn = client.data.os_info.fqdn.lower()
      self.state.output.append((fqdn, collected_flow_data))
532435
def communicate(self, job_ids = None):
    """"""
    self.lock()
    # iterate over all jobs
    jobs = self.get_jobs(job_ids)
    for job in jobs:
      job.refresh()
      if job.status in ('queued', 'executing', 'waiting') and job.queue_name != 'local':
        status = qstat(job.id, context=self.context)
        if len(status) == 0:
          job.status = 'failure'
          job.result = 70 # ASCII: 'F'
          logger.warn("The job '%s' was not executed successfully (maybe a time-out happened). Please check the log files." % job)
          for array_job in job.array:
            if array_job.status in ('queued', 'executing'):
              array_job.status = 'failure'
              array_job.result = 70 # ASCII: 'F'


    self.session.commit()
    self.unlock()
944069
def cli(obj, ids, query, filters, attributes):
    """"""
    client = obj['client']
    if ids:
        total = len(ids)
    else:
        if query:
            query = [('q', query)]
        else:
            query = build_query(filters)
        total, _, _ = client.get_count(query)
        ids = [a.id for a in client.get_alerts(query)]

    with click.progressbar(ids, label='Updating {} alerts'.format(total)) as bar:
        for id in bar:
            client.update_attributes(id, dict(a.split('=') for a in attributes))
297101
def collect(self):
        
        if not psutil:
            self.log.error('Unable to import psutil')
            self.log.error('No process resource metrics retrieved')
            return None

        for process in psutil.process_iter():
            self.collect_process_info(process)

        # publish results
        for pg_name, counters in self.processes_info.iteritems():
            if counters:
                metrics = (
                    ("%s.%s" % (pg_name, key), value)
                    for key, value in counters.iteritems())
            else:
                if self.processes[pg_name]['count_workers']:
                    metrics = (('%s.workers_count' % pg_name, 0), )
                else:
                    metrics = ()

            [self.publish(*metric) for metric in metrics]
            # reinitialize process info
            self.processes_info[pg_name] = {}
122791
def get_query(self, q, request):
        
        return Project.objects.filter(
            Q(pid__icontains=q)
            | Q(name__icontains=q)
        )
1299374
def query(self,
              startTime=None,
              endTime=None,
              sinceServerStart=False,
              level="WARNING",
              services="*",
              machines="*",
              server="*",
              codes=[],
              processIds=[],
              export=False,
              exportType="CSV", #CSV or TAB
              out_path=None
              ):
        
        allowed_levels = ("SEVERE", "WARNING", "INFO",
                          "FINE", "VERBOSE", "DEBUG")
        qFilter = {
            "services": "*",
            "machines": "*",
            "server" : "*"
        }
        if len(processIds) > 0:
            qFilter['processIds'] = processIds
        if len(codes) > 0:
            qFilter['codes'] = codes
        params = {
            "f" : "json",
            "sinceServerStart" : sinceServerStart,
            "pageSize" : 10000
        }
        if startTime is not None and \
           isinstance(startTime, datetime):
            params['startTime'] = startTime.strftime("%Y-%m-%dT%H:%M:%S")
        if endTime is not None and \
           isinstance(endTime, datetime):
            params['endTime'] = endTime.strftime("%Y-%m-%dT%H:%M:%S")
        if level.upper() in allowed_levels:
            params['level'] = level
        if server != "*":
            qFilter['server'] = server.split(',')
        if services != "*":
            qFilter['services'] = services.split(',')
        if machines != "*":
            qFilter['machines'] = machines.split(",")
        params['filter'] = qFilter
        if export == True and \
           out_path is not None:
            messages = self._post(self._url + "/query", params,
                                     securityHandler=self._securityHandler,
                                     proxy_url=self._proxy_url,
                                     proxy_port=self._proxy_port)

            with open(name=out_path, mode='wb') as f:
                hasKeys = False
                if exportType == "TAB":
                    csvwriter = csv.writer(f, delimiter='\t')
                else:
                    csvwriter = csv.writer(f)
                for message in messages['logMessages']:
                    if hasKeys == False:
                        csvwriter.writerow(message.keys())
                        hasKeys = True
                    csvwriter.writerow(message.values())
                    del message
            del messages
            return out_path
        else:
            return self._post(self._url + "/query", params,
                                 securityHandler=self._securityHandler,
                                 proxy_url=self._proxy_url,
                                 proxy_port=self._proxy_port)
515535
def get_isob_quant_data(pquant, header, fnid, featmap, featcol, qmap):
    """"""
    feat_dbid = featmap[pquant[header[featcol]]]
    for channel_name, (channel_id, psmfield) in qmap[fnid].items():
        if psmfield is None:
            yield (feat_dbid, channel_id, pquant[channel_name])
        else:
            yield (feat_dbid, channel_id, pquant[channel_name],
                   pquant[psmfield])
905276
def process_raw_data(cls, raw_data):
        """"""
        properties = raw_data.get("properties", {})

        vip_ip_pools = []
        for raw_content in properties.get("vipIpPools", []):
            resource = Resource.from_raw_data(raw_content)
            vip_ip_pools.append(resource)
        properties["vipIpPools"] = vip_ip_pools

        return super(LoadBalancerManager, cls).process_raw_data(raw_data)
1291834
function setupReqCounter() {

    reqCounter = reqCounter || new ReqCounter();

    process.monitor.getRequestCount = function () {
        return reqCounter._requests;
    };

    process.monitor.getTotalRequestCount = function () {
        return reqCounter._totalRequests;
    };

    process.monitor.getTransferred = function () {
        return reqCounter._transferred;
    };

    process.monitor.getOpenConnections = function () {
        return reqCounter._connections;
    };
}
1046389
def data(self, index, role=Qt.DisplayRole):
        """"""
        if not index.isValid() or not 0 <= index.row() < len(self._rows):
            return to_qvariant()
        row = index.row()
        column = index.column()

        name, state = self.row(row)

        if role == Qt.DisplayRole or role == Qt.EditRole:
            if column == 0:
                return to_qvariant(name)
        elif role == Qt.CheckStateRole:
            if column == 0:
                if state:
                    return Qt.Checked
                else:
                    return Qt.Unchecked
            if column == 1:
                return to_qvariant(state)
        return to_qvariant()
927362
def Parse(self):
    """"""
    for data in self.Query(self.EVENTS_QUERY):
      (timestamp, agent_bundle_identifier, agent_name, url, sender,
       sender_address, type_number, title, referrer, referrer_alias) = data
      yield [
          timestamp, "OSX_QUARANTINE", url, referrer, title, agent_name,
          agent_bundle_identifier, sender, sender_address, type_number,
          referrer_alias
      ]
884698
def _collect_stats(
        self,
        key,
        db,
        instance_tags,
        relations,
        custom_metrics,
        collect_function_metrics,
        collect_count_metrics,
        collect_activity_metrics,
        collect_database_size_metrics,
        collect_default_db,
        interface_error,
        programming_error,
    ):
        

        db_instance_metrics = self._get_instance_metrics(key, db, collect_database_size_metrics, collect_default_db)
        bgw_instance_metrics = self._get_bgw_metrics(key, db)
        archiver_instance_metrics = self._get_archiver_metrics(key, db)

        metric_scope = [self.CONNECTION_METRICS, self.LOCK_METRICS]

        if collect_function_metrics:
            metric_scope.append(self.FUNCTION_METRICS)
        if collect_count_metrics:
            metric_scope.append(self.COUNT_METRICS)

        # Do we need relation-specific metrics?
        relations_config = {}
        if relations:
            metric_scope += [self.REL_METRICS, self.IDX_METRICS, self.SIZE_METRICS, self.STATIO_METRICS]
            relations_config = self._build_relations_config(relations)

        replication_metrics = self._get_replication_metrics(key, db)
        if replication_metrics is not None:
            # FIXME: constants shouldn't be modified
            self.REPLICATION_METRICS['metrics'] = replication_metrics
            metric_scope.append(self.REPLICATION_METRICS)

        try:
            cursor = db.cursor()
            results_len = self._query_scope(
                cursor, db_instance_metrics, key, db, instance_tags, False, programming_error, relations_config
            )
            if results_len is not None:
                self.gauge(
                    "postgresql.db.count", results_len, tags=[t for t in instance_tags if not t.startswith("db:")]
                )

            self._query_scope(
                cursor, bgw_instance_metrics, key, db, instance_tags, False, programming_error, relations_config
            )
            self._query_scope(
                cursor, archiver_instance_metrics, key, db, instance_tags, False, programming_error, relations_config
            )

            if collect_activity_metrics:
                activity_metrics = self._get_activity_metrics(key, db)
                self._query_scope(
                    cursor, activity_metrics, key, db, instance_tags, False, programming_error, relations_config
                )

            for scope in list(metric_scope) + custom_metrics:
                self._query_scope(
                    cursor, scope, key, db, instance_tags, scope in custom_metrics, programming_error, relations_config
                )

            cursor.close()
        except (interface_error, socket.error) as e:
            self.log.error("Connection error: %s" % str(e))
            raise ShouldRestartException
1257933
def run(self):
        """"""
        while True:
            data = self.queue.get()
            if data is None:
                Logger.get_logger(__name__).info("Stopping collector process ...")
                break

            # updating the report data
            self.store.update(data)
            # writing the report
            generate(self.store, 'html', os.getcwd())
575994
def queue(self):
        """"""
        with self.connection_pool.acquire(block=True) as conn:
            return Q(
                self.routing_key,
                exchange=self.exchange,
                routing_key=self.routing_key
            )(conn)
920475
@Override
  public final void process(final Map<String, Object> pRqVs,
    final IRequestData pRqDt) throws Exception {
    pRqDt.setAttribute("catalogs", lazyRetrieveCatalogs(pRqVs));
    TradingSettings ts = (TradingSettings)
      pRqVs.get("tradSet");
    String catalogIdStr = pRqDt.getParameter("catalogId");
    Long catId = null;
    if (catalogIdStr != null) {
      catId = Long.valueOf(catalogIdStr);
    }
    if (catId == null && ts.getCatalogOnStart() != null) {
      catId = ts.getCatalogOnStart().getItsId();
    }
    Cart cart = (Cart) pRqDt.getAttribute("cart");
    if (cart == null) {
      cart = this.srvShoppingCart
        .getShoppingCart(pRqVs, pRqDt, false, false);
    }
    AccSettings as = (AccSettings) pRqVs.get("accSet");
    Currency curr = (Currency) pRqVs.get("wscurr");
    List<CurrRate> currRates = (List<CurrRate>) pRqVs.get("currRates");
    BigDecimal cuRt = BigDecimal.ONE;
    for (CurrRate cr: currRates) {
      if (cr.getCurr().getItsId().equals(curr.getItsId())) {
        cuRt = cr.getRate();
        break;
      }
    }
    if (cart != null) {
      if (cart.getTot().compareTo(BigDecimal.ZERO) == 0) {
        pRqDt.setAttribute("cart", null);
      } else {
        if (!cart.getCurr().getItsId().equals(curr.getItsId())) {
          cart.setCurr(curr);
          cart.setExcRt(cuRt);
          this.srvShoppingCart.handleCurrencyChanged(pRqVs, cart, as, ts);
        }
        if (pRqDt.getAttribute("txRules") == null) {
          TaxDestination txRules = this.srvShoppingCart
            .revealTaxRules(pRqVs, cart, as);
          pRqDt.setAttribute("txRules", txRules);
        }
        Map<EShopItemType, Map<Long, CartLn>> cartMap =
          new HashMap<EShopItemType, Map<Long, CartLn>>();
        for (CartLn ci : cart.getItems()) {
          if (!ci.getDisab()) {
            Map<Long, CartLn> typedMap = cartMap.get(ci.getItTyp());
            if (typedMap == null) {
              typedMap = new HashMap<Long, CartLn>();
              cartMap.put(ci.getItTyp(), typedMap);
            }
            typedMap.put(ci.getItId(), ci);
          }
        }
        pRqDt.setAttribute("cartMap", cartMap);
      }
    }
    if (catId != null) {
      // either selected by user catalog or "on start" must be
      // if user additionally selected filters (include set of subcatalogs)
      // then the main (root) catalog ID still present in request
      TradingCatalog tcat = findTradingCatalogById(this.catalogs, catId);
      if (tcat == null) {
        this.logger.warn(pRqVs, PrcWebstorePage.class,
          "Can't find catalog #" + catId);
      } else {
        String ordb = pRqDt.getParameter("ordb");
        pRqDt.setAttribute("ordb", ordb);
        String orderBy = null;
        if (ordb != null) {
          if (ordb.equals("pa")) {
            orderBy = " order by ITSPRICE asc";
          } else if (ordb.equals("pd")) {
            orderBy = " order by ITSPRICE desc";
          }
        }
        FilterInteger filterPrice = revialFilterPrice(tcat,
          pRqVs, pRqDt);
        FilterItems<CatalogGs> filterCatalog = revialFilterCatalog(tcat,
          pRqVs, pRqDt);
        List<SpecificsFilter> filtersSpecifics = revialFiltersSpecifics(tcat,
          pRqVs, pRqDt);
        String whereAdd = revWhePri(filterPrice, cuRt);
        String whereCatalog = revealWhereCatalog(tcat, filterCatalog);
        //TODO StringBuffer
        String queryg = null;
        String querys = null;
        String queryseg = null;
        String queryses = null;
        if (ts.getUseAdvancedI18n()) {
          String lang = (String) pRqVs.get("lang");
          String langDef = (String) pRqVs.get("langDef");
          if (!lang.equals(langDef)) {
            if (tcat.getCatalog().getHasGoods()) {
              queryg = lazyGetQuItInLstCaIn().replace(":ITTYP", "0")
    .replace(":TITCAT", "GOODSCATALOG").replace(":CATALOGFILTER", whereCatalog)
  .replace(":WHEREADD", whereAdd).replace(":LANG", lang);
            }
            if (tcat.getCatalog().getHasServices()) {
              querys = lazyGetQuItInLstCaIn().replace(":ITTYP", "1")
  .replace(":TITCAT", "SERVICECATALOG").replace(":CATALOGFILTER", whereCatalog)
.replace(":WHEREADD", whereAdd).replace(":LANG", lang);
            }
            if (tcat.getCatalog().getHasSeGoods()) {
              queryseg = lazyGetQuItInLstCaIn().replace(":ITTYP", "2")
   .replace(":TITCAT", "SEGOODCATALOG").replace(":CATALOGFILTER", whereCatalog)
 .replace(":WHEREADD", whereAdd).replace(":LANG", lang);
            }
            if (tcat.getCatalog().getHasSeServices()) {
              queryses = lazyGetQuItInLstCaIn().replace(":ITTYP", "3")
          .replace(":TITCAT", "SESRCA").replace(":CATALOGFILTER", whereCatalog)
        .replace(":WHEREADD", whereAdd).replace(":LANG", lang);
            }
          }
        }
        if (tcat.getCatalog().getHasGoods() && queryg == null) {
          queryg = lazyGetQuItInLstCa().replace(":ITTYP", "0")
    .replace(":TITCAT", "GOODSCATALOG").replace(":CATALOGFILTER", whereCatalog)
  .replace(":WHEREADD", whereAdd);
        }
        if (tcat.getCatalog().getHasServices() && querys == null) {
          querys = lazyGetQuItInLstCa().replace(":ITTYP", "1")
  .replace(":TITCAT", "SERVICECATALOG").replace(":CATALOGFILTER", whereCatalog)
.replace(":WHEREADD", whereAdd);
        }
        if (tcat.getCatalog().getHasSeGoods() && queryseg == null) {
          queryseg = lazyGetQuItInLstCa().replace(":ITTYP", "2")
   .replace(":TITCAT", "SEGOODCATALOG").replace(":CATALOGFILTER", whereCatalog)
 .replace(":WHEREADD", whereAdd);
        }
        if (tcat.getCatalog().getHasSeServices() && queryses == null) {
          queryses = lazyGetQuItInLstCa().replace(":ITTYP", "3")
       .replace(":TITCAT", "SESRCA").replace(":CATALOGFILTER", whereCatalog)
     .replace(":WHEREADD", whereAdd);
        }
        String querygRc = null;
        if (tcat.getCatalog().getHasGoods()) {
          querygRc = lazyGetQuItInLstCaTo().replace(":ITTYP", "0")
    .replace(":TITCAT", "GOODSCATALOG").replace(":CATALOGFILTER", whereCatalog)
  .replace(":WHEREADD", whereAdd);
        }
        String querysRc = null;
        if (tcat.getCatalog().getHasServices()) {
          querysRc = lazyGetQuItInLstCaTo().replace(":ITTYP", "1")
  .replace(":TITCAT", "SERVICECATALOG").replace(":CATALOGFILTER", whereCatalog)
.replace(":WHEREADD", whereAdd);
        }
        String querysegRc = null;
        if (tcat.getCatalog().getHasSeGoods()) {
          querysegRc = lazyGetQuItInLstCaTo().replace(":ITTYP", "2")
   .replace(":TITCAT", "SEGOODCATALOG").replace(":CATALOGFILTER", whereCatalog)
  .replace(":WHEREADD", whereAdd);
        }
        String querysesRc = null;
        if (tcat.getCatalog().getHasSeServices()) {
          querysesRc = lazyGetQuItInLstCaTo().replace(":ITTYP", "3")
           .replace(":TITCAT", "SESRCA").replace(":CATALOGFILTER", whereCatalog)
            .replace(":WHEREADD", whereAdd);
        }
        boolean isDbgSh = getLogger().getDbgSh(this.getClass())
          && getLogger().getDbgFl() < 13011 && getLogger().getDbgCl() > 13013;
        if (filtersSpecifics != null) {
          if (isDbgSh) {
            getLogger().debug(pRqVs, PrcWebstorePage.class,
              "filters apecifics: size: " + filtersSpecifics.size());
          }
          SpecificsFiltersWhere whereSpec =
            revealWhereSpecifics(filtersSpecifics);
          if (whereSpec != null) {
            if (queryg != null) {
              String querySpec = lazyGetQuItSpFlt()
    .replace(":TITSPEC", "GOODSSPECIFICS").replace(":WHESPITFLR", whereSpec
  .getWhere()).replace(":SPITFLTCO", whereSpec.getWhereCount().toString());
              queryg += querySpec;
              querygRc += querySpec;
            }
            if (querys != null) {
              String querySpec = lazyGetQuItSpFlt()
    .replace(":TITSPEC", "SERVICESPECIFICS").replace(":WHESPITFLR", whereSpec
  .getWhere()).replace(":SPITFLTCO", whereSpec.getWhereCount().toString());
              querys += querySpec;
              querysRc += querySpec;
            }
            if (queryseg != null) {
              String querySpec = lazyGetQuItSpFlt()
    .replace(":TITSPEC", "SEGOODSSPECIFICS").replace(":WHESPITFLR", whereSpec
  .getWhere()).replace(":SPITFLTCO", whereSpec.getWhereCount().toString());
              queryseg += querySpec;
              querysegRc += querySpec;
            }
            if (queryses != null) {
              String querySpec = lazyGetQuItSpFlt()
    .replace(":TITSPEC", "SESERVICESPECIFICS").replace(":WHESPITFLR", whereSpec
  .getWhere()).replace(":SPITFLTCO", whereSpec.getWhereCount().toString());
              queryses += querySpec;
              querysesRc += querySpec;
            }
          }
        }
        if (queryg != null || querys != null || queryseg != null
          || queryses != null) {
          String query = null;
          String queryRc = null;
          if (queryg != null) {
            query = queryg;
            queryRc = querygRc;
          }
          if (querys != null) {
            if (query == null) {
              query = querys;
              queryRc = querysRc;
            } else {
              query += "\n union all \n" + querys;
              queryRc += "\n union all \n" + querysRc;
            }
          }
          if (queryseg != null) {
            if (query == null) {
              query = queryseg;
              queryRc = querysegRc;
            } else {
              query += "\n union all \n" + queryseg;
              queryRc += "\n union all \n" + querysegRc;
            }
          }
          if (queryses != null) {
            if (query == null) {
              query = queryses;
              queryRc = querysesRc;
            } else {
              query += "\n union all \n" + queryses;
              queryRc += "\n union all \n" + querysesRc;
            }
          }
          queryRc = "select count(*) as TOTALROWS from (" + queryRc
            + ") as ALL_TOT";
          if (orderBy != null) {
            query += orderBy;
            queryRc += orderBy;
          }
          queryRc += ";";
          Integer rowCount = this.srvOrm
            .evalRowCountByQuery(pRqVs, ItemInList.class, queryRc);
          Set<String> neededFields = new HashSet<String>();
          neededFields.add("itsType");
          neededFields.add("itemId");
          neededFields.add("itsName");
          neededFields.add("imageUrl");
          neededFields.add("specificInList");
          neededFields.add("itsPrice");
          neededFields.add("previousPrice");
          neededFields.add("availableQuantity");
          neededFields.add("itsRating");
          neededFields.add("detailsMethod");
          pRqVs.put("ItemInListneededFields", neededFields);
          String pageStr = pRqDt.getParameter("page");
          Integer page;
          if (pageStr != null) {
            page = Integer.valueOf(pageStr);
          } else {
            page = 1;
          }
          Integer itemsPerPage = ts.getItemsPerPage();
          int totalPages = this.srvPage.evalPageCount(rowCount, itemsPerPage);
          if (page > totalPages) {
            page = totalPages;
          }
          int firstResult = (page - 1) * itemsPerPage; //0-20,20-40
          List<ItemInList> itemsList = getSrvOrm()
            .retrievePageByQuery(pRqVs, ItemInList.class,
              query, firstResult, itemsPerPage);
          pRqVs.remove("ItemInListneededFields");
          if (ts.getIsUsePriceForCustomer() && cart != null
            && cart.getBuyer().getRegEmail() != null) {
            List<BuyerPriceCategory> buyerPrCats = getSrvOrm()
              .retrieveListWithConditions(pRqVs, BuyerPriceCategory.class,
                "where BUYER=" + cart.getBuyer().getItsId());
            if (buyerPrCats.size() > 1) {
              this.logger.error(pRqVs, PrcWebstorePage.class,
                "Several price category for same buyer! buyer ID="
                  + cart.getBuyer().getItsId());
            throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
                "several_price_category_for_same_buyer");
            }
            if (buyerPrCats.size() == 1) {
              StringBuffer sbg = null;
              StringBuffer sbs = null;
              StringBuffer sbsg = null;
              StringBuffer sbss = null;
              for (ItemInList iil : itemsList) {
                if (iil.getItsType().equals(EShopItemType.GOODS)) {
                  if (sbg == null) {
                    sbg = new StringBuffer();
                    sbg.append("(" + iil.getItemId());
                  } else {
                    sbg.append("," + iil.getItemId());
                  }
                } else if (iil.getItsType().equals(EShopItemType.SERVICE)) {
                  if (sbs == null) {
                    sbs = new StringBuffer();
                    sbs.append("(" + iil.getItemId());
                  } else {
                    sbs.append("," + iil.getItemId());
                  }
                } else if (iil.getItsType().equals(EShopItemType.SEGOODS)) {
                  if (sbsg == null) {
                    sbsg = new StringBuffer();
                    sbsg.append("(" + iil.getItemId());
                  } else {
                    sbsg.append("," + iil.getItemId());
                  }
                } else if (iil.getItsType().equals(EShopItemType.SESERVICE)) {
                  if (sbss == null) {
                    sbss = new StringBuffer();
                    sbss.append("(" + iil.getItemId());
                  } else {
                    sbss.append("," + iil.getItemId());
                  }
                }
              }
              StringBuffer sbq = null;
              if (sbg != null) {
                sbq = new StringBuffer();
                sbq.append(
       "select 0 as ITSVERSION, ITEM, ITSPRICE from PRICEGOODS where ITEM in "
    + sbg + ")");
              }
              if (sbs != null) {
                if (sbq == null) {
                  sbq = new StringBuffer();
                } else {
                  sbq.append("\n union all \n");
                }
                sbq.append(
       "select 1 as ITSVERSION, ITEM, ITSPRICE from SERVICEPRICE where ITEM in "
    + sbs + ")");
              }
              if (sbsg != null) {
                if (sbq == null) {
                  sbq = new StringBuffer();
                } else {
                  sbq.append("\n union all \n");
                }
                sbq.append(
       "select 2 as ITSVERSION, ITEM, ITSPRICE from SEGOODSPRICE where ITEM in "
    + sbsg + ")");
              }
              if (sbss != null) {
                if (sbq == null) {
                  sbq = new StringBuffer();
                } else {
                  sbq.append("\n union all \n");
                }
                sbq.append(
     "select 3 as ITSVERSION, ITEM, ITSPRICE from SESERVICEPRICE where ITEM in "
    + sbss + ")");
              }
              if (sbq != null) {
                sbq.append(";");
                Set<String> ndFlPr = new HashSet<String>();
                ndFlPr.add("item");
                ndFlPr.add("itsPrice");
                ndFlPr.add("itsVersion"); //actually item type!
                pRqVs.put("PriceGoodsneededFields", ndFlPr);
                pRqVs.put("PriceGoodsitemdeepLevel", 1);
             List<PriceGoods> prcs = this.srvOrm.retrieveListByQuery(pRqVs,
                  PriceGoods.class, sbq.toString());
                pRqVs.remove("PriceGoodsneededFields");
                pRqVs.remove("PriceGoodsitemdeepLevel");
                for (PriceGoods pri : prcs) {
                  for (ItemInList iil : itemsList) {
                    long itTyp = iil.getItsType().ordinal();
                    if (iil.getItemId().equals(pri.getItem().getItsId())
                      && itTyp == pri.getItsVersion()) {
                      iil.setItsPrice(pri.getItsPrice());
                      break;
                    }
                  }
                }
              }
            }
          }
          Integer paginationTail = Integer.valueOf(mngUvdSettings
            .getAppSettings().get("paginationTail"));
          List<Page> pages = this.srvPage.evalPages(page, totalPages,
            paginationTail);
          pRqDt.setAttribute("pages", pages);
          pRqDt.setAttribute("itemsList", itemsList);
          pRqDt.setAttribute("totalItems", rowCount);
        }
        if (filterPrice != null) {
          pRqDt.setAttribute("filterPrice", filterPrice);
        }
        if (filterCatalog != null) {
          pRqDt.setAttribute("filterCatalog", filterCatalog);
        }
        if (filtersSpecifics != null) {
          pRqDt.setAttribute("filtersSpecifics", filtersSpecifics);
        }
        pRqDt.setAttribute("catalog", tcat.getCatalog());
      }
    }
  }
445588
def gather_details():
    """"""
    try:
        data = {
            'kernel': platform.uname(),
            'distribution': platform.linux_distribution(),
            'libc': platform.libc_ver(),
            'arch': platform.machine(),
            'python_version': platform.python_version(),
            'os_name': platform.system(),
            'static_hostname': platform.node(),
            'cpu': platform.processor(),
            'fqdn': socket.getfqdn(),
        }
    except AttributeError:
        return {}

    return data