Ejemplo n.º 1
0
  def after_update(self):
    if not (self.event_pull_fields and hasattr(self, 'uid')):
      return

    pull_data = {}
    for field in self.event_pull_fields:
      value = getattr(self, field, '')
      pull_data.update({field: value})

    pull_data.update({'datetime': self.datetime,
                      'event_name': self.collection_name
                    })
    u = UserEventFalls(uid=self.uid, **pull_data)
    u.record()
Ejemplo n.º 2
0
def show_all():
  def print_title(title):
    print("########%s#########" %title)

  register_events_collection = RegisteredEvents.get_collection()
  print_title("注册事件")
  for i in register_events_collection.find():
    print(i)

  user_hash_collection = UserHashTable.get_collection()
  print_title("用户hash表")
  for i in user_hash_collection.find():
   print(i)

  user_events_fall_collection = UserEventFalls.get_collection()
  print_title("用户事件流")
  for i in user_events_fall_collection.find():
    print(i)

  print_title("统计事件")
  for cluster in register_events_collection.find():
    cls_info = cluster
    format_data = RegisteredEvents.format_data(cls_info)
    event_handle = EventFactory.produce(format_data)
    collection = event_handle.get_collection()
    for i in collection.find():
      print(i)
Ejemplo n.º 3
0
def clear_all():
  def print_title(title):
    print("########%s#########" %title)

  register_events_collection = RegisteredEvents.get_collection()
  print_title("删除统计事件")
  for cluster in register_events_collection.find():
    cls_info = cluster
    format_data = RegisteredEvents.format_data(cls_info)
    event_handle = EventFactory.produce(format_data)
    event_handle.delete_all()

  print_title("删除用户事件流")
  UserEventFalls.delete_all()

  print_title("删除用户hash表")
  UserHashTable.delete_all()

  print_title("删除注册事件")
  RegisteredEvents.delete_all()