-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow downloading of full logs and restrict to <21 days
- Loading branch information
Showing
4 changed files
with
61 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import datetime, pytz, tzlocal | ||
import os, pickle, sys | ||
|
||
def trim_data(filename, start_timestamp, end_timestamp): | ||
with open(filename, 'rb') as file: | ||
data = pickle.load(file) | ||
return [item for item in data if item['t'] >= start_timestamp and item['t'] <= end_timestamp] | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
if len(sys.argv) != 4: | ||
print('Usage: ./trim_pkl.py [LOGFILE] [EXPERIMENT_START_TIME MM/DD/YYYY] [EXPERIMENT_END_TIME MM/DD/YYYY]') | ||
sys.exit(0) | ||
|
||
experiment_start_time = pytz.timezone(str(tzlocal.get_localzone())).localize(datetime.datetime.strptime(sys.argv[2], '%m/%d/%Y')).astimezone(pytz.utc).timestamp() | ||
experiment_end_time = pytz.timezone(str(tzlocal.get_localzone())).localize(datetime.datetime.strptime(sys.argv[3], '%m/%d/%Y')).astimezone(pytz.utc).timestamp() | ||
trimmed = trim_data(sys.argv[1], experiment_start_time, experiment_end_time) | ||
with open(os.path.join(os.path.dirname(sys.argv[1]), 'trimmed_' + os.path.basename(sys.argv[1])), 'wb') as file: | ||
pickle.dump(trimmed, file, protocol=pickle.HIGHEST_PROTOCOL) | ||
print(trimmed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
setuptools.setup( | ||
name='tottag', | ||
version='1.0.2', | ||
version='1.0.4', | ||
author='Will Hedgecock', | ||
author_email='[email protected]', | ||
description='TotTag Management Dashboard', | ||
|