def query(pool): cf_logs = ColumnFamily(pool, CF_LOGS) row_key = ymd_from_epoch() try: cf_logs.get(row_key, column_count=0) except NotFoundException: # FIXME: this is extremely inefficient! row_key = cf_logs.get_range().next()[0] logging.info("-" * 120) # ------------------------------ logging.info("Querying for key %s", row_key) logging.info("-" * 120) # ------------------------------ count = 20 for k, v in cf_logs.get(row_key, column_reversed=True).iteritems(): # @UnusedVariable logging.info(v) count -= 1 if count == 0: break del cf_logs logging.info("-" * 120) # ------------------------------ cf_logs_by_app = ColumnFamily(pool, CF_LOGS_BY_APP) row_key = EXAMPLE_APPS[0] logging.info("Querying for key %s", row_key) logging.info("-" * 120) # ------------------------------ count = 20 for k, v in cf_logs_by_app.get(row_key, column_reversed=True).iteritems(): # @UnusedVariable logging.info(v) count -= 1 if count == 0: break del cf_logs_by_app logging.info("-" * 120) # ------------------------------ cf_logs_by_host = ColumnFamily(pool, CF_LOGS_BY_HOST) row_key = EXAMPLE_HOSTS[0] logging.info("Querying for key %s", row_key) logging.info("-" * 120) # ------------------------------ count = 20 for k, v in cf_logs_by_host.get(row_key, column_reversed=True).iteritems(): # @UnusedVariable logging.info(v) count -= 1 if count == 0: break del cf_logs_by_host logging.info("-" * 120) # ------------------------------ cf_logs_by_severity = ColumnFamily(pool, CF_LOGS_BY_SEVERITY) row_key = "WARN" logging.info("Querying for key %s", row_key) logging.info("-" * 120) # ------------------------------ count = 20 for k, v in cf_logs_by_severity.get(row_key, column_reversed=True).iteritems(): # @UnusedVariable logging.info(v) count -= 1 if count == 0: break del cf_logs_by_severity
def query(pool): cf_logs = ColumnFamily(pool, CF_LOGS) row_key = ymd_from_epoch() try: cf_logs.get(row_key, column_count=0) except NotFoundException: # FIXME: this is extremely inefficient! row_key = cf_logs.get_range().next()[0] logging.info("-" * 120) # ------------------------------ logging.info("Querying for key %s", row_key) logging.info("-" * 120) # ------------------------------ count = 20 for k, v in cf_logs.get(row_key, column_reversed=True).iteritems(): #@UnusedVariable logging.info(v) count -= 1 if count == 0: break del cf_logs logging.info("-" * 120) # ------------------------------ cf_logs_by_app = ColumnFamily(pool, CF_LOGS_BY_APP) row_key = EXAMPLE_APPS[0] logging.info("Querying for key %s", row_key) logging.info("-" * 120) # ------------------------------ count = 20 for k, v in cf_logs_by_app.get(row_key, column_reversed=True).iteritems(): #@UnusedVariable logging.info(v) count -= 1 if count == 0: break del cf_logs_by_app logging.info("-" * 120) # ------------------------------ cf_logs_by_host = ColumnFamily(pool, CF_LOGS_BY_HOST) row_key = EXAMPLE_HOSTS[0] logging.info("Querying for key %s", row_key) logging.info("-" * 120) # ------------------------------ count = 20 for k, v in cf_logs_by_host.get(row_key, column_reversed=True).iteritems(): #@UnusedVariable logging.info(v) count -= 1 if count == 0: break del cf_logs_by_host logging.info("-" * 120) # ------------------------------ cf_logs_by_severity = ColumnFamily(pool, CF_LOGS_BY_SEVERITY) row_key = 'WARN' logging.info("Querying for key %s", row_key) logging.info("-" * 120) # ------------------------------ count = 20 for k, v in cf_logs_by_severity.get(row_key, column_reversed=True).iteritems(): #@UnusedVariable logging.info(v) count -= 1 if count == 0: break del cf_logs_by_severity
def _compute_count(a_range): column_start = convert_time_to_uuid(a_range[0], lowest_val=True) # start_datetime = utc_timestamp2datetime(a_range[0]) column_finish = convert_time_to_uuid(a_range[1], lowest_val=False) # end_datetime = utc_timestamp2datetime(a_range[1]) row_key = ymd_from_epoch(float(a_range[0])) count = self._get_cf_logs().get_count(row_key, column_start=column_start, column_finish=column_finish) return count # to be used by `_json_cache()`
def _compute_count(a_range): column_start = convert_time_to_uuid(a_range[0], lowest_val=True) # start_datetime = utc_timestamp2datetime(a_range[0]) column_finish = convert_time_to_uuid(a_range[1], lowest_val=False) # end_datetime = utc_timestamp2datetime(a_range[1]) row_key = ymd_from_epoch(float(a_range[0])) count = self._get_cf_logs().get_count( row_key, column_start=column_start, column_finish=column_finish) return count # to be used by `_json_cache()`