Skip to content

Commit

Permalink
feat(hardware-testing) Automated ABR Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNASC20 committed Sep 26, 2024
1 parent b233606 commit ddb7c59
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions hardware-testing/hardware_testing/scripts/ABRAsairScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,27 @@ def execute(client: pmk.SSHClient, command: str, args: list) -> Optional[int]:
stdin, stdout, stderr = client.exec_command(command, get_pty=True)
stdout_lines: List[str] = []
stderr_lines: List[str] = []
time.sleep(15)

time.sleep(30)
# check stdout, stderr

# Check the exit status of the command.
# while not stdout.channel.exit_status_ready():

This comment has been minimized.

Copy link
@rclarke0

rclarke0 Sep 26, 2024

Contributor

I would remove this commented out portion since it isn't functional

# if stdout.channel.recv_ready():
# stdout_lines = stdout.readlines()
# print(f"{args[0]} output:", "".join(stdout_lines))
# if stderr.channel.recv_ready():
# stderr_lines = stderr.readlines()
# print(f"{args[0]} ERROR:", "".join(stdout_lines))
# return 1
if stderr.channel.recv_ready:
stderr_lines = stderr.readlines()
if stderr_lines != []:
print(f"{args[0]} ERROR: ", stderr_lines)
return 1
if stdout.channel.exit_status_ready():
if stdout.channel.recv_exit_status() != 0:
print(f"{args[0]} command failed:", "".join(stderr_lines))
client.close()
# Terminate process on failure.
raise RuntimeError(
f"{args[0]} encountered an error and the process will terminate."
Expand Down Expand Up @@ -57,9 +70,7 @@ def connect_ssh(ip: str) -> pmk.SSHClient:
robot_ips.append(info[0])
robot_names.append(info[1])

command_template = (
"python3 -m hardware_testing.scripts.abr_asair_sensor {name} {duration} {frequency}"
)
command_template = " nohup python3 -m hardware_testing.scripts.abr_asair_sensor {name} {duration} {frequency}"
cd = "cd /opt/opentrons-robot-server && "
print("Executing Script on All Robots:")

Expand Down Expand Up @@ -89,5 +100,7 @@ def run_command_on_ip(index: int) -> None:
# Wait for all processes to finish.
for process in processes:
process.start()
time.sleep(35)
process.terminate()
time.sleep(20)

for process in processes:
process.join()

0 comments on commit ddb7c59

Please sign in to comment.