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

feat(abr-testing): Download Weston log during error recording #15526

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading