From 10197fe3d7d39e5824a91aa2ee672b09cbcd440d Mon Sep 17 00:00:00 2001 From: Wataru Otsubo Date: Tue, 21 Jan 2025 14:36:03 +0900 Subject: [PATCH] update(import_data): change slavelog exclusion dispatch & add exclusion list Use psbid for exclusion logic. --- src/import_data.jl | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/import_data.jl b/src/import_data.jl index 2fcc271..7e549f1 100644 --- a/src/import_data.jl +++ b/src/import_data.jl @@ -790,8 +790,14 @@ Extract QAQC results from slave log files for single runs. Slave log files are expected to located in certain format under `logs_dir`. """ function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString) - exclude_runs = - ((runid = 51, reason = "clock only"), (runid = 175, reason = "broken files")) + exclude_runs = ( + (runid = 51, psbid = nothing, reason = "clock only"), + (runid = 175, psbid = nothing, reason = "broken files"), + (runid = 437, psbid = 1215, reason = "PSBID 1215 is not completed"), + (runid = 439, psbid = 703, reason = "PSBID 703 is not completed"), + (runid = 434, psbid = 723, reason = "PSBID 723 is not completed"), + ) + @assert eltype(exclude_runs) != Any stmt_insert_slave_result_to_single_result = DBInterface.prepare( db, @@ -826,8 +832,10 @@ function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString) # exclusion - exclude_cond = Iterators.filter(exclude_runs) do cond - runid == cond.runid + exclude_cond = any(exclude_runs) do cond + runid_matched = runid == cond.runid + psbid_matched = isnothing(cond.psbid) || cond.psbid == psbid + runid_matched && psbid_matched end if !isempty(exclude_cond) @debug "skipping runid = $(runid) for $(first(exclude_cond).reason)" @@ -835,14 +843,18 @@ function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString) end if !(runid in runids) + @debug "runid: $(runid) not in run list (psbid: $(psbid)). Parsing slave log to test its format." slave_result = SlaveLogParser.parse_slavelog_file(file) - @debug "runid: $(runid) not in run list (psbid: $(psbid))" continue end # main - slave_result = SlaveLogParser.parse_slavelog_file(file) + slave_result = try + SlaveLogParser.parse_slavelog_file(file) + catch e + throw(error("Failed to parse slave log file: $(file)\n$(e)")) + end @assert length(slave_result.power) == 1 "Too many power results for single run"