Exemplo n.º 1
0
 def _create_probe(self, data):
     """
     Create new ping probe
     """
     self.logger.info("Create probe: %s (%ds)", data["address"], data["interval"])
     ps = ProbeSetting(**data)
     self.probes[data["id"]] = ps
     pt = PeriodicOffsetCallback(functools.partial(self.ping_check, ps), ps.interval * 1000)
     ps.task = pt
     pt.start()
     metrics["ping_probe_create"] += 1
     metrics["ping_objects"] = len(self.probes)
Exemplo n.º 2
0
 async def get_pool_partitions(self, pool: str) -> int:
     parts = self.pool_partitions.get(pool)
     if not parts:
         parts = await self.get_stream_partitions(
             ProbeSetting.get_pool_stream(pool))
         self.pool_partitions[pool] = parts
     return parts