Ejemplo n.º 1
0
 def _check_for_files(self):
     filenames = glob.glob(self._path)
     # files, but no change since last time
     if self._last_filename and filenames and filenames[-1]==self._last_filename:
         return None
     # no files yet, just like last time
     if not self._last_filename and not filenames:
         return None
     if self._last_filename:
         position = filenames.index(self._last_filename) # raises ValueError if file was removed
         out = filenames[position+1:]
     else:
         out = filenames
     self._last_filename = filenames[-1]
     log.trace('found files: %r', out)
     return out
Ejemplo n.º 2
0
 def _check_for_files(self):
     filenames = glob.glob(self._path)
     # files, but no change since last time
     if self._last_filename and filenames and filenames[
             -1] == self._last_filename:
         return None
     # no files yet, just like last time
     if not self._last_filename and not filenames:
         return None
     if self._last_filename:
         position = filenames.index(
             self._last_filename)  # raises ValueError if file was removed
         out = filenames[position + 1:]
     else:
         out = filenames
     self._last_filename = filenames[-1]
     log.trace('found files: %r', out)
     return out
Ejemplo n.º 3
0
 def _receive_event(self, event, headers):
     with self.lock:
         if not isinstance(event, ContainerManagementRequest):
             log.trace('ignoring wrong type event: %r', event)
             return
         if not self.running:
             log.warn('ignoring admin message received after shutdown: %s', event.action)
             return
         predicate = ContainerSelector.from_object(event.predicate)
         if predicate.should_handle(self.container):
             log.trace('handling admin message: %s', event.action)
             self._perform_action(event.action)
         else:
             log.trace('ignoring admin action: %s', event.action)
             if SEND_RESULT_IF_NOT_SELECTED:
                 self.sender.publish_event(origin=self.container.id, action=event.action, outcome='not selected')
                 log.debug('received action: %s, outcome: not selected', event.action)
Ejemplo n.º 4
0
 def _receive_event(self, event, headers):
     with self.lock:
         if not isinstance(event, ContainerManagementRequest):
             log.trace("ignoring wrong type event: %r", event)
             return
         if not self.running:
             log.warn("ignoring admin message received after shutdown: %s", event.action)
             return
         predicate = ContainerSelector.from_object(event.predicate)
         if predicate.should_handle(self.container):
             log.trace("handling admin message: %s", event.action)
             self._perform_action(event.action)
         else:
             log.trace("ignoring admin action: %s", event.action)
             if SEND_RESULT_IF_NOT_SELECTED:
                 self.sender.publish_event(origin=self.container.id, action=event.action, outcome="not selected")
                 log.debug("received action: %s, outcome: not selected", event.action)