Loading cloudcontrol/common/tql/db/tag.py +16 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ class StaticTag(BaseTag): super(StaticTag, self).__init__(name, **kwargs) self._value = value def __repr__(self): return '<%s %s (value=%r)>' % (self.__class__.__name__, self.name, self.value) # # Implentation of StaticTagInterface: # Loading Loading @@ -101,6 +104,19 @@ class CallbackTag(BaseTag, StaticTagInterface): self._cache_value = '' self._cache_last_update = None def __repr__(self): if self._cache_last_update is not None and self._ttl is not None: dt = self.ttl - (datetime.now() - self._cache_last_update) expire = (dt.microseconds + (dt.seconds + dt.days * 24 * 3600) * 10**6) / 10.0**6 else: expire = None return '<%s %s (ttl=%r expire=%r cached=%r cb=%r)>' % (self.__class__.__name__, self.name, self._ttl, expire, self._cache_value, self._callback.__name__) # # Implentation of StaticTagInterface: # Loading Loading
cloudcontrol/common/tql/db/tag.py +16 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ class StaticTag(BaseTag): super(StaticTag, self).__init__(name, **kwargs) self._value = value def __repr__(self): return '<%s %s (value=%r)>' % (self.__class__.__name__, self.name, self.value) # # Implentation of StaticTagInterface: # Loading Loading @@ -101,6 +104,19 @@ class CallbackTag(BaseTag, StaticTagInterface): self._cache_value = '' self._cache_last_update = None def __repr__(self): if self._cache_last_update is not None and self._ttl is not None: dt = self.ttl - (datetime.now() - self._cache_last_update) expire = (dt.microseconds + (dt.seconds + dt.days * 24 * 3600) * 10**6) / 10.0**6 else: expire = None return '<%s %s (ttl=%r expire=%r cached=%r cb=%r)>' % (self.__class__.__name__, self.name, self._ttl, expire, self._cache_value, self._callback.__name__) # # Implentation of StaticTagInterface: # Loading