Exemplo n.º 1
0
 def setUp(self):
   get_client_stats_db().remove()
   get_server_stats_db().remove()
   get_result_stats_db().remove()
   self.testInputJSON = \
     {'Metadata': {'client_app_version': '2.0.1',
                   'client_os_version': '4.3'},
      'Readings': {'sync_pull_list_size': [[1411418998701, 1111], [1411418998702, 2222], [1411418998703, 3333]],
                'battery_level': [[1411418998704, 4444], [1411418998705, 5555], [1411418998706, 6666]],
               }}
Exemplo n.º 2
0
 def setUp(self):
     get_client_stats_db().remove()
     get_server_stats_db().remove()
     get_result_stats_db().remove()
     self.testInputJSON = \
       {'Metadata': {'client_app_version': '2.0.1',
                     'client_os_version': '4.3'},
        'Readings': {'sync_pull_list_size': [[1411418998701, 1111], [1411418998702, 2222], [1411418998703, 3333]],
                  'battery_level': [[1411418998704, 4444], [1411418998705, 5555], [1411418998706, 6666]],
                 }}
Exemplo n.º 3
0
 def setUp(self):
     get_client_stats_db().remove()
     get_server_stats_db().remove()
     get_result_stats_db().remove()
     self.testInputJSON = {
         "Metadata": {"client_app_version": "2.0.1", "client_os_version": "4.3"},
         "Readings": {
             "sync_pull_list_size": [[1411418998701, 1111], [1411418998702, 2222], [1411418998703, 3333]],
             "battery_level": [[1411418998704, 4444], [1411418998705, 5555], [1411418998706, 6666]],
         },
     }
Exemplo n.º 4
0
def storeResultEntry(user, key, ts, reading):
  logging.debug("storing result entry %s for user %s, key %s at timestamp %s" % (reading, user, key, ts))
  response = None

  # Sometimes timestamp comes in as a float, represented as seconds.[somethign else]; truncate digits after the
  # decimal
  ts = int(ts)
  currEntry = createEntry(user, key, ts, reading)

  try:
    response = get_result_stats_db().insert(currEntry)
  except Exception as e:
    logging.debug("failed to store result entry %s for user %s, key %s at timestamp %s" % (reading, user, key, ts))
    logging.debug("exception was: %s" % (e))
    get_result_stats_db_backup().insert(currEntry)

  # Return boolean that tells you whether the insertion was successful or not
  return response != None
Exemplo n.º 5
0
def storeResultEntry(user, key, ts, reading):
  logging.debug("storing result entry %s for user %s, key %s at timestamp %s" % (reading, user, key, ts))
  response = None

  # Sometimes timestamp comes in as a float, represented as seconds.[somethign else]; truncate digits after the
  # decimal
  ts = int(ts)
  currEntry = createEntry(user, key, ts, reading)

  try:
    response = get_result_stats_db().insert(currEntry)
  except Exception as e:
    logging.debug("failed to store result entry %s for user %s, key %s at timestamp %s" % (reading, user, key, ts))
    logging.debug("exception was: %s" % (e))
    get_result_stats_db_backup().insert(currEntry)

  # Return boolean that tells you whether the insertion was successful or not
  return response != None
Exemplo n.º 6
0
def storeResultEntry(user, key, ts, reading):
    logging.debug("storing result entry %s for user %s, key %s at timestamp %s" % (reading, user, key, ts))
    currEntry = createEntry(user, key, ts, reading)
    get_result_stats_db().insert(currEntry)