Exemple #1
0
 def publish(self, model_or_models):
     if isinstance(model_or_models, QuerySet):
         models = list(model_or_models)
     elif not isinstance(model_or_models, list):
         models = [model_or_models]
     else:
         models = model_or_models
     model = models[0]
     serializer_class = serializers.MAPPING[type(model)]
     msg = json.dumps({
         'type': type(model).__name__,
         'models': serializer_class(models, many=True).data
     })
     self.log.debug('publishing change "%s": %s', msg)
     redis_client.publish('model_changes', msg)
Exemple #2
0
 def publish(self, model_or_models):
     if isinstance(model_or_models, QuerySet):
         models = list(model_or_models)
     elif not isinstance(model_or_models, list):
         models = [model_or_models]
     else:
         models = model_or_models
     model = models[0]
     serializer_class = serializers.MAPPING[type(model)]
     msg = json.dumps({
         'type': type(model).__name__,
         'models': serializer_class(models, many=True).data
     })
     self.log.debug('publishing change "%s": %s', msg)
     redis_client.publish('model_changes', msg)
Exemple #3
0
 def __str__(self):
     return json.dumps(self.data)
Exemple #4
0
 def work(self):
     redis_client.publish('monitoring', json.dumps({'type': 'beacon'}))
Exemple #5
0
 def __str__(self):
     return json.dumps(self.data)
Exemple #6
0
 def work(self):
     redis_client.publish('monitoring', json.dumps({'type': 'beacon'}))