pub mod job;
pub mod slurm;
pub mod torque;
use clap::ValueEnum;
use notify::event::Event;
use std::path::{Path, PathBuf};
use job::JobInfo;
#[derive(ValueEnum, Clone, Debug)]
pub enum SchedulerKind {
Slurm,
Torque,
}
pub trait Scheduler: Send + Sync {
fn watch_locations(&self) -> Vec<PathBuf>;
fn create_job_info(&self, event_path: &Path) -> Option<Box<dyn JobInfo>>;
fn verify_event_kind(&self, event: &Event) -> Option<Vec<PathBuf>>;
}
pub fn create(
scheduler: &SchedulerKind,
spool_path: &Path,
cluster: &str,
filter_regex: &Option<String>,
) -> Box<dyn Scheduler> {
match scheduler {
SchedulerKind::Slurm => Box::new(slurm::Slurm::new(spool_path, cluster, filter_regex)),
SchedulerKind::Torque => Box::new(torque::Torque::new(spool_path, cluster)),
}
}
#[cfg(test)]
mod tests {}