Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slurm Collector: Handling of .extern jobsteps #812

Open
rkleinem opened this issue May 8, 2024 · 0 comments
Open

Slurm Collector: Handling of .extern jobsteps #812

rkleinem opened this issue May 8, 2024 · 0 comments

Comments

@rkleinem
Copy link
Collaborator

rkleinem commented May 8, 2024

Depending on the configuration, Slurm will create .extern jobsteps (See https://slurm.schedmd.com/job_launch.html#job_record).
Currently the collector seems to understand these as separate jobs. Since these steps lack some fields, several keys are not found in 240 of

sacct_rows
.keys()
.filter(|k| !BATCH_REGEX.is_match(k))
.filter(|k| !SUB_REGEX.is_match(k))
.map(|id| -> Result<Job> {
let map1 = sacct_rows.get(id).ok_or(eyre!("Cannot get map1"))?;
let map2 = sacct_rows.get(&format!("{id}.batch"));
Ok(keys.iter()
.cloned()
.filter_map(|KeyConfig {name: k, key_type: _, allow_empty: _}| {
let val = match map1.get(&k) {
Some(Some(v)) => Some(v.clone()),
_ => {
if let Some(map2) = map2 {
match map2.get(&k) {
Some(Some(v)) => Some(v.clone()),
_ => {
tracing::error!("Something went wrong during parsing (map1, id: {id}, key: {k}, value: {:?})", map2.get(&k));
None
},
}
} else {
tracing::error!("Something went wrong during parsing (map2, id: {id}, key: {k}, value: {:?})", map1.get(&k));
None
}

and an associated .batch step will never be found since the collector would look for a .extern.batch step, resulting in a message from line 252.

I am not yet 100% sure how Slurm calculates these but I think it would be enough to introduce another filter

.filter(|k| !EXTERN_REGEX.is_match(k))

with

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

Sidenote:
There is an underscore missing in

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant