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): Add labels to ABR Jira Tickets #16805

Open
wants to merge 57 commits into
base: edge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
cde88cb
increase google sheet columns
rclarke0 Jul 23, 2024
e534a8f
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Jul 23, 2024
e200e8c
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Jul 24, 2024
022dcb0
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Jul 24, 2024
0cbcd1b
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Jul 25, 2024
9628c49
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Jul 29, 2024
9f2d693
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Jul 30, 2024
728c2e1
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Jul 31, 2024
31d0596
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 1, 2024
2bbcc3e
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 1, 2024
916f496
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 1, 2024
ebf6c72
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 2, 2024
56aa6dd
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 6, 2024
17cadc6
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 7, 2024
378ae28
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 9, 2024
68d6778
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 9, 2024
43fcb8a
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 13, 2024
7ed3f7d
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 13, 2024
7fda077
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 14, 2024
d40b067
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 20, 2024
0f0d482
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 20, 2024
02f92cb
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 22, 2024
a50bb16
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Aug 27, 2024
20a4087
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 3, 2024
3a5d003
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 5, 2024
4b80358
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 5, 2024
7dc9204
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 9, 2024
d7ee6d4
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 10, 2024
c9dfbf6
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 16, 2024
293ba96
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 16, 2024
be60ffb
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 18, 2024
9e2d7a5
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 18, 2024
083f7e3
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 19, 2024
9b5d48b
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 23, 2024
22a4520
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 24, 2024
59779d8
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 26, 2024
f5563f0
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 27, 2024
c950b7b
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Sep 30, 2024
1842099
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 4, 2024
93f45a7
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 7, 2024
d3894d8
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 9, 2024
5704034
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 9, 2024
293803e
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 10, 2024
4c81aec
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 15, 2024
c8a29d0
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 22, 2024
adcd2a9
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 23, 2024
8bfd478
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 23, 2024
a431735
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 23, 2024
6b460db
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 24, 2024
73107de
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 24, 2024
a030bcc
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Oct 25, 2024
77d46de
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Nov 8, 2024
f741379
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Nov 13, 2024
77dc2ea
Merge branch 'edge' of https://github.com/Opentrons/opentrons into edge
rclarke0 Nov 13, 2024
32ce4ee
replace parents with labels
rclarke0 Nov 13, 2024
f2ba138
fix for missing field
rclarke0 Nov 14, 2024
fb479ca
Merge branch 'edge' into abr-jira-fixes
rclarke0 Nov 21, 2024
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
15 changes: 12 additions & 3 deletions abr-testing/abr_testing/automation/jira_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ def open_issue(self, issue_key: str) -> str:
webbrowser.open(url)
return url

def get_labels(self) -> List[str]:
"""Get list of available labels."""
url = f"{self.url}/rest/api/3/label"
response = requests.request("GET", url, headers=self.headers, auth=self.auth)
return response.json()

def create_ticket(
self,
summary: str,
Expand All @@ -118,18 +124,21 @@ def create_ticket(
priority: str,
components: list,
affects_versions: str,
robot: str,
labels: list,
parent_name: str,
) -> Tuple[str, str]:
"""Create ticket."""
# Check if software version is a field on JIRA, if not replaces with existing version
# TODO: automate parent linking
data = {
"fields": {
"project": {"id": "10273", "key": project_key},
"issuetype": {"name": issue_type},
"summary": summary,
"reporter": {"id": reporter_id},
"assignee": {"id": assignee_id},
"parent": {"key": robot},
# "parent": {"key": parent_name},
"labels": labels,
"priority": {"name": priority},
"components": [{"name": component} for component in components],
"description": {
Expand Down Expand Up @@ -194,6 +203,7 @@ def post_attachment_to_ticket(self, issue_id: str, attachment_path: str) -> None

def get_project_issues(self, project_key: str) -> Dict[str, Any]:
"""Retrieve all issues for the given project key."""
# TODO: add field for ticket type.
headers = {"Accept": "application/json"}
query = {"jql": f"project={project_key}"}
response = requests.request(
Expand All @@ -203,7 +213,6 @@ def get_project_issues(self, project_key: str) -> Dict[str, Any]:
params=query,
auth=self.auth,
)
response.raise_for_status()
return response.json()

def get_project_versions(self, project_key: str) -> List[str]:
Expand Down
72 changes: 42 additions & 30 deletions abr-testing/abr_testing/data_collection/abr_robot_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,20 @@ def compare_lpc_to_historical_data(
& (df_lpc_data["Robot"] == robot)
& (df_lpc_data["Module"] == labware_dict["Module"])
& (df_lpc_data["Adapter"] == labware_dict["Adapter"])
& (df_lpc_data["Run Ending Error"] < 1)
& (df_lpc_data["Run Ending Error"])
< 1
]
# Converts coordinates to floats and finds averages.
x_float = [float(value) for value in relevant_lpc["X"]]
y_float = [float(value) for value in relevant_lpc["Y"]]
z_float = [float(value) for value in relevant_lpc["Z"]]
current_x = round(labware_dict["X"], 2)
current_y = round(labware_dict["Y"], 2)
current_z = round(labware_dict["Z"], 2)
try:
x_float = [float(value) for value in relevant_lpc["X"]]
y_float = [float(value) for value in relevant_lpc["Y"]]
z_float = [float(value) for value in relevant_lpc["Z"]]
current_x = round(labware_dict["X"], 2)
current_y = round(labware_dict["Y"], 2)
current_z = round(labware_dict["Z"], 2)
except (ValueError):
x_float, y_float, z_float = [0.0], [0.0], [0.0]
current_x, current_y, current_z = 0.0, 0.0, 0.0
try:
avg_x = round(mean(x_float), 2)
avg_y = round(mean(y_float), 2)
Expand Down Expand Up @@ -247,7 +252,7 @@ def get_error_runs_from_robot(ip: str) -> List[str]:
f"http://{ip}:31950/runs", headers={"opentrons-version": "3"}
)
run_data = response.json()
run_list = run_data["data"]
run_list = run_data.get("data", [])
for run in run_list:
run_id = run["id"]
num_of_errors = len(run["errors"])
Expand All @@ -258,7 +263,7 @@ def get_error_runs_from_robot(ip: str) -> List[str]:

def get_robot_state(
ip: str, reported_string: str
) -> Tuple[Any, Any, Any, List[str], str]:
) -> Tuple[Any, Any, Any, List[str], List[str], str]:
"""Get robot status in case of non run error."""
description = dict()
# Get instruments attached to robot
Expand All @@ -274,10 +279,11 @@ def get_robot_state(
f"http://{ip}:31950/health", headers={"opentrons-version": "3"}
)
health_data = response.json()
parent = health_data.get("name", "")
print(f"health data {health_data}")
robot = health_data.get("name", "")
# Create summary name
description["robot_name"] = parent
summary = parent + "_" + reported_string
description["robot_name"] = robot
summary = robot + "_" + reported_string
affects_version = health_data.get("api_version", "")
description["affects_version"] = affects_version
# Instruments Attached
Expand All @@ -297,6 +303,12 @@ def get_robot_state(
description[module["moduleType"]] = module
components = ["Flex-RABR"]
components = match_error_to_component("RABR", reported_string, components)
if "alpha" in affects_version:
components.append("flex internal releases")
labels = [robot]
if "8.2" in affects_version:
labels.append("8_2_0")
parent = affects_version + " Bugs"
print(components)
end_time = datetime.now()
print(end_time)
Expand All @@ -317,13 +329,14 @@ def get_robot_state(
parent,
affects_version,
components,
labels,
whole_description_str,
)


def get_run_error_info_from_robot(
ip: str, one_run: str, storage_directory: str
) -> Tuple[str, str, str, List[str], str, str]:
) -> Tuple[str, str, str, List[str], List[str], str, str]:
"""Get error information from robot to fill out ticket."""
description = dict()
# get run information
Expand All @@ -339,16 +352,19 @@ def get_run_error_info_from_robot(
error_code = error_dict["Error_Code"]
error_instrument = error_dict["Error_Instrument"]
# JIRA Ticket Fields

robot = results.get("robot_name", "")
failure_level = "Level " + str(error_level) + " Failure"

components = [failure_level, "Flex-RABR"]
components = match_error_to_component("RABR", str(error_type), components)
print(components)
affects_version = results["API_Version"]
parent = results.get("robot_name", "")
print(parent)
summary = parent + "_" + str(one_run) + "_" + str(error_code) + "_" + error_type
if "alpha" in affects_version:
components.append("flex internal releases")
labels = [robot]
if "8.2" in affects_version:
labels.append("8_2_0")
parent = affects_version + " Bugs"
summary = robot + "_" + str(one_run) + "_" + str(error_code) + "_" + error_type
# Description of error
description["protocol_name"] = results["protocol"]["metadata"].get(
"protocolName", ""
Expand Down Expand Up @@ -430,6 +446,7 @@ def get_run_error_info_from_robot(
parent,
affects_version,
components,
labels,
whole_description_str,
saved_file_path,
)
Expand Down Expand Up @@ -503,18 +520,20 @@ def get_run_error_info_from_robot(
one_run = error_runs[-1] # Most recent run with error.
(
summary,
robot,
parent,
affects_version,
components,
labels,
whole_description_str,
run_log_file_path,
) = get_run_error_info_from_robot(ip, one_run, storage_directory)
else:
(
summary,
robot,
parent,
affects_version,
components,
labels,
whole_description_str,
) = get_robot_state(ip, run_or_other)
# Get Calibration Data
Expand All @@ -525,16 +544,8 @@ def get_run_error_info_from_robot(
print(f"Making ticket for {summary}.")
# TODO: make argument or see if I can get rid of with using board_id.
project_key = "RABR"
print(robot)
try:
parent_key = project_key + "-" + robot.split("ABR")[1]
except IndexError:
parent_key = ""

# Grab all previous issues
all_issues = ticket.issues_on_board(project_key)

# TODO: read board to see if ticket for run id already exists.
all_issues = ticket.issues_on_board(project_key)
# CREATE TICKET
issue_key, raw_issue_url = ticket.create_ticket(
summary,
Expand All @@ -546,7 +557,8 @@ def get_run_error_info_from_robot(
"Medium",
components,
affects_version,
parent_key,
labels,
parent,
)
# Link Tickets
to_link = ticket.match_issues(all_issues, summary)
Expand Down
Loading