pub enum DependencyType {
After(String),
AfterTimeDelay(String, String),
AfterAny(String),
AfterBurstBuffer(String),
AfterCorr(String),
AfterNotOk(String),
AfterOk(String),
Singleton,
}Expand description
Sbatch dependency type
The DependencyType enum is used to represent the different types of dependencies that can be used in a Slurm job script.
For more details on the different types of dependencies, see the Slurm documentation: https://slurm.schedmd.com/sbatch.html.
After(String): The job can start after the specified job startAfterTimeDelay(String, String): The job can start after the specified job starts with a time delay.AfterAny(String): This job can begin execution after the specified jobs have terminated. This is the default dependency type. (Any exit status).AfterBurstBuffer(String): This job can begin execution after the specified jobs have terminated and any associated burst buffer stage out operations have completed.AfterCorr(String): A task of this job array can begin execution after the corresponding task ID in the specified job has completed successfully (ran to completion with an exit code of zero).AfterNotOk(String): This job can begin execution after the specified jobs have terminated in some failed state (non-zero exit code, node failure, timed out, etc).AfterOk(String): This job can begin execution after the specified jobs have successfully executed (ran to completion with an exit code of zero).Singleton: This job can begin execution after any previously launched jobs sharing the same job name and user have terminated. In other words, only one job by that name and owned by that user can be running or suspended at any point in time.
Variants§
After(String)
Maps to the after:<job_id> dependency type
AfterTimeDelay(String, String)
Maps to the after:<job_id>+<time_delay> dependency type
AfterAny(String)
Maps to the afterany:<job_id> dependency type
AfterBurstBuffer(String)
Maps to the afterburstbuffer:<job_id> dependency type
AfterCorr(String)
Maps to the aftercorr:<job_id> dependency type
AfterNotOk(String)
Maps to the afternotok:<job_id> dependency type
AfterOk(String)
Maps to the afterok:<job_id> dependency type
Singleton
Maps to the singleton dependency type
Implementations§
Source§impl DependencyType
impl DependencyType
Sourcepub fn validate(&self) -> Result<(), DependencyTypeError>
pub fn validate(&self) -> Result<(), DependencyTypeError>
Validates the dependency type.
§Returns
This function returns Ok(()) if the dependency type is valid, otherwise it returns a DependencyTypeError.
§Errors
This function returns a DependencyTypeError if the dependency type is invalid.
The following are considered invalid:
- An empty string
- A string that contains leading or trailing spaces
§Examples
use sbatch_rs::DependencyType;
// Valid: mapped to `after:123`
let dependency_type = DependencyType::After("123".to_string());
assert!(dependency_type.validate().is_ok());
// Valid: mapped to `after:123+10`
let dependency_type = DependencyType::AfterTimeDelay("123".to_string(), "10".to_string());
assert!(dependency_type.validate().is_ok());
// Invalid: empty string
let dependency_type = DependencyType::After("".to_string());
assert!(dependency_type.validate().is_err());
// Invalid: leading or trailing spaces
let dependency_type = DependencyType::After(" 123 ".to_string());
assert!(dependency_type.validate().is_err());Trait Implementations§
Source§impl Clone for DependencyType
impl Clone for DependencyType
Source§fn clone(&self) -> DependencyType
fn clone(&self) -> DependencyType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DependencyType
impl Debug for DependencyType
Source§impl Display for DependencyType
impl Display for DependencyType
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Display the DependencyType value as a string.
§Examples
use sbatch_rs::DependencyType;
// Display the `After` variant
let dependency_type = DependencyType::After("123".to_string());
assert_eq!(dependency_type.to_string(), "after:123");
// Display the `AfterTimeDelay` variant
let dependency_type = DependencyType::AfterTimeDelay("123".to_string(), "10".to_string());
assert_eq!(dependency_type.to_string(), "after:123+10");
// Display the `AfterAny` variant
let dependency_type = DependencyType::AfterAny("123".to_string());
assert_eq!(dependency_type.to_string(), "afterany:123");
// Display the `Singleton` variant
let dependency_type = DependencyType::Singleton;
assert_eq!(dependency_type.to_string(), "singleton");