noc.lib.app.reportdatasources.base

Module Contents

noc.lib.app.reportdatasources.base.logger
noc.lib.app.reportdatasources.base.iterator_to_stream(iterator)
Convert an iterator into a stream (None if the iterator is empty).
noc.lib.app.reportdatasources.base.stream_next(stream)
Get (next_value, next_stream) from a stream.
noc.lib.app.reportdatasources.base.merge(iterators)
Make a lazy sorted iterator that merges lazy sorted iterators.
class noc.lib.app.reportdatasources.base.BaseReportColumn(sync_ids=None)

Bases: object

Base report column class. Column is dataseries: ((id1: value1), (id2: value2)) - id - index sorted by asc

MAX_ITERATOR = 500000
name
fields
unknown_value = [None]
builtin_sorted = False
multiple_series = False
safe_next(self)
_extract(self)

Generate list of rows. Each row is a list of fields. (“id1”, “row1”, “row2”, “row3”, …) :return:

extract(self)

Generate list of rows. Each row is a list of fields. First value - is id :return:

__iter__(self)
get_dictionary(self, filter_unknown=False)

return Dictionary id: value :return:

__getitem__(self, item)
class noc.lib.app.reportdatasources.base.LongestIter(it)

Bases: object

c_did = DiscoveryID._get_collection() did = c_did.find({“hostname”: {“$exists”: 1}}, {“object”: 1, “hostname”: 1}).sort(“object”)

# did = DiscoveryID.objects.filter(hostname__exists=True ).order_by(“object”).scalar(“object”, “hostname”).no_cache()

hostname = LongestIter(did)

__getitem__(self, item)
__iter__(self)
class noc.lib.app.reportdatasources.base.ReportModelFilter

Bases: object

Getting statictics info for ManagedObject

decode_re
model
decode(self, formula)

Decode stat formula and return isolated set :param formula: :return: moss: Result Query for Object :return: ids: Result id list for object

proccessed(self, column)

Intersect set for result :param column: comma separated string stat formula. Every next - intersection prev :return: