mirror of
https://gitlab.cern.ch/wotsubo/PSBoardDataBase.git
synced 2025-06-08 05:55:42 +09:00
update(import_data): change slavelog exclusion dispatch & add exclusion list
Use psbid for exclusion logic.
This commit is contained in:
parent
c38ad82785
commit
10197fe3d7
1 changed files with 18 additions and 6 deletions
|
@ -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"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue