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
|
||||
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue