mod.rs 891 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. use std::path::Path;
  2. use crate::{config::Config};
  3. // pub mod somatic;
  4. pub mod somatic_slurm;
  5. pub mod somatic;
  6. pub trait Initialize: Sized {
  7. fn initialize(id: &str, config: &Config) -> anyhow::Result<Self>;
  8. }
  9. pub trait InitializeSolo: Sized {
  10. fn initialize(id: &str, time: &str, config: &Config) -> anyhow::Result<Self>;
  11. }
  12. pub trait ShouldRun {
  13. fn should_run(&self) -> bool;
  14. }
  15. pub trait Version {
  16. fn version(config: &Config) -> anyhow::Result<String>;
  17. fn version_slurm(_config: &Config) -> anyhow::Result<String> {
  18. anyhow::bail!("No configured")
  19. }
  20. }
  21. // pub trait LoadVariants {
  22. // fn load_variants(&self) -> anyhow::Result<Variants>;
  23. // }
  24. pub fn exists_all(paths: Vec<&str>) -> anyhow::Result<()> {
  25. for path in paths.iter() {
  26. if !Path::new(path).exists() {
  27. anyhow::bail!("{path} should exist")
  28. }
  29. }
  30. Ok(())
  31. }