minor fix

This commit is contained in:
Aryan Singh committed 2026-09-13 16:14:49 -05:00
1 parent fd11784744
commit 99ca593c06
2 files changed
+6 -5

No files matched your search

+5 -3
View File
@@ -74,10 +74,11 @@ def grep_all_ips(ips, cmd, if_unit_test):
#main
#if unit test flag exists, then use the test log files instead of the actual log files
cmd = ["grep ", *[arg for arg in sys.argv[1:] if arg != "-t"]]
cmd = ["grep", *[arg for arg in sys.argv[1:] if arg != "-t"]]
#track time
start_time = time.perf_counter()
match_count = grep_all_ips(ALL_IPS, cmd, if_unit_test=[x for x in sys.argv].count("-t") > 0)
is_unit_test = "-t" in sys.argv
match_count = grep_all_ips(ALL_IPS, cmd, if_unit_test=is_unit_test)
end_time = time.perf_counter()
print("=========================== SUMMARY ===========================")
@@ -92,6 +93,7 @@ for i, count in enumerate(match_count):
print(f"machine.{i + 1}.test.log: {count} matches")
else:
print(f"machine.{i + 1}.log: {count} matches")
print(f"Total matches: {max(0, sum(match_count))}")
total_matches = sum(count for count in match_count if count > 0)
print(f"Total matches: {total_matches}")
print("===============================================================")
print(f"Time taken: {end_time - start_time:.2f} seconds")
+1 -2
View File
@@ -59,8 +59,7 @@ while True:
send_message(conn, result.stdout + result.stderr)
except Exception as e:
error_message = f"Error executing command: {e}"
send_message(conn, error_message)
None
finally:
conn.close()