Ejemplo n.º 1
0
 def _validate_start(self, *args, **kwargs):
     # check base class invariants first
     if not self.connection:
         # only if we have connection we can expect some data on it
         # at the latest "just before start" we need connection
         raise NoConnectionProvided(self)
     # ----------------------------------------------------------------------
     # We intentionally do not check if connection is open here.
     # In such case net result anyway will be failed/timeouted observer -
     # - so, user will need to investigate "why".
     # Checking connection state would benefit in early detection of:
     # "error condition - no chance to succeed since connection is closed".
     # However, drawback is a requirement on connection to have is_open() API
     # We choose minimalistic dependency over better troubleshooting support.
     # ----------------------------------------------------------------------
     if self.timeout <= 0.0:
         raise ConnectionObserverTimeout(self, self.timeout, "before run", "timeout is not positive value")
Ejemplo n.º 2
0
 def _validate_start(self, *args, **kwargs):
     # check base class invariants first
     if not self.connection:
         # only if we have connection we can expect some data on it
         # at the latest "just before start" we need connection
         raise NoConnectionProvided(self)