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`.
|
Slave log files are expected to located in certain format under `logs_dir`.
|
||||||
"""
|
"""
|
||||||
function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString)
|
function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString)
|
||||||
exclude_runs =
|
exclude_runs = (
|
||||||
((runid = 51, reason = "clock only"), (runid = 175, reason = "broken files"))
|
(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(
|
stmt_insert_slave_result_to_single_result = DBInterface.prepare(
|
||||||
db,
|
db,
|
||||||
|
@ -826,8 +832,10 @@ function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString)
|
||||||
|
|
||||||
# exclusion
|
# exclusion
|
||||||
|
|
||||||
exclude_cond = Iterators.filter(exclude_runs) do cond
|
exclude_cond = any(exclude_runs) do cond
|
||||||
runid == cond.runid
|
runid_matched = runid == cond.runid
|
||||||
|
psbid_matched = isnothing(cond.psbid) || cond.psbid == psbid
|
||||||
|
runid_matched && psbid_matched
|
||||||
end
|
end
|
||||||
if !isempty(exclude_cond)
|
if !isempty(exclude_cond)
|
||||||
@debug "skipping runid = $(runid) for $(first(exclude_cond).reason)"
|
@debug "skipping runid = $(runid) for $(first(exclude_cond).reason)"
|
||||||
|
@ -835,14 +843,18 @@ function add_slavelog_result(db::SQLite.DB, logs_dir::AbstractString)
|
||||||
end
|
end
|
||||||
|
|
||||||
if !(runid in runids)
|
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)
|
slave_result = SlaveLogParser.parse_slavelog_file(file)
|
||||||
@debug "runid: $(runid) not in run list (psbid: $(psbid))"
|
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
# main
|
# 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"
|
@assert length(slave_result.power) == 1 "Too many power results for single run"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue