def __init__(self, poller=None, step=300):
     """
     """
     if poller is None:
         raise RuntimeError('poller cannot be None')
     if not issubclass(type(poller), IPoll):
         raise TypeError('poller privided is not a subclass of IPoll')
     self._poller = poller
     TimerService.__init__(self, step=step, callable=self._poller.poll)
Exemplo n.º 2
0
 def __init__(self, poller=None, step=60*5):
     """ The magic here is calling the TimerService constructor (old
         style class) to set the polling interval and specify the polling
         function.
     """
     if poller is None:
         raise RuntimeError('poller cannot be None')
     if not issubclass(type(poller), IPoll):
         raise TypeError('poller provided is not a subclass of IPoll');
     self._poller = poller
     TimerService.__init__(self, step=step, callable=self._poller.poll)
Exemplo n.º 3
0
 def __init__(self, all_stations, base_config, base_dir, poll_length, file_pattern,
              send_command, command_helper, complete_command, failed_command):
     TimerService.__init__(self, poll_length, self.run_poll)
     self.log = log
     self.all_stations = all_stations
     self.base_config = dict(base_config)
     self.base_folder = base_dir
     self.file_pattern = file_pattern
     self.send_command = send_command
     self.complete_command = complete_command
     self.failed_command = failed_command
     self.command_helper = command_helper
Exemplo n.º 4
0
 def __init__(self, reactor, interval, k8s, namespace, router):
     TimerService.__init__(
         self,
         interval,
         divert_errors_to_log(self._check_once, u"router-update"),
         k8s,
         namespace,
     )
     # This attribute controls the the reactor used by TimerService to set
     # up the LoopingCall.
     self.clock = reactor
     self._router = router
Exemplo n.º 5
0
 def __init__(self, reactor, interval, k8s, namespace, router):
     TimerService.__init__(
         self,
         interval,
         divert_errors_to_log(self._check_once, u"router-update"),
         k8s,
         namespace,
     )
     # This attribute controls the the reactor used by TimerService to set
     # up the LoopingCall.
     self.clock = reactor
     self._router = router
Exemplo n.º 6
0
    def __init__(self, batchsize, interval, slv_client, clock=None):
        """
        Initializes the scheduler service with batch size and interval

        :param int batchsize: number of events to fetch on each iteration
        :param int interval: time between each iteration
        :param slv_client: a :class:`silverberg.client.CQLClient` or
                    :class:`silverberg.cluster.RoundRobinCassandraCluster` instance used to get lock
        :param clock: An instance of IReactorTime provider that defaults to reactor if not provided
        """
        from otter.models.cass import LOCK_TABLE_NAME
        self.lock = BasicLock(slv_client, LOCK_TABLE_NAME, 'schedule', max_retry=0)
        TimerService.__init__(self, interval, self.check_for_events, batchsize)
        self.clock = clock
        self.log = otter_log.bind(system='otter.scheduler')
Exemplo n.º 7
0
    def __init__(self, batchsize, interval, store, kz_client,
                 zk_partition_path, time_boundary, buckets, clock=None, threshold=60):
        """
        Initialize the scheduler service

        :param int batchsize: number of events to fetch on each iteration
        :param int interval: time between each iteration
        :param kz_client: `TxKazooClient` instance
        :param buckets: an iterable containing the buckets which contains scheduled events
        :param zk_partition_path: Partiton path used by kz_client to partition the buckets
        :param time_boundary: Time to wait for partition to become stable
        :param clock: An instance of IReactorTime provider that defaults to reactor if not provided
        """
        TimerService.__init__(self, interval, self.check_events, batchsize)
        self.store = store
        self.clock = clock
        self.kz_client = kz_client
        self.buckets = buckets
        self.zk_partition_path = zk_partition_path
        self.time_boundary = time_boundary
        self.kz_partition = None
        self.threshold = threshold
        self.log = otter_log.bind(system='otter.scheduler')
Exemplo n.º 8
0
 def __init__(self, log_path, interval=1):
     self.log_file = None
     self.log_path = log_path
     TimerService.__init__(self, interval, self.do_watch)
Exemplo n.º 9
0
 def __init__(self, dispatcher):
     TimerService.__init__(self, 60, self.pruneJobs)
     self.dispatcher = dispatcher
Exemplo n.º 10
0
	def __init__( self, metricProvider ):
		TimerService.__init__( self, metricProvider.getInterval( ), self.processMetrics )
		self.metricProvider = metricProvider
Exemplo n.º 11
0
 def __init__(self):
     TimerService.__init__(self, 60 * 60, self._report)
Exemplo n.º 12
0
    def __init__(self, step, db, cmd):
        TimerService.__init__(self, step, self.ping)

        self.db = db
        self.cmd = cmd
Exemplo n.º 13
0
 def __init__(self, log_path, interval=1):
     self.log_file = None
     self.log_path = log_path
     TimerService.__init__(self, interval, self.do_watch)
Exemplo n.º 14
0
 def __init__(self, interval, api):
     TimerService.__init__(self, interval, api.run_scripts)
Exemplo n.º 15
0
 def __init__(self, launcher, interval=5):
     self.launcher = launcher
     TimerService.__init__(self, interval, self.heartbeat)
     self.sent_hello = False
     self.netlink = netlink.RoutingNetlink()
Exemplo n.º 16
0
 def __init__(self, announce_protocol):
     self.protocol = announce_protocol
     TimerService.__init__(self, MULTICAST_ANNOUNCE_INTVL, self.announceAndPrune)
Exemplo n.º 17
0
 def __init__(self):
     TimerService.__init__(self, 60 * 60, self._report)
Exemplo n.º 18
0
 def __init__(self, dispatcher):
     TimerService.__init__(self, 5, self.checkWorkers)
     self.dispatcher = dispatcher