small optimization
parent
5709b160bc
commit
8910fe4162
21
analyze.py
21
analyze.py
|
@ -81,9 +81,10 @@ def latlon_distance(p1, p2) -> float:
|
||||||
|
|
||||||
return c * earth_radius_km
|
return c * earth_radius_km
|
||||||
|
|
||||||
def analyze_server(server: Path, serverip: str) -> None:
|
def analyze_server(server: Path) -> None:
|
||||||
if not server.is_dir():
|
if not server.is_dir():
|
||||||
return
|
return
|
||||||
|
serverip = get_server_ip(server.name)
|
||||||
|
|
||||||
result = ''
|
result = ''
|
||||||
|
|
||||||
|
@ -135,16 +136,14 @@ def main(args: list) -> int:
|
||||||
outfile = 'analysis.csv'
|
outfile = 'analysis.csv'
|
||||||
start_dir = Path('.').resolve()
|
start_dir = Path('.').resolve()
|
||||||
|
|
||||||
f = open(outfile, 'w')
|
with open(outfile, 'w') as f:
|
||||||
for logdir in args[1:]:
|
for logdir in args[1:]:
|
||||||
chdir(logdir)
|
chdir(logdir)
|
||||||
serverdir = Path('.')
|
serverdir = Path('.')
|
||||||
for subdir in serverdir.iterdir():
|
for subdir in serverdir.iterdir():
|
||||||
serverip = get_server_ip(subdir.name)
|
csv_lines = analyze_server(subdir)
|
||||||
csv_lines = analyze_server(subdir, serverip)
|
f.write(csv_lines)
|
||||||
chdir(start_dir)
|
chdir(start_dir)
|
||||||
f.write(csv_lines)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue