mirror of
https://gitlab.cern.ch/wotsubo/psboard-qaqc-postprocess.git
synced 2024-11-25 08:31:12 +09:00
update: add QAQC runid for master log parsing
- for master version v0.2.0
This commit is contained in:
parent
b927f5923e
commit
84d321ec30
5 changed files with 55 additions and 19 deletions
|
@ -175,6 +175,7 @@ pub struct PsbQaqcResult {
|
||||||
pll_lock_reset: u16,
|
pll_lock_reset: u16,
|
||||||
qaqc_result: u32,
|
qaqc_result: u32,
|
||||||
lvds_tx_skew: Option<u32>,
|
lvds_tx_skew: Option<u32>,
|
||||||
|
runid: u32,
|
||||||
timestamp: DateTime<Utc>,
|
timestamp: DateTime<Utc>,
|
||||||
qaqc_log_file: String,
|
qaqc_log_file: String,
|
||||||
shiftscript_ver: Version,
|
shiftscript_ver: Version,
|
||||||
|
@ -203,6 +204,7 @@ impl PsbQaqcResult {
|
||||||
pll_lock_reset: boardresult.reset,
|
pll_lock_reset: boardresult.reset,
|
||||||
qaqc_result: boardresult.result.into(),
|
qaqc_result: boardresult.result.into(),
|
||||||
lvds_tx_skew: None,
|
lvds_tx_skew: None,
|
||||||
|
runid: result.runid,
|
||||||
timestamp: result.datetime,
|
timestamp: result.datetime,
|
||||||
qaqc_log_file: result.filename.clone(),
|
qaqc_log_file: result.filename.clone(),
|
||||||
shiftscript_ver: result.version.clone(),
|
shiftscript_ver: result.version.clone(),
|
||||||
|
|
|
@ -29,6 +29,7 @@ pub struct MasterBoardResult {
|
||||||
pub struct MasterLogResult {
|
pub struct MasterLogResult {
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
pub datetime: DateTime<Utc>,
|
pub datetime: DateTime<Utc>,
|
||||||
|
pub runid: u32,
|
||||||
pub shifter: String,
|
pub shifter: String,
|
||||||
pub board_results: BTreeMap<Position, MasterBoardResult>,
|
pub board_results: BTreeMap<Position, MasterBoardResult>,
|
||||||
pub filename: String,
|
pub filename: String,
|
||||||
|
@ -43,6 +44,15 @@ fn extract_version(line: &str) -> Result<Version> {
|
||||||
.parse()?)
|
.parse()?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get runid.
|
||||||
|
fn extract_runid_line(line: &str) -> Result<u32> {
|
||||||
|
let re = Regex::new(r"^QAQC runid: (\d+)$").unwrap();
|
||||||
|
let caps = re.captures(line).unwrap();
|
||||||
|
trace!("Regex {:?}", caps);
|
||||||
|
let runid = u32::from_str(caps.get(1).unwrap().into())?;
|
||||||
|
Ok(runid)
|
||||||
|
}
|
||||||
|
|
||||||
/// Get shifters from shifter line
|
/// Get shifters from shifter line
|
||||||
fn extract_shifter_line(line: &str) -> Result<String> {
|
fn extract_shifter_line(line: &str) -> Result<String> {
|
||||||
let re = Regex::new(r"^Shifters: (.+)$").unwrap();
|
let re = Regex::new(r"^Shifters: (.+)$").unwrap();
|
||||||
|
@ -81,6 +91,13 @@ impl MasterLogResult {
|
||||||
.to_utc()
|
.to_utc()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let runid: u32 = {
|
||||||
|
let line = lines
|
||||||
|
.next()
|
||||||
|
.context("Invalid log format(no runid line)")??;
|
||||||
|
extract_runid_line(&line)?
|
||||||
|
};
|
||||||
|
|
||||||
let shifter = {
|
let shifter = {
|
||||||
let line = lines
|
let line = lines
|
||||||
.next()
|
.next()
|
||||||
|
@ -238,6 +255,7 @@ impl MasterLogResult {
|
||||||
Ok(MasterLogResult {
|
Ok(MasterLogResult {
|
||||||
version,
|
version,
|
||||||
datetime,
|
datetime,
|
||||||
|
runid,
|
||||||
shifter,
|
shifter,
|
||||||
board_results,
|
board_results,
|
||||||
filename,
|
filename,
|
||||||
|
@ -249,6 +267,8 @@ impl MasterLogResult {
|
||||||
mod test {
|
mod test {
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
|
|
||||||
|
use crate::masterlog::extract_runid_line;
|
||||||
|
|
||||||
use super::{Position, PositionLayer, PsbId};
|
use super::{Position, PositionLayer, PsbId};
|
||||||
|
|
||||||
use super::{extract_position_id, extract_shifter_line, extract_version};
|
use super::{extract_position_id, extract_shifter_line, extract_version};
|
||||||
|
@ -261,6 +281,18 @@ mod test {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_runid_line() {
|
||||||
|
assert_eq!(
|
||||||
|
extract_runid_line("QAQC runid: 7").unwrap(),
|
||||||
|
7
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
extract_runid_line("QAQC runid: 12345").unwrap(),
|
||||||
|
12345
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_shifter_line() {
|
fn parse_shifter_line() {
|
||||||
assert_eq!(extract_shifter_line("Shifters: foo").unwrap(), "foo");
|
assert_eq!(extract_shifter_line("Shifters: foo").unwrap(), "foo");
|
||||||
|
|
|
@ -18,7 +18,7 @@ mod integrated_test {
|
||||||
let mut cmd = Command::cargo_bin("psb-qaqc")?;
|
let mut cmd = Command::cargo_bin("psb-qaqc")?;
|
||||||
cmd.current_dir("tests")
|
cmd.current_dir("tests")
|
||||||
.arg("add-master-log")
|
.arg("add-master-log")
|
||||||
.arg("./example_logs/valid/20240720_171418.log")
|
.arg("./example_logs/valid/7.log")
|
||||||
.arg(test_out.as_path())
|
.arg(test_out.as_path())
|
||||||
.assert()
|
.assert()
|
||||||
.success()
|
.success()
|
||||||
|
@ -34,7 +34,7 @@ mod integrated_test {
|
||||||
line
|
line
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.contains(
|
.contains(
|
||||||
"8866,,A-0-0,0,1,1,0,1,8,1,,2024-07-20T17:15:46Z,20240720_171418.log,0.1.0,alice,,,,"
|
"8866,,A-0-0,0,1,1,0,1,8,1,,7,2024-07-20T17:15:46Z,7.log,0.1.0,alice,,,,"
|
||||||
)
|
)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ mod integrated_test {
|
||||||
let mut cmd = Command::cargo_bin("psb-qaqc")?;
|
let mut cmd = Command::cargo_bin("psb-qaqc")?;
|
||||||
cmd.current_dir("tests")
|
cmd.current_dir("tests")
|
||||||
.arg("add-master-log")
|
.arg("add-master-log")
|
||||||
.arg("./example_logs/valid/20240720_171418.log")
|
.arg("./example_logs/valid/7.log")
|
||||||
.arg(test_out.as_path())
|
.arg(test_out.as_path())
|
||||||
.assert()
|
.assert()
|
||||||
.success();
|
.success();
|
||||||
|
@ -67,7 +67,7 @@ mod integrated_test {
|
||||||
let mut cmd = Command::cargo_bin("psb-qaqc")?;
|
let mut cmd = Command::cargo_bin("psb-qaqc")?;
|
||||||
cmd.current_dir("tests")
|
cmd.current_dir("tests")
|
||||||
.arg("add-master-log")
|
.arg("add-master-log")
|
||||||
.arg("./example_logs/valid/20240720_171419.log")
|
.arg("./example_logs/valid/84.log")
|
||||||
.arg(test_out.as_path())
|
.arg(test_out.as_path())
|
||||||
.assert()
|
.assert()
|
||||||
.success()
|
.success()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
Shift script: 0.1.0
|
Shift script: 0.1.0
|
||||||
----------------------
|
----------------------
|
||||||
Date: 2024-07-20T17:15:46+0000
|
Date: 2024-07-20T17:15:46+0000
|
||||||
|
QAQC runid: 7
|
||||||
Shifters: alice
|
Shifters: alice
|
||||||
----------------------
|
----------------------
|
||||||
PBS Assignment:
|
PBS Assignment:
|
|
@ -1,23 +1,24 @@
|
||||||
Shift script: 0.1.0
|
Shift script: 0.1.0
|
||||||
----------------------
|
----------------------
|
||||||
Date: 2024-07-20T17:15:46+0000
|
Date: 2024-07-20T17:15:47+0000
|
||||||
|
QAQC runid: 84
|
||||||
Shifters: alice
|
Shifters: alice
|
||||||
----------------------
|
----------------------
|
||||||
PBS Assignment:
|
PBS Assignment:
|
||||||
Position / assigned-ID : A-0-0 / PS008866
|
Position / assigned-ID : A-0-0 / PS008867
|
||||||
Position / assigned-ID : A-1-0 / PS008866
|
Position / assigned-ID : A-1-0 / PS008868
|
||||||
Position / assigned-ID : A-0-2 / PS008866
|
Position / assigned-ID : A-0-2 / PS008869
|
||||||
Position / assigned-ID : A-1-2 / PS008866
|
Position / assigned-ID : A-1-2 / PS008810
|
||||||
Position / assigned-ID : A-0-3 / PS008866
|
Position / assigned-ID : A-0-3 / PS008811
|
||||||
Position / assigned-ID : A-1-3 / PS008866
|
Position / assigned-ID : A-1-3 / PS008812
|
||||||
Position / assigned-ID : A-0-4 / PS008866
|
Position / assigned-ID : A-0-4 / PS008813
|
||||||
Position / assigned-ID : A-1-4 / PS008866
|
Position / assigned-ID : A-1-4 / PS008814
|
||||||
Position / assigned-ID : A-1-5 / PS008866
|
Position / assigned-ID : A-1-5 / PS008815
|
||||||
Position / assigned-ID : A-0-6 / PS008866
|
Position / assigned-ID : A-0-6 / PS008816
|
||||||
Position / assigned-ID : A-1-6 / PS008866
|
Position / assigned-ID : A-1-6 / PS008817
|
||||||
Position / assigned-ID : A-0-7 / PS008866
|
Position / assigned-ID : A-0-7 / PS008818
|
||||||
Position / assigned-ID : A-0-8 / PS008866
|
Position / assigned-ID : A-0-8 / PS008819
|
||||||
Position / assigned-ID : A-1-8 / PS008866
|
Position / assigned-ID : A-1-8 / PS008820
|
||||||
======================
|
======================
|
||||||
QAQC status| QSPIp | Recov | Power | Clock | ASDTP | Reset | Result |
|
QAQC status| QSPIp | Recov | Power | Clock | ASDTP | Reset | Result |
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
Loading…
Reference in a new issue