Пример #1
0
 def _proxy_start_active_mode(self):
     if self.link:
         try:
             if self._proxy_sid is None: #have not started subscription service yet
                 if self.proxy_direction == GET_ONLY:
                     self._proxy_active_source = self._proxy_linked_node()
                     if self._proxy_active_source is None:
                         raise ENotStarted()
                     self._proxy_active_destination = self
                 else: #SET_ONLY
                     self._proxy_active_source = self
                     self._proxy_active_destination = self._proxy_linked_node()
                     if self._proxy_active_destination is None:
                         raise ENotStarted()
                 self._proxy_active_queue = Queue()
                 self._proxy_sid = SM.create_delivered(self, {1:self._proxy_active_source})
                 if self.debug: print 'Active proxy %s started successfully' % (self.name)
         except:
             #it didn't work.  Setup schedule to try again in x seconds.  
             if self._retry_win_high < 90:
                 self._retry_win_high += 1
             retry_in = randint(int(self._retry_win_high * .66), self._retry_win_high)
             scheduler.seconds_from_now_do(retry_in, self._proxy_start_active_mode)
             #raise  #took this out since it mostly just served to force the scheduler tread to restart
             if self.debug: msglog.exception()
Пример #2
0
 def _setup_trigger(self):
     try:
         self._sid = SM.create_delivered(self, {1:as_node(self.trigger)})
     except ENotStarted, ENoSuchNode:
         msg = 'TriggeredExporter trigger: %s does not exist - could be nascent' % self._trigger
         msglog.log('broadway',msglog.types.WARN,msg)
         scheduler.seconds_from_now_do(60, self._setup_trigger)
Пример #3
0
 def start(self):
     Column.start(self)
     if (type(self.__function_config) == types.StringType
             and string.count(self.__function_config, 'as_node') == 1
             and self.__function_config.endswith('get')):
         func = self.__function_config
         self.__node = as_node(func[func.find('(') + 2:func.rfind(')') - 1])
         if self.use_subscription_manager:
             self._sid = SM.create_delivered(self,
                                             {1: as_node_url(self.__node)})
             self.function = self.get_last
         else:
             self.function = getattr(self.__node,
                                     func[func.rfind('.') + 1:])
     rexec = self.parent.parent.get_environment()
     self.original_function = RFunction(self.function,
                                        args=self.args,
                                        context=self.context,
                                        rexec=rexec)
     self.function = self._convert
     self.variables = {}
     nodes = self.children_nodes()
     for potential_calculator in nodes:
         if hasattr(potential_calculator, 'evaluate'):
             if self._calculator:  #oops
                 raise EAttributeError('Too many calculator nodes', self)
             self._calculator = potential_calculator
             self.function = self._evaluate  # hook the calculator in
     self.__original_function = self.original_function
     self.original_function = self.__evaluate_original_function
     self.__started = 1
Пример #4
0
 def _proxy_start_active_mode(self):
     if self.link:
         try:
             if self._proxy_sid is None:  #have not started subscription service yet
                 if self.proxy_direction == GET_ONLY:
                     self._proxy_active_source = self._proxy_linked_node()
                     if self._proxy_active_source is None:
                         raise ENotStarted()
                     self._proxy_active_destination = self
                 else:  #SET_ONLY
                     self._proxy_active_source = self
                     self._proxy_active_destination = self._proxy_linked_node(
                     )
                     if self._proxy_active_destination is None:
                         raise ENotStarted()
                 self._proxy_active_queue = Queue()
                 self._proxy_sid = SM.create_delivered(
                     self, {1: self._proxy_active_source})
                 if self.debug:
                     print 'Active proxy %s started successfully' % (
                         self.name)
         except:
             #it didn't work.  Setup schedule to try again in x seconds.
             if self._retry_win_high < 90:
                 self._retry_win_high += 1
             retry_in = randint(int(self._retry_win_high * .66),
                                self._retry_win_high)
             scheduler.seconds_from_now_do(retry_in,
                                           self._proxy_start_active_mode)
             #raise  #took this out since it mostly just served to force the scheduler tread to restart
             if self.debug: msglog.exception()
Пример #5
0
 def start(self):
     Column.start(self)
     if (type(self.__function_config) == types.StringType and 
         string.count(self.__function_config,'as_node') == 1 and 
         self.__function_config.endswith('get')):
         func = self.__function_config
         self.__node = as_node(func[func.find('(')+2:func.rfind(')')-1])
         if self.use_subscription_manager:
             self._sid = SM.create_delivered(self, {1:as_node_url(self.__node)})
             self.function = self.get_last
         else:
             self.function = getattr(self.__node,func[func.rfind('.')+1:])
     rexec = self.parent.parent.get_environment()
     self.original_function = RFunction(self.function, args=self.args,
                                        context=self.context,
                                        rexec=rexec)
     self.function = self._convert
     self.variables = {}
     nodes = self.children_nodes()
     for potential_calculator in nodes:
         if hasattr(potential_calculator, 'evaluate'):
             if self._calculator: #oops
                 raise EAttributeError('Too many calculator nodes', self)
             self._calculator = potential_calculator
             self.function = self._evaluate # hook the calculator in
     self.__original_function = self.original_function
     self.original_function = self.__evaluate_original_function
     self.__started = 1
Пример #6
0
 def _setup_trigger(self):
     try:
         self._sid = SM.create_delivered(self, {1: as_node(self.trigger)})
     except ENotStarted, ENoSuchNode:
         msg = 'TriggeredExporter trigger: %s does not exist - could be nascent' % self._trigger
         msglog.log('broadway', msglog.types.WARN, msg)
         scheduler.seconds_from_now_do(60, self._setup_trigger)