Verified Commit bde4523f authored by Sebastian Endres's avatar Sebastian Endres
Browse files

Add script to find holes

parent 7307c7aa
#!/usr/bin/env python3
from pathlib import Path
from dateutil.parser import parse as parse_date
from datetime import timedelta
LOGS = Path(__file__).parent / "logs"
ACCEPTABLE_HOLE_SIZE = timedelta(days=1)
def main():
"""docstring for main"""
dates = []
for log_dir in LOGS.iterdir():
if not (log_dir / "result.json").is_file():
print("result.json is missing in", log_dir)
continue
date = parse_date(log_dir.name)
dates.append(date)
holes = []
cur_date = dates[0]
for next_date in dates[1:]:
if cur_date + ACCEPTABLE_HOLE_SIZE < next_date:
holes.append((cur_date, next_date))
cur_date = next_date
for hole_start, hole_end in holes:
print(f"Hole between {hole_start.strftime('%Y-%m-%d %H:%M')} - {hole_end.strftime('%Y-%m-%d %H:%M')}")
if __name__ == '__main__':
main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment