示例#1
0
    def run(self):
        start = dt.now()
        print "Started with {} at {:%H:%M:%S}.".format(self.type, start)
        session = store.get_session()
        self._analyze(session)
        session.rollback()

        if self.type is None:
            raise NotImplementedError(
                "The concrete AnalysisTask implementation needs a type information."
            )

        report = self._create_report(session)

        self._write_report(report)
        stop = dt.now()
        seconds = (stop - start).total_seconds()

        report.execution_duration = seconds
        session = store.get_session()
        session.add(report)
        session.commit()

        print "Completed {} at {:%H:%M:%S}. Took {} seconds.".format(
            self.type, stop, seconds)
    def run(self):
        start = dt.now()
        print "Started with {} at {:%H:%M:%S}.".format(self.type, start)
        session = store.get_session()
        self._analyze(session)
        session.rollback()

        if self.type is None:
            raise NotImplementedError("The concrete AnalysisTask implementation needs a type information.")

        report = self._create_report(session)

        self._write_report(report)
        stop = dt.now()
        seconds = (stop - start).total_seconds()

        report.execution_duration = seconds
        session = store.get_session()
        session.add(report)
        session.commit()

        print "Completed {} at {:%H:%M:%S}. Took {} seconds.".format(self.type, stop, seconds)
    def execute(now):
        session = store.get_session()

        topology = NetworkTopology(session, now)
        (node_betweenness, link_betweenness) = gt.betweenness(topology.topology)
        closeness = gt.closeness(topology.topology)

        for v in topology.nodes:
            topology.node_information[v].degree = topology.nodes[v].out_degree()
            topology.node_information[v].closeness = closeness[topology.nodes[v]]
            topology.node_information[v].betweenness = node_betweenness[topology.nodes[v]]

        for l in topology.links:
            topology.link_information[l].betweenness = link_betweenness[topology.links[l]]

        session.commit()
示例#4
0
 def execute(self):
     session = store.get_session()
     self._process(session)
     session.commit()
 def _save_timestamp(self):
     session = store.get_session()
     session.add(store.SampleTimestamp(timestamp=self._started, interval=self._poll_interval))
     session.commit()
 def execute(self):
     session = store.get_session()
     self._process(session)
     session.commit()
 def execute(self, now):
     session = store.get_session()
     self._process(session, now, self._poll_result)
     session.commit()
 def execute(self, now):
     session = store.get_session()
     self._process(session, now, self._poll_result)
     session.commit()