fixed top priority tests and start with correct device
This commit is contained in:
+2
-11
@@ -428,22 +428,13 @@ def compile_schedule_endpoint(request: CompileScheduleRequest) -> dict[str, Any]
|
|||||||
ref_top_priority_ids = {item.strip() for item in request.top_priority_tests_ref if item.strip()}
|
ref_top_priority_ids = {item.strip() for item in request.top_priority_tests_ref if item.strip()}
|
||||||
status_lookup = {(test.test_id, test.device): test.status for test in stored_tests}
|
status_lookup = {(test.test_id, test.device): test.status for test in stored_tests}
|
||||||
|
|
||||||
# Backward compatibility: if only legacy top_priority_tests was sent,
|
|
||||||
# keep previous behavior by applying IDs to whichever device has that test.
|
|
||||||
if not dut_top_priority_ids and not ref_top_priority_ids and request.top_priority_tests:
|
|
||||||
for test_id in {item.strip() for item in request.top_priority_tests if item.strip()}:
|
|
||||||
if any(t.test_id == test_id and t.device == DUT for t in stored_tests):
|
|
||||||
dut_top_priority_ids.add(test_id)
|
|
||||||
if any(t.test_id == test_id and t.device == REF for t in stored_tests):
|
|
||||||
ref_top_priority_ids.add(test_id)
|
|
||||||
|
|
||||||
for test_id in dut_top_priority_ids:
|
for test_id in dut_top_priority_ids:
|
||||||
if any(t.test_id == test_id and t.device == DUT for t in stored_tests):
|
if any(t.test_id == test_id and t.device == DUT for t in stored_tests):
|
||||||
top_priority_pairs.add((DUT, test_id))
|
top_priority_pairs.add((test_id, DUT))
|
||||||
|
|
||||||
for test_id in ref_top_priority_ids:
|
for test_id in ref_top_priority_ids:
|
||||||
if any(t.test_id == test_id and t.device == REF for t in stored_tests):
|
if any(t.test_id == test_id and t.device == REF for t in stored_tests):
|
||||||
top_priority_pairs.add((REF, test_id))
|
top_priority_pairs.add((test_id, REF))
|
||||||
|
|
||||||
scheduler = Scheduler(
|
scheduler = Scheduler(
|
||||||
all_tests=all_tests,
|
all_tests=all_tests,
|
||||||
|
|||||||
@@ -104,6 +104,13 @@ class Scheduler:
|
|||||||
elif bundle.device == REF:
|
elif bundle.device == REF:
|
||||||
pending_ref.append(bundle)
|
pending_ref.append(bundle)
|
||||||
|
|
||||||
|
# If there is priority 0 bundle in REF bundle, device should be REF for the first window, otherwise DUT
|
||||||
|
if any(bundle.priority == 0 for bundle in pending_ref):
|
||||||
|
night_window_device = REF
|
||||||
|
# If there is priority 1 bundle in REF but not in DUT, device should be REF for the first window, otherwise DUT
|
||||||
|
elif any(bundle.priority == 1 for bundle in pending_ref) and not any(bundle.priority == 1 for bundle in pending_dut):
|
||||||
|
night_window_device = REF
|
||||||
|
|
||||||
while pending_dut or pending_ref:
|
while pending_dut or pending_ref:
|
||||||
daytime_window_active = daytime_window_pending and not is_off_day(cursor_date, self.holiday_dates)
|
daytime_window_active = daytime_window_pending and not is_off_day(cursor_date, self.holiday_dates)
|
||||||
window_device = self.daytime_testing_device if daytime_window_active else night_window_device
|
window_device = self.daytime_testing_device if daytime_window_active else night_window_device
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class TestBundle:
|
|||||||
def build_test_bundles(active_dut: dict[str, Test], active_ref: dict[str, Test], top_priority_tests: set[tuple[str, str]]) -> list[TestBundle]:
|
def build_test_bundles(active_dut: dict[str, Test], active_ref: dict[str, Test], top_priority_tests: set[tuple[str, str]]) -> list[TestBundle]:
|
||||||
"""Build deterministic bundles for DP scheduling."""
|
"""Build deterministic bundles for DP scheduling."""
|
||||||
|
|
||||||
|
print(f"Top priority tests: {top_priority_tests}")
|
||||||
processed_dut: set[str] = set()
|
processed_dut: set[str] = set()
|
||||||
processed_ref: set[str] = set()
|
processed_ref: set[str] = set()
|
||||||
test_bundles: list[TestBundle] = []
|
test_bundles: list[TestBundle] = []
|
||||||
@@ -87,7 +88,7 @@ def build_test_bundles(active_dut: dict[str, Test], active_ref: dict[str, Test],
|
|||||||
dut_bundled_tests = dedupe_preserve_order(dut_bundled_tests)
|
dut_bundled_tests = dedupe_preserve_order(dut_bundled_tests)
|
||||||
|
|
||||||
# Check if any of the DUT tests in this bundle are in the top priority list
|
# Check if any of the DUT tests in this bundle are in the top priority list
|
||||||
if any((DUT, dut_test_id) in top_priority_tests for dut_test_id in dut_bundled_tests):
|
if any((dut_test_id, DUT) in top_priority_tests for dut_test_id in dut_bundled_tests):
|
||||||
priority = BUNDLE_PRIORITY_USER_TOP
|
priority = BUNDLE_PRIORITY_USER_TOP
|
||||||
|
|
||||||
# Check if any of the DUT tests in this bundle are reruns
|
# Check if any of the DUT tests in this bundle are reruns
|
||||||
@@ -108,7 +109,7 @@ def build_test_bundles(active_dut: dict[str, Test], active_ref: dict[str, Test],
|
|||||||
processed_ref.update(ref_bundled_tests)
|
processed_ref.update(ref_bundled_tests)
|
||||||
|
|
||||||
# Check if any of the REF tests in this bundle are in the top priority list
|
# Check if any of the REF tests in this bundle are in the top priority list
|
||||||
if any((REF, ref_test_id) in top_priority_tests for ref_test_id in ref_bundled_tests):
|
if any((ref_test_id, REF) in top_priority_tests for ref_test_id in ref_bundled_tests):
|
||||||
priority = BUNDLE_PRIORITY_USER_TOP
|
priority = BUNDLE_PRIORITY_USER_TOP
|
||||||
# Check if any of the REF tests in this bundle are reruns
|
# Check if any of the REF tests in this bundle are reruns
|
||||||
elif any((ref_test.status == "rerun" for ref_test_id in ref_bundled_tests if (ref_test := active_ref.get(ref_test_id)))):
|
elif any((ref_test.status == "rerun" for ref_test_id in ref_bundled_tests if (ref_test := active_ref.get(ref_test_id)))):
|
||||||
@@ -137,7 +138,7 @@ def build_test_bundles(active_dut: dict[str, Test], active_ref: dict[str, Test],
|
|||||||
priority = BUNDLE_PRIORITY_P3P
|
priority = BUNDLE_PRIORITY_P3P
|
||||||
|
|
||||||
# Check if any of the DUT tests in this bundle are in the top priority list
|
# Check if any of the DUT tests in this bundle are in the top priority list
|
||||||
if any((DUT, dut_test_id) in top_priority_tests for dut_test_id in dut_bundled_tests):
|
if any((dut_test_id, DUT) in top_priority_tests for dut_test_id in dut_bundled_tests):
|
||||||
priority = BUNDLE_PRIORITY_USER_TOP
|
priority = BUNDLE_PRIORITY_USER_TOP
|
||||||
|
|
||||||
# Check if any of the DUT tests in this bundle are reruns
|
# Check if any of the DUT tests in this bundle are reruns
|
||||||
@@ -155,7 +156,7 @@ def build_test_bundles(active_dut: dict[str, Test], active_ref: dict[str, Test],
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Check if any of the REF tests in this bundle are in the top priority list
|
# Check if any of the REF tests in this bundle are in the top priority list
|
||||||
if any((REF, ref_test_id) in top_priority_tests for ref_test_id in ref_bundled_tests):
|
if any((ref_test_id, REF) in top_priority_tests for ref_test_id in ref_bundled_tests):
|
||||||
priority = BUNDLE_PRIORITY_USER_TOP
|
priority = BUNDLE_PRIORITY_USER_TOP
|
||||||
# Check if any of the REF tests in this bundle are reruns
|
# Check if any of the REF tests in this bundle are reruns
|
||||||
elif any((ref_test.status == "rerun" for ref_test_id in ref_bundled_tests if (ref_test := active_ref.get(ref_test_id)))):
|
elif any((ref_test.status == "rerun" for ref_test_id in ref_bundled_tests if (ref_test := active_ref.get(ref_test_id)))):
|
||||||
|
|||||||
Reference in New Issue
Block a user