pub mod job;
pub mod slurm;
pub mod torque;
use clap::{Subcommand, ValueEnum};
use notify::event::Event;
use std::path::{Path, PathBuf};
use job::JobInfo;
use slurm::SlurmArgs;
use torque::TorqueArgs;
#[derive(Clone, ValueEnum)]
pub enum SchedulerKind {
Slurm,
Torque,
}
#[derive(Subcommand)]
pub enum SchedArgs {
Slurm(SlurmArgs),
Torque(TorqueArgs),
}
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(kind: &SchedulerKind, spool_path: &Path, cluster: &str) -> Box<dyn Scheduler> {
match kind {
SchedulerKind::Slurm => Box::new(slurm::Slurm::new(spool_path, cluster)),
SchedulerKind::Torque => Box::new(torque::Torque::new(spool_path, cluster)),
}
}
#[cfg(test)]
mod tests {}