Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Fixed newly introduced bugs in pruning/csv export
Browse files Browse the repository at this point in the history
  • Loading branch information
andybets committed Aug 31, 2019
1 parent a0b8e4e commit 7330fb9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python_aggregator/src/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def submit_resource_usage():
def prune_data():
try:
for key in redis.keys():
if not key in ['last_block', 'last_block_time_seconds']:
if not key in ['last_block', 'last_block_time_seconds', 'last_usage_total_sent']:
if datetime.strptime(key, '%Y-%m-%d') < datetime.utcnow() - timedelta(days=8):
redis.delete(key)
logger.info(f'Deleted old data from DB: {key}')
Expand All @@ -169,7 +169,7 @@ def export_data_to_csv():
try:
records = []
for key in redis.keys():
if not key in ['last_block', 'last_block_time_seconds']:
if not key in ['last_block', 'last_block_time_seconds', 'last_usage_total_sent']:
accounts = list(set([key[:-12] for key in redis.hkeys(key)]))
for account in accounts:
cpu_usage_us = redis.hget(key, f'{account}-cpu-archive')
Expand Down

0 comments on commit 7330fb9

Please sign in to comment.