SLURM Run class to manage SLURM job execution
PMSlurmRun.RdThis object represents a SLURM job that has been submitted. It provides methods to check job status, get results, and cancel the job.
Public fields
job_idCharacter. The SLURM job ID
analysis_pathCharacter. Path to the analysis folder
result_pathCharacter. Path where results will be stored
log_pathCharacter. Path to the SLURM output log file
error_log_pathCharacter. Path to the SLURM error log file
Methods
Method new()
Create a PMSlurmRun object
Usage
PMSlurmRun$new(job_id, analysis_path, result_path, log_path, error_log_path)Method is_successful()
Check if the SLURM job completed successfully
Method get_results()
Get the results from the SLURM job
Arguments
timeoutNumeric. Optional timeout in seconds. If provided, will wait for the job to complete (blocking) up to the timeout duration before failing. If NULL (default), returns immediately if job is not done.
Examples
if (FALSE) { # \dontrun{
# Run a function in SLURM
analysis <- pm$get_analysis("my_analysis")
slurm_run <- analysis$run_in_slurm(function() {
# Your analysis code here
result <- compute_something()
return(result)
})
# Check if job is done
slurm_run$is_done()
# Get results (errors if not done)
results <- slurm_run$get_results()
# Cancel the job
slurm_run$cancel()
} # }