From 9b8ffad51d850ea442f23fa4c17710c73f535dc7 Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Mon, 10 Feb 2025 19:53:13 +0900 Subject: [PATCH 1/4] refactor(DispatchChecker): make threshold constants --- src/DispatchChecker.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/DispatchChecker.jl b/src/DispatchChecker.jl index 80100f2..0597c75 100644 --- a/src/DispatchChecker.jl +++ b/src/DispatchChecker.jl @@ -35,11 +35,11 @@ mutable struct DbConnection end end -THRESHOLD_INSUFFICIENT_RESET_WITH_10_CAMPAIGN_1to5 = 0.1 -THRESHOLD_INSUFFICIENT_RESET_WITH_10_CAMPAIGN_6 = 0.05 -THRESHOLD_RESET_FAILED_THOUGH_RECONFIG_DONE = 0.1 -THRESHOLD_ALWAYS_HIT_FLAG_TRUE = 0.1 -THRESHOLD_BCID_FAIL = 0.05 +const THRESHOLD_INSUFFICIENT_RESET_WITH_10_CAMPAIGN_1to5 = 0.1 +const THRESHOLD_INSUFFICIENT_RESET_WITH_10_CAMPAIGN_6 = 0.05 +const THRESHOLD_RESET_FAILED_THOUGH_RECONFIG_DONE = 0.1 +const THRESHOLD_ALWAYS_HIT_FLAG_TRUE = 0.1 +const THRESHOLD_BCID_FAIL = 0.05 """ is_dispatchable(conn::DbConnection, psbid::Int64) From de3c73cfb3647928aa2a7f12327a2edae3ac563d Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Mon, 10 Feb 2025 19:53:39 +0900 Subject: [PATCH 2/4] fix(DispatchChecker): uncovered case in is_dispatchable (cause exception) --- src/DispatchChecker.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DispatchChecker.jl b/src/DispatchChecker.jl index 0597c75..53bffd9 100644 --- a/src/DispatchChecker.jl +++ b/src/DispatchChecker.jl @@ -65,6 +65,7 @@ function is_dispatchable(conn::DbConnection, psbid::Int64) # though 860 has 2+ rows true end + false else single_result.resistance_test_passed == 1 && single_result.qspip == 1 && From 2edbf61a899d460ac6ecefaf9f44af26d587ae34 Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Mon, 10 Feb 2025 19:54:13 +0900 Subject: [PATCH 3/4] new(DispatchChecker): add interactive dispatch check scanner --- src/DispatchChecker.jl | 73 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/src/DispatchChecker.jl b/src/DispatchChecker.jl index 53bffd9..6ca48e7 100644 --- a/src/DispatchChecker.jl +++ b/src/DispatchChecker.jl @@ -9,6 +9,7 @@ using SQLite using DBInterface using DataFrames using Printf +using REPL.TerminalMenus export DbConnection export is_dispatchable @@ -213,4 +214,76 @@ function interactive_dispatch_checker(database_file::AbstractString) interactive_dispatch_checker(conn) end +""" + scan_dispatchcheck(conn::DbConnection; reasons = NamedTuple[]) + +Interactively scan PS Boards to check they passed the QAQC. +If the board have suspicious results but actually passed the test, you can select one reason for that board or +add new reason to explain. + +# Arguments +- `reasons::Vector{NamedTuple}`: reasons why given board passed the test. This is *mutated* during the session. + +## reason structure + +One element of the `reason` should be like this: + +```julia +( + name = "name of this category", + passing_pairs = NamedTuple[ + (; psboard_id, note = "supplemental note"), + others... + ], +) +``` +""" +function scan_dispatchcheck(conn::DbConnection; reasons = NamedTuple[]) + df_ps_boards = DBInterface.execute(conn.db, sql"select * from ps_boards") |> DataFrame + pushfirst!(reasons, (name = "add new reason", passing_pairs = NamedTuple[])) + + for row_ps_boards in eachrow(df_ps_boards) + old_result = is_dispatchable(conn, row_ps_boards.id) + if !ismissing(old_result) && old_result + continue + end + if any(reasons) do reason + any(reason.passing_pairs) do passing_pair + matched = row_ps_boards.id == passing_pair.psboard_id + if matched + @info "psbid $(row_ps_boards.id) passed for $(reason.name)" + end + matched + end + end + continue + end + + @info "missing: $(row_ps_boards.id)" + selected = request( + "select passing reason(press q to skip):", + RadioMenu([nt.name for nt in reasons]), + ) + if selected == -1 + println("none selected. keep missing") + elseif selected == 1 + print("new reason name: ") + new_name = readline() + print("note for this case: ") + note = readline() + new_reason = ( + name = new_name, + passing_pairs = NamedTuple[(psboard_id = row_ps_boards.id, note)], + ) + push!(reasons, new_reason) + else + println("selected reason: $(reasons[selected].name)") + print("note for this case: ") + note = readline() + push!(reasons[selected].passing_pairs, (psboard_id = row_ps_boards.id, note)) + end + end + @assert popfirst!(reasons).name == "add new reason" +end + end # module DispatchChecker From 4b2ff6bbf7c828a74879db90d991ebba98fe9f9b Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Mon, 10 Feb 2025 19:54:44 +0900 Subject: [PATCH 4/4] new(DispatchChecker): first scan result --- dispatch-reasons.jl | 396 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 396 insertions(+) create mode 100644 dispatch-reasons.jl diff --git a/dispatch-reasons.jl b/dispatch-reasons.jl new file mode 100644 index 0000000..feae453 --- /dev/null +++ b/dispatch-reasons.jl @@ -0,0 +1,396 @@ +# reasons obtained at scan on 2025-02-10T19:44:22+09:00 +NamedTuple[ + ( + name = "all runs ok", + passing_pairs = NamedTuple[ + (psboard_id = 48, note = "all runs ok"), + (psboard_id = 102, note = ""), + (psboard_id = 291, note = "runid 83 was cabling error"), + (psboard_id = 299, note = "suspicious power value for runid 501?"), + (psboard_id = 356, note = "a bit high 3V3A"), + (psboard_id = 471, note = ""), + (psboard_id = 473, note = ""), + (psboard_id = 474, note = ""), + (psboard_id = 475, note = ""), + (psboard_id = 476, note = ""), + (psboard_id = 477, note = ""), + (psboard_id = 478, note = ""), + (psboard_id = 479, note = ""), + (psboard_id = 480, note = ""), + (psboard_id = 481, note = ""), + (psboard_id = 482, note = ""), + (psboard_id = 483, note = ""), + (psboard_id = 484, note = ""), + (psboard_id = 485, note = ""), + (psboard_id = 486, note = ""), + (psboard_id = 487, note = ""), + (psboard_id = 488, note = ""), + (psboard_id = 579, note = ""), + (psboard_id = 589, note = ""), + (psboard_id = 595, note = ""), + (psboard_id = 600, note = ""), + (psboard_id = 611, note = ""), + (psboard_id = 800, note = ""), + (psboard_id = 837, note = ""), + (psboard_id = 838, note = "run 222 used wrong clock test"), + (psboard_id = 840, note = "222"), + (psboard_id = 841, note = "222"), + (psboard_id = 842, note = "222"), + (psboard_id = 843, note = "222"), + (psboard_id = 844, note = "222"), + (psboard_id = 845, note = ""), + (psboard_id = 846, note = "222"), + (psboard_id = 847, note = "222"), + (psboard_id = 848, note = "222"), + (psboard_id = 849, note = "222"), + (psboard_id = 850, note = "222"), + (psboard_id = 851, note = "222"), + (psboard_id = 852, note = "222"), + (psboard_id = 853, note = "222"), + (psboard_id = 854, note = "222"), + (psboard_id = 855, note = "224"), + (psboard_id = 856, note = "224"), + (psboard_id = 857, note = "224"), + (psboard_id = 858, note = "224"), + (psboard_id = 859, note = "224"), + (psboard_id = 860, note = "224"), + (psboard_id = 863, note = ""), + (psboard_id = 865, note = "224"), + (psboard_id = 866, note = "224"), + (psboard_id = 867, note = "224"), + (psboard_id = 868, note = "224"), + (psboard_id = 869, note = "224"), + (psboard_id = 870, note = "224"), + (psboard_id = 871, note = "224"), + (psboard_id = 873, note = "224"), + (psboard_id = 874, note = "224"), + (psboard_id = 875, note = "226"), + (psboard_id = 876, note = "226"), + (psboard_id = 877, note = "226"), + (psboard_id = 878, note = "226"), + (psboard_id = 879, note = ""), + (psboard_id = 880, note = "226"), + (psboard_id = 881, note = "226"), + (psboard_id = 882, note = "233"), + (psboard_id = 883, note = "226"), + (psboard_id = 884, note = "226"), + (psboard_id = 885, note = "226"), + (psboard_id = 886, note = "226"), + (psboard_id = 887, note = "226"), + (psboard_id = 888, note = "226"), + (psboard_id = 889, note = "226"), + (psboard_id = 890, note = "226"), + (psboard_id = 891, note = "226"), + (psboard_id = 892, note = "226"), + (psboard_id = 893, note = "226"), + (psboard_id = 894, note = "226"), + (psboard_id = 895, note = "228"), + (psboard_id = 896, note = "228"), + (psboard_id = 897, note = "228"), + (psboard_id = 898, note = "228"), + (psboard_id = 899, note = "228"), + (psboard_id = 900, note = "228"), + (psboard_id = 901, note = "228"), + (psboard_id = 902, note = "228"), + (psboard_id = 903, note = "228"), + (psboard_id = 904, note = "228"), + (psboard_id = 905, note = "228"), + (psboard_id = 906, note = "228"), + (psboard_id = 907, note = ""), + (psboard_id = 908, note = "228"), + (psboard_id = 909, note = "228"), + (psboard_id = 910, note = "228"), + (psboard_id = 911, note = "228"), + (psboard_id = 912, note = "228"), + (psboard_id = 913, note = "228"), + (psboard_id = 914, note = "230"), + (psboard_id = 915, note = "230"), + (psboard_id = 916, note = "230"), + (psboard_id = 917, note = "230"), + (psboard_id = 918, note = "230"), + (psboard_id = 919, note = "230"), + (psboard_id = 920, note = "230"), + (psboard_id = 921, note = "230"), + (psboard_id = 922, note = "230"), + (psboard_id = 923, note = "230"), + (psboard_id = 924, note = ""), + (psboard_id = 925, note = "230"), + (psboard_id = 926, note = "230"), + (psboard_id = 927, note = "230"), + (psboard_id = 928, note = "230"), + (psboard_id = 929, note = "230"), + (psboard_id = 930, note = "230"), + (psboard_id = 931, note = "230"), + (psboard_id = 932, note = "230"), + (psboard_id = 933, note = "233"), + (psboard_id = 934, note = "233"), + (psboard_id = 935, note = "233"), + (psboard_id = 937, note = "233"), + (psboard_id = 938, note = "233"), + (psboard_id = 939, note = "233"), + (psboard_id = 940, note = "233"), + (psboard_id = 941, note = "233"), + (psboard_id = 942, note = "233"), + (psboard_id = 943, note = "233"), + (psboard_id = 944, note = "233"), + (psboard_id = 945, note = "233"), + (psboard_id = 946, note = "233"), + (psboard_id = 947, note = "233"), + (psboard_id = 948, note = "233"), + (psboard_id = 949, note = "233"), + (psboard_id = 964, note = ""), + (psboard_id = 1016, note = "303?"), + (psboard_id = 1018, note = ""), + (psboard_id = 1022, note = ""), + (psboard_id = 1098, note = ""), + (psboard_id = 1115, note = ""), + (psboard_id = 1148, note = ""), + (psboard_id = 1149, note = ""), + (psboard_id = 1150, note = ""), + (psboard_id = 1151, note = ""), + (psboard_id = 1152, note = ""), + (psboard_id = 1153, note = ""), + (psboard_id = 1154, note = ""), + (psboard_id = 1155, note = ""), + (psboard_id = 1156, note = ""), + (psboard_id = 1157, note = ""), + (psboard_id = 1158, note = ""), + (psboard_id = 1159, note = ""), + (psboard_id = 1160, note = ""), + (psboard_id = 1161, note = ""), + (psboard_id = 1162, note = ""), + (psboard_id = 1163, note = ""), + (psboard_id = 1166, note = ""), + (psboard_id = 1169, note = ""), + (psboard_id = 1242, note = ""), + (psboard_id = 1248, note = ""), + (psboard_id = 1276, note = ""), + (psboard_id = 1343, note = ""), + (psboard_id = 1408, note = ""), + ( + psboard_id = 1433, + note = "run 460 is without firmware due to 1420 power issue", + ), + (psboard_id = 1545, note = ""), + (psboard_id = 280, note = "a lot of debug runs, maybe"), + (psboard_id = 835, note = "222"), + (psboard_id = 836, note = "222"), + ], + ), + ( + name = "fixed with new PP ASIC PLL lock procedure", + passing_pairs = NamedTuple[ + (psboard_id = 53, note = ""), + (psboard_id = 61, note = "mainly"), + ( + psboard_id = 64, + note = "somehow daughter board is swapped two times 78 -> 654 -> 78", + ), + (psboard_id = 78, note = ""), + (psboard_id = 79, note = ""), + (psboard_id = 127, note = ""), + (psboard_id = 226, note = ""), + (psboard_id = 249, note = ""), + (psboard_id = 301, note = ""), + (psboard_id = 410, note = ""), + (psboard_id = 446, note = ""), + (psboard_id = 451, note = ""), + (psboard_id = 518, note = ""), + (psboard_id = 525, note = ""), + (psboard_id = 612, note = ""), + (psboard_id = 624, note = ""), + (psboard_id = 650, note = ""), + (psboard_id = 703, note = ""), + (psboard_id = 706, note = ""), + (psboard_id = 723, note = ""), + (psboard_id = 952, note = ""), + (psboard_id = 973, note = ""), + (psboard_id = 992, note = ""), + (psboard_id = 1014, note = ""), + (psboard_id = 1030, note = ""), + (psboard_id = 1031, note = ""), + (psboard_id = 1040, note = ""), + (psboard_id = 1050, note = ""), + (psboard_id = 1053, note = ""), + (psboard_id = 1063, note = ""), + (psboard_id = 1082, note = ""), + (psboard_id = 1102, note = ""), + (psboard_id = 1103, note = ""), + (psboard_id = 1110, note = ""), + (psboard_id = 1121, note = ""), + (psboard_id = 1126, note = ""), + (psboard_id = 1141, note = ""), + (psboard_id = 1142, note = ""), + (psboard_id = 1182, note = ""), + (psboard_id = 42, note = ""), + ], + ), + ( + name = "fixed later (bcid)", + passing_pairs = NamedTuple[ + (psboard_id = 44, note = "runid 20: shift 87 (with powerfail)"), + (psboard_id = 1181, note = ""), + (psboard_id = 1245, note = ""), + ], + ), + ( + name = "qspi failed in first runs", + passing_pairs = NamedTuple[ + (psboard_id = 62, note = "runid 25, 27"), + (psboard_id = 203, note = ""), + (psboard_id = 545, note = ""), + (psboard_id = 625, note = ""), + (psboard_id = 627, note = ""), + (psboard_id = 757, note = ""), + (psboard_id = 966, note = ""), + (psboard_id = 1001, note = ""), + (psboard_id = 1144, note = ""), + (psboard_id = 1215, note = ""), + (psboard_id = 1563, note = ""), + ], + ), + ( + name = "should be OK with new firmware (PP ASIC LOCK)", + passing_pairs = NamedTuple[ + (psboard_id = 70, note = "error"), + (psboard_id = 113, note = ""), + (psboard_id = 138, note = ""), + (psboard_id = 141, note = ""), + (psboard_id = 198, note = ""), + (psboard_id = 290, note = ""), + (psboard_id = 1113, note = ""), + ], + ), + ( + name = "clock re-run", + passing_pairs = NamedTuple[ + (psboard_id = 71, note = ""), + (psboard_id = 109, note = ""), + (psboard_id = 114, note = ""), + (psboard_id = 121, note = ""), + (psboard_id = 153, note = ""), + (psboard_id = 165, note = ""), + (psboard_id = 168, note = ""), + (psboard_id = 187, note = ""), + (psboard_id = 190, note = ""), + (psboard_id = 206, note = ""), + (psboard_id = 207, note = ""), + (psboard_id = 209, note = ""), + (psboard_id = 218, note = ""), + (psboard_id = 221, note = ""), + (psboard_id = 225, note = ""), + (psboard_id = 230, note = ""), + (psboard_id = 233, note = ""), + (psboard_id = 238, note = ""), + (psboard_id = 442, note = "why clock failed in run 103 is yet unkown"), + (psboard_id = 460, note = ""), + (psboard_id = 462, note = ""), + (psboard_id = 630, note = ""), + (psboard_id = 799, note = ""), + (psboard_id = 802, note = ""), + (psboard_id = 1032, note = ""), + ], + ), + ( + name = "ok with daughterboard replacement", + passing_pairs = NamedTuple[ + (psboard_id = 164, note = ""), + (psboard_id = 184, note = ""), + (psboard_id = 316, note = ""), + (psboard_id = 322, note = ""), + (psboard_id = 324, note = ""), + (psboard_id = 350, note = ""), + (psboard_id = 379, note = ""), + (psboard_id = 393, note = ""), + (psboard_id = 425, note = ""), + (psboard_id = 491, note = ""), + (psboard_id = 538, note = ""), + (psboard_id = 548, note = ""), + (psboard_id = 655, note = ""), + (psboard_id = 680, note = ""), + (psboard_id = 766, note = ""), + (psboard_id = 790, note = ""), + (psboard_id = 861, note = ""), + (psboard_id = 862, note = ""), + (psboard_id = 872, note = ""), + (psboard_id = 957, note = ""), + (psboard_id = 967, note = ""), + (psboard_id = 978, note = ""), + (psboard_id = 981, note = ""), + (psboard_id = 990, note = ""), + (psboard_id = 1015, note = ""), + (psboard_id = 1112, note = ""), + (psboard_id = 1406, note = "BCID fail 1:1:1 on PP5"), + (psboard_id = 132, note = "abnormal resistance on daughter board (id 1534)"), + (psboard_id = 183, note = "bcid fail"), + ], + ), + ( + name = "power fail in some runs", + passing_pairs = NamedTuple[ + (psboard_id = 305, note = ""), + (psboard_id = 335, note = ""), + (psboard_id = 401, note = ""), + (psboard_id = 437, note = ""), + (psboard_id = 562, note = ""), + (psboard_id = 580, note = ""), + (psboard_id = 745, note = ""), + (psboard_id = 814, note = ""), + (psboard_id = 970, note = ""), + (psboard_id = 1183, note = ""), + (psboard_id = 74, note = ""), + (psboard_id = 103, note = "also, bcid_shift 100 at the first run (28)"), + (psboard_id = 135, note = ""), + (psboard_id = 137, note = ""), + (psboard_id = 149, note = ""), + (psboard_id = 196, note = ""), + (psboard_id = 204, note = ""), + (psboard_id = 210, note = ""), + (psboard_id = 270, note = ""), + ], + ), + ( + name = "FPGA not reprogrammed from flash", + passing_pairs = NamedTuple[(psboard_id = 378, note = "")], + ), + ( + name = "power clock asdtp fail in first runs but fixed later", + passing_pairs = NamedTuple[ + (psboard_id = 454, note = ""), + (psboard_id = 472, note = "this seems to be power cabling issue"), + (psboard_id = 1034, note = ""), + ], + ), + ( + name = "cabling issue", + passing_pairs = NamedTuple[ + ( + psboard_id = 676, + note = "rcv missed in run 197, also new PP ASIC procedure fixed PLL issue", + ), + (psboard_id = 982, note = "sfp swapped"), + (psboard_id = 1199, note = "B-1-9 signal"), + (psboard_id = 1216, note = "B-1-9 signal"), + (psboard_id = 1234, note = "B-1-9 signal"), + (psboard_id = 1252, note = "B-1-9 signal"), + (psboard_id = 1270, note = "B-1-9 signal"), + (psboard_id = 1288, note = "B-1-9 signal"), + (psboard_id = 1306, note = "B-1-9 signal"), + (psboard_id = 1324, note = "B-1-9 signal"), + (psboard_id = 1342, note = "B-1-9 signal"), + (psboard_id = 1352, note = "sfp unplugged"), + (psboard_id = 1377, note = "rcv"), + (psboard_id = 1391, note = "sfp "), + ], + ), + ( + name = "B-0-2 power", + passing_pairs = NamedTuple[ + (psboard_id = 1379, note = ""), + (psboard_id = 1515, note = ""), + (psboard_id = 1550, note = ""), + (psboard_id = 1551, note = ""), + (psboard_id = 1586, note = ""), + ], + ), +]