use anyhow::Result;
use chrono::{DateTime, Utc};
use std::collections::HashMap;
use std::path::Path;
use super::common::{HpcJobInfo, HpcJobStats, HpcJobStatus};
pub trait HpcInterface: Send + Sync {
fn cancel_job(&self, job_id: &str) -> Result<i32>;
fn get_status(&self, job_id: &str) -> Result<HpcJobInfo>;
fn get_statuses(&self) -> Result<HashMap<String, HpcJobStatus>>;
#[allow(clippy::too_many_arguments)]
fn create_submission_script(
&self,
name: &str,
server_url: &str,
workflow_id: i64,
output_path: &str,
poll_interval: i32,
max_parallel_jobs: Option<i32>,
filename: &Path,
config: &HashMap<String, String>,
start_one_worker_per_node: bool,
tls_ca_cert: Option<&str>,
tls_insecure: bool,
startup_delay_seconds: u64,
) -> Result<()>;
fn get_current_job_id(&self) -> String;
fn get_environment_variables(&self) -> HashMap<String, String>;
fn get_job_end_time(&self) -> Result<DateTime<Utc>>;
fn get_job_stats(&self, job_id: &str) -> Result<HpcJobStats>;
fn get_local_scratch(&self) -> Result<String>;
fn get_memory_gb(&self) -> f64;
fn get_node_id(&self) -> String;
fn get_num_cpus(&self) -> usize;
fn get_num_cpus_per_task(&self) -> usize;
fn get_num_gpus(&self) -> usize;
fn get_num_nodes(&self) -> usize;
fn get_task_pid(&self) -> usize;
fn is_head_node(&self) -> bool;
fn list_active_nodes(&self, job_id: &str) -> Result<Vec<String>>;
fn submit(&self, filename: &Path) -> Result<(i32, String, String)>;
fn get_user(&self) -> Result<String> {
Ok(std::env::var("USER").or_else(|_| std::env::var("USERNAME"))?)
}
}