Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(abr-testing): unify all script compatibility with same ip file #16922

Merged
merged 7 commits into from
Nov 21, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ def run(
ip_json_file = os.path.join(storage_directory, "IPs.json")
try:
ip_file = json.load(open(ip_json_file))
robot_dict = ip_file.get("ip_address_list")
except FileNotFoundError:
print(f"Add .json file with robot IPs to: {storage_directory}.")
sys.exit()
Expand All @@ -294,7 +295,7 @@ def run(
ip_or_all = input("IP Address or ALL: ")
calibration_data = []
if ip_or_all.upper() == "ALL":
ip_address_list = ip_file["ip_address_list"]
ip_address_list = list(robot_dict.keys())
for ip in ip_address_list:
saved_file_path, calibration = read_robot_logs.get_calibration_offsets(
ip, storage_directory
Expand Down
3 changes: 2 additions & 1 deletion abr-testing/abr_testing/data_collection/get_run_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ def get_all_run_logs(
ip_json_file = os.path.join(storage_directory, "IPs.json")
try:
ip_file = json.load(open(ip_json_file))
robot_dict = ip_file.get("ip_address_list")
except FileNotFoundError:
print(f"Add .json file with robot IPs to: {storage_directory}.")
sys.exit()
ip_address_list = ip_file["ip_address_list"]
ip_address_list = list(robot_dict.keys())
runs_from_storage = read_robot_logs.get_run_ids_from_google_drive(google_drive)
for ip in ip_address_list:
runs = get_run_ids_from_robot(ip)
Expand Down
12 changes: 5 additions & 7 deletions hardware-testing/hardware_testing/scripts/ABRAsairScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
import paramiko as pmk
import time
import json
import multiprocessing
from typing import Optional, List, Any

Expand Down Expand Up @@ -69,11 +70,10 @@ def run(file_name: str) -> List[Any]:
robot_ips = []
robot_names = []
with open(file_name) as file:
for line in file.readlines():
info = line.split(",")
if "Y" in info[2]:
robot_ips.append(info[0])
robot_names.append(info[1])
file_dict = json.load(file)
robot_dict = file_dict.get("ip_address_list")
robot_ips = list(robot_dict.keys())
robot_names = list(robot_dict.values())
print("Executing Script on All Robots:")
# Launch the processes for each robot.
processes = []
Expand All @@ -89,10 +89,8 @@ def run(file_name: str) -> List[Any]:
# Wait for all processes to finish.
file_name = sys.argv[1]
processes = run(file_name)

for process in processes:
process.start()
time.sleep(20)

for process in processes:
process.join()
Loading