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): increase number of lines of logs saved during error #15680

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ def get_run_error_info_from_robot(
email = args.email[0]
board_id = args.board_id[0]
reporter_id = args.reporter_id[0]
file_paths = read_robot_logs.get_logs(storage_directory, ip)
ticket = jira_tool.JiraTicket(url, api_token, email)
ticket.issues_on_board(board_id)
users_file_path = ticket.get_jira_users(storage_directory)
Expand Down Expand Up @@ -496,7 +497,6 @@ def get_run_error_info_from_robot(
saved_file_path_calibration, calibration = read_robot_logs.get_calibration_offsets(
ip, storage_directory
)
file_paths = read_robot_logs.get_logs(storage_directory, ip)

print(f"Making ticket for {summary}.")
# TODO: make argument or see if I can get rid of with using board_id.
Expand Down
21 changes: 15 additions & 6 deletions abr-testing/abr_testing/data_collection/read_robot_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,23 +569,32 @@ def get_calibration_offsets(

def get_logs(storage_directory: str, ip: str) -> List[str]:
"""Get Robot logs."""
log_types = ["api.log", "server.log", "serial.log", "touchscreen.log"]
log_types: List[Dict[str, Any]] = [
{"log type": "api.log", "records": 1000},
{"log type": "server.log", "records": 10000},
{"log type": "serial.log", "records": 10000},
{"log type": "touchscreen.log", "records": 1000},
]
all_paths = []
for log_type in log_types:
try:
log_type_name = log_type["log type"]
print(log_type_name)
log_records = int(log_type["records"])
print(log_records)
response = requests.get(
f"http://{ip}:31950/logs/{log_type}",
headers={"log_identifier": log_type},
params={"records": 5000},
f"http://{ip}:31950/logs/{log_type_name}",
headers={"log_identifier": log_type_name},
params={"records": log_records},
)
response.raise_for_status()
log_data = response.text
log_name = ip + "_" + log_type.split(".")[0] + ".log"
log_name = ip + "_" + log_type_name.split(".")[0] + ".log"
file_path = os.path.join(storage_directory, log_name)
with open(file_path, mode="w", encoding="utf-8") as file:
file.write(log_data)
except RuntimeError:
print(f"Request exception. Did not save {log_type}")
print(f"Request exception. Did not save {log_type_name}")
continue
all_paths.append(file_path)
# Get weston.log using scp
Expand Down
Loading