Skip to content

Commit

Permalink
Fixed parsing of job ids with underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-k committed Feb 28, 2023
1 parent 592c4c0 commit 0333251
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion collectors/slurm/src/sacctcaller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{
type Job = HashMap<String, AllowedTypes>;

static BATCH_REGEX: Lazy<Regex> = Lazy::new(|| {
Regex::new(r#"^[0-9]+\.batch$"#)
Regex::new(r#"^[0-9_]+\.batch$"#)
.expect("Could not construct essential Regex for matching job ids.")
});

Expand Down Expand Up @@ -316,3 +316,14 @@ fn construct_components(job: &Job) -> Vec<Component> {
})
.collect()
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn match_job_ids() {
assert!(BATCH_REGEX.is_match("1234.batch"));
assert!(BATCH_REGEX.is_match("1234_10.batch"));
}
}

0 comments on commit 0333251

Please sign in to comment.