Example #1
0
 def load(operation_id, logger=None):
     redis = RedisConnector()
     redis_key = FMOperation._get_key(operation_id)
     if redis.exists(redis_key):
         attributes_json = redis.get(redis_key)
         attributes = json.loads(str(attributes_json))
         operation = FMOperation()
         operation.set_attributes(attributes)
         return operation
     else:
         if logger is not None:
             logger.error("Operation with %s not found" % operation_id)
         raise Exception("Operation with %s not found" % operation_id)
Example #2
0
 def load(operation_id, logger=None):
     redis = RedisConnector()
     redis_key = FMOperation._get_key(operation_id)
     if redis.exists(redis_key):
         attributes_json = redis.get(redis_key)
         attributes = json.loads(str(attributes_json))
         operation = FMOperation()
         operation.set_attributes(attributes)
         return operation
     else:
         if logger is not None:
             logger.error("Operation with %s not found" % operation_id)
         raise Exception("Operation with %s not found" % operation_id)
Example #3
0
 def save(self):
     redis = RedisConnector()
     self.updated_at = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
     redis.set(self._get_key(self.id),
               json.dumps(self.as_dict(), ensure_ascii=False))
Example #4
0
 def save(self):
     redis = RedisConnector()
     self.updated_at = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
     redis.set(self._get_key(self.id), json.dumps(self.as_dict(), ensure_ascii=False))