Skip to content

Commit

Permalink
feat(abr-testing): Download weston log during error recording
Browse files Browse the repository at this point in the history
  • Loading branch information
rclarke0 committed Jun 26, 2024
1 parent 1ecc05b commit 5ecf267
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions abr-testing/abr_testing/data_collection/read_robot_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
saved in a local directory.
"""
import csv
import subprocess
from datetime import datetime
import os
from abr_testing.data_collection.error_levels import ERROR_LEVELS_PATH
Expand Down Expand Up @@ -587,4 +588,30 @@ def get_logs(storage_directory: str, ip: str) -> List[str]:
print(f"Request exception. Did not save {log_type}")
continue
all_paths.append(file_path)
# Get weston.log using scp
# Split the path into parts
parts = storage_directory.split(os.sep)
# Find the index of 'Users'
index = parts.index("Users")
user_name = parts[index + 1]
# Define the SCP command
scp_command = [
"scp",
"-r",
"-i",
f"C:\\Users\\{user_name}\\.ssh\\robot_key",
f"root@{ip}:/var/log/weston.log",
storage_directory,
]
# Execute the SCP command
try:
subprocess.run(scp_command, check=True, capture_output=True, text=True)
file_path = os.path.join(storage_directory, "weston.log")
all_paths.append(file_path)
except subprocess.CalledProcessError as e:
print("Error during SCP command execution")
print("Return code:", e.returncode)
print("Output:", e.output)
print("Error output:", e.stderr)
subprocess.run(["scp", "weston.log", "[email protected]:/var/log/weston.log"])
return all_paths

0 comments on commit 5ecf267

Please sign in to comment.