Compare commits

...

2 Commits

Author SHA1 Message Date
Nicholas Hope 8910fe4162 small optimization 2023-01-03 22:14:28 -05:00
Nicholas Hope 5709b160bc ignore binary files 2023-01-03 22:11:33 -05:00
2 changed files with 11 additions and 11 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ sample.log
__pycache__/*
*.pyc
*.cached_ips.pkl
*.gz*

View File

@ -81,9 +81,10 @@ def latlon_distance(p1, p2) -> float:
return c * earth_radius_km
def analyze_server(server: Path, serverip: str) -> None:
def analyze_server(server: Path) -> None:
if not server.is_dir():
return
serverip = get_server_ip(server.name)
result = ''
@ -135,16 +136,14 @@ def main(args: list) -> int:
outfile = 'analysis.csv'
start_dir = Path('.').resolve()
f = open(outfile, 'w')
for logdir in args[1:]:
chdir(logdir)
serverdir = Path('.')
for subdir in serverdir.iterdir():
serverip = get_server_ip(subdir.name)
csv_lines = analyze_server(subdir, serverip)
chdir(start_dir)
f.write(csv_lines)
f.close()
with open(outfile, 'w') as f:
for logdir in args[1:]:
chdir(logdir)
serverdir = Path('.')
for subdir in serverdir.iterdir():
csv_lines = analyze_server(subdir)
f.write(csv_lines)
chdir(start_dir)
return 0