Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,979 changes: 592 additions & 1,387 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = ["coman", "firecrest_client"]
resolver = "3"

[workspace.dependencies]
firecrest_client = { path = "./firecrest_client", version = "2.4.0" }
firecrest_client = { path = "./firecrest_client", version = "2.5.0" }
Comment thread
Panaetius marked this conversation as resolved.

[profile.release]
strip = true
Expand Down
19 changes: 7 additions & 12 deletions coman/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ clap = { version = "4.5.20", features = [
"string",
"unstable-styles",
] }
cli-log = "2.1.0"
color-eyre = "0.6.5"
config = "0.14.0"
config = "0.15.19"
Comment thread
Panaetius marked this conversation as resolved.
crossterm = { version = "0.29.0", features = ["serde", "event-stream"] }
derive_deref = "1.1.1"
directories = "5.0.1"
directories = "6.0.0"
Comment thread
Panaetius marked this conversation as resolved.
eyre = "0.6.12"
futures = "0.3.31"
human-panic = "2.0.2"
itertools = "0.14.0"
json5 = "0.4.1"
keyring-lib = { version = "1.0.2", features = [
"tokio",
"derive",
Expand All @@ -40,7 +37,6 @@ libc = "0.2.161"
open = "5.3.2"
firecrest_client = { workspace = true }
openidconnect = "4.0.1"
pretty_assertions = "1.4.1"
ratatui = { version = "0.29.0", features = ["serde", "macros"] }
reqwest = "0.12.23"
serde = { version = "1.0.211", features = ["derive"] }
Expand All @@ -51,7 +47,7 @@ strum = { version = "0.26.3", features = ["derive"] }
strum_macros = "0.27.2"
tokio = { version = "1.47.1", features = ["full"] }
tokio-util = "0.7.16"
toml = "0.9.7"
toml = "1.0.4"
Comment thread
Panaetius marked this conversation as resolved.
tracing = "0.1.40"
tracing-error = "0.2.0"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "serde"] }
Expand All @@ -71,12 +67,11 @@ docker_credential = "1.3.2"
chrono = "0.4.42"
openssl = { version = "0.10.75", features = ["vendored"] }
tui-realm-treeview = "3.0.0"
aws-sdk-s3 = "1.115.0"
toml_edit = "0.23.9"
toml_edit = "0.25.4"
Comment thread
Panaetius marked this conversation as resolved.
clap_complete = { version = "4.5.61", features = ["unstable-dynamic"] }
pid1 = "0.1.5"
rust_supervisor = "0.2.0"
iroh-ssh = "0.2.7"
iroh-ssh = "0.2.9"
Comment thread
Panaetius marked this conversation as resolved.
whoami = "1.6.1"
base64 = "0.22.1"
iroh = "0.95.1"
Expand All @@ -99,8 +94,8 @@ self_update = { version = "0.42.0", features = [
] }

[build-dependencies]
anyhow = "1.0.90"
vergen-gix = { version = "1.0.2", features = ["build", "cargo"] }
anyhow = "1.0.102"
Comment thread
Panaetius marked this conversation as resolved.
vergen-gix = { version = "9.1.0", features = ["build", "cargo"] }
Comment thread
Panaetius marked this conversation as resolved.

[dev-dependencies]
claim = "0.5.0"
Expand Down
11 changes: 6 additions & 5 deletions coman/src/app/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ use std::path::PathBuf;

use crate::{
app::user_events::UserEvent,
cscs::api_client::types::{JobDetail, System},
cscs::api_client::types::{JobDetail, JobId, System},
Comment thread
Panaetius marked this conversation as resolved.
};

#[derive(Debug, PartialEq)]
#[allow(clippy::large_enum_variant)]
Comment thread
Panaetius marked this conversation as resolved.
pub enum MenuMsg {
Opened,
Closed,
Expand Down Expand Up @@ -52,11 +53,11 @@ pub enum CscsMsg {
}
#[derive(Debug, PartialEq)]
pub enum JobMsg {
Log(usize),
ResourceUsage(usize),
Log(JobId),
Comment thread
Panaetius marked this conversation as resolved.
ResourceUsage(JobId),
Comment thread
Panaetius marked this conversation as resolved.
Details(JobDetail),
GetDetails(usize),
Cancel(usize),
GetDetails(JobId),
Comment thread
Panaetius marked this conversation as resolved.
Cancel(JobId),
Comment thread
Panaetius marked this conversation as resolved.
Switch,
Close,
}
Expand Down
2 changes: 1 addition & 1 deletion coman/src/cli/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub enum CliCommands {
command: Vec<String>,
},
#[clap(hide = true)]
Proxy { system: String, job_id: i64 },
Proxy { system: String, job_id: String },
Comment thread
Panaetius marked this conversation as resolved.
}

#[derive(Subcommand, Debug)]
Expand Down
19 changes: 13 additions & 6 deletions coman/src/cli/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ use color_eyre::{Result, eyre::eyre};

use crate::{
config::get_data_dir,
cscs::{api_client::types::JobStatus, handlers::cscs_job_details},
cscs::{
api_client::types::{JobId, JobStatus},
handlers::cscs_job_details,
},
};

/// Thin wrapper around iroh proxy
pub(crate) async fn cli_proxy_command(system: String, job_id: i64) -> Result<()> {
pub(crate) async fn cli_proxy_command(system: String, job_id: JobId) -> Result<()> {
Comment thread
Panaetius marked this conversation as resolved.
let data_dir = get_data_dir();
let job_info = cscs_job_details(job_id, Some(system.clone()), None).await?;
let job_info = cscs_job_details(job_id.clone(), Some(system.clone()), None).await?;
Comment thread
Panaetius marked this conversation as resolved.
if job_info.is_none() {
return Err(eyre!("remote job does not exist!"));
} else if let Some(job_info) = job_info
Expand All @@ -18,7 +21,11 @@ pub(crate) async fn cli_proxy_command(system: String, job_id: i64) -> Result<()>
}
let endpoint_id = std::fs::read_to_string(data_dir.join(format!("{}_{}.endpoint", system, job_id)))?;
println!("{}", endpoint_id);
iroh_ssh::api::proxy_mode(iroh_ssh::ProxyArgs { node_id: endpoint_id })
.await
.map_err(|e| eyre!("couldn't proxy ssh connection: {:?}", e))
iroh_ssh::api::proxy_mode(iroh_ssh::ProxyArgs {
Comment thread
Panaetius marked this conversation as resolved.
endpoint_id,
relay_url: Vec::new(),
extra_relay_url: Vec::new(),
})
.await
.map_err(|e| eyre!("couldn't proxy ssh connection: {:?}", e))
}
2 changes: 0 additions & 2 deletions coman/src/components/file_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use crate::{
user_events::{FileEvent, UserEvent},
},
cscs::{api_client::types::PathType, ports::BackgroundTask},
trace_dbg,
};

#[derive(Debug, PartialEq, PartialOrd, Ord, Eq, Clone)]
Expand Down Expand Up @@ -179,7 +178,6 @@ impl Component<Msg, UserEvent> for FileTree {
Event::User(UserEvent::File(FileEvent::DeleteCurrentFile)) => {
if let State::One(StateValue::String(id)) = self.state() {
let tree_tx = self.file_tree_tx.clone();
let id = trace_dbg!(id);
tokio::spawn(async move {
tree_tx.send(BackgroundTask::DeleteFile(id)).await.unwrap();
Comment thread
Panaetius marked this conversation as resolved.
});
Expand Down
2 changes: 1 addition & 1 deletion coman/src/components/workload_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl Component<Msg, UserEvent> for WorkloadDetails {
code: Key::Char('l'),
modifiers: KeyModifiers::NONE,
}) => {
return Some(Msg::Job(JobMsg::Log(self.details.id)));
return Some(Msg::Job(JobMsg::Log(self.details.id.clone())));
Comment thread
Panaetius marked this conversation as resolved.
}
Event::Keyboard(KeyEvent { code: Key::Esc, .. }) => {
return Some(Msg::Job(JobMsg::Close));
Expand Down
56 changes: 29 additions & 27 deletions coman/src/cscs/api_client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use reqwest::Url;

use crate::{
config::{ComputePlatform, Config},
cscs::api_client::types::{FileStat, Job, JobDetail, PathEntry, S3Upload, System, UserInfo},
cscs::api_client::types::{FileStat, Job, JobDetail, JobId, PathEntry, S3Upload, System, UserInfo},
trace_dbg,
util::types::DockerImageUrl,
};
Expand Down Expand Up @@ -79,7 +79,7 @@ impl CscsApi {
script_path: PathBuf,
envvars: HashMap<String, String>,
options: JobStartOptions,
) -> Result<Option<i64>> {
) -> Result<Option<JobId>> {
let workingdir = script_path.clone();
let workingdir = workingdir.parent();
let result = post_compute_system_job(
Expand All @@ -98,7 +98,7 @@ impl CscsApi {
)
.await?;

Ok(result.job_id)
Ok(result.job_id.map(|i| i.into()))
}
pub async fn get_system(&self, system: &str) -> Result<Option<System>> {
let systems = self.list_systems().await?;
Expand All @@ -119,8 +119,8 @@ impl CscsApi {
.map(|jobs| jobs.into_iter().map(|j| j.into()).collect())
.unwrap_or(vec![]))
}
pub async fn get_job(&self, system_name: &str, job_id: i64) -> Result<Option<JobDetail>> {
let jobs = get_compute_system_job(&self.client, system_name, job_id)
pub async fn get_job(&self, system_name: &str, job_id: JobId) -> Result<Option<JobDetail>> {
let jobs = get_compute_system_job(&self.client, system_name, job_id.clone().into_string())
.await
.wrap_err("couldn't fetch job info")?;
let job = if let Some(jobs) = jobs.jobs
Expand All @@ -130,7 +130,7 @@ impl CscsApi {
} else {
return Ok(None);
};
let job_metadata = get_compute_system_job_metadata(&self.client, system_name, job_id)
let job_metadata = get_compute_system_job_metadata(&self.client, system_name, job_id.into_string())
.await
.wrap_err("couldn't fetch job metadata")?;
let job_metadata = if let Some(meta) = job_metadata.jobs
Expand All @@ -143,8 +143,8 @@ impl CscsApi {
Ok(Some((job, job_metadata).into()))
}

pub async fn cancel_job(&self, system_name: &str, job_id: i64) -> Result<()> {
cancel_compute_system_job(&self.client, system_name, job_id)
pub async fn cancel_job(&self, system_name: &str, job_id: JobId) -> Result<()> {
cancel_compute_system_job(&self.client, system_name, job_id.into_string())
.await
.wrap_err("couldn't delete job")?;
Ok(())
Expand Down Expand Up @@ -180,12 +180,15 @@ impl CscsApi {
account: Option<String>,
target: PathBuf,
size: i64,
) -> Result<(i64, S3Upload)> {
) -> Result<(JobId, S3Upload)> {
let job = post_filesystem_transfer_upload(&self.client, system_name, account, target, size)
.await
.wrap_err("couldn't upload file")?;
if let DownloadFileResponseTransferDirectives::S3(directives) = job.transfer_directives {
Ok((job.transfer_job.job_id, S3Upload::convert(directives, size as u64)?))
Ok((
job.transfer_job.job_id.into(),
S3Upload::convert(directives, size as u64)?,
))
} else {
trace_dbg!(job);
Err(eyre!("didn't get S3 transfer directive"))
Expand All @@ -202,13 +205,13 @@ impl CscsApi {
system_name: &str,
account: Option<String>,
path: PathBuf,
) -> Result<(i64, Url)> {
) -> Result<(JobId, Url)> {
let job = post_filesystem_transfer_download(&self.client, system_name, account, path)
.await
.wrap_err("couldn't transfer file")?;
if let DownloadFileResponseTransferDirectives::S3(directives) = job.transfer_directives {
let download_url = Url::parse(&directives.download_url.unwrap())?;
Ok((job.transfer_job.job_id, download_url))
Ok((job.transfer_job.job_id.into(), download_url))
} else {
Err(eyre!("didn't get S3 transfer directive"))
}
Expand Down Expand Up @@ -255,8 +258,7 @@ mod tests {
use claim::*;
use firecrest_client::types::{
DownloadFileResponse, GetJobMetadataResponse, GetJobResponse, GetSystemsResponse, HPCCluster, JobMetadataModel,
JobModel, JobStatus, LibDatatransfersDatatransferBaseTransferJob, PostJobSubmissionResponse,
S3TransferResponse, UploadFileResponse,
JobModel, JobStatus, PostJobSubmissionResponse, S3TransferResponse, TransferJob, UploadFileResponse,
};
use injectorpp::interface::injector::*;

Expand Down Expand Up @@ -359,7 +361,7 @@ mod tests {
jobs: Some(vec![
JobModel {
name: "Job1".to_owned(),
job_id: 1,
job_id: "1".to_owned(),
status: JobStatus {
state: "RUNNING".to_owned(),
..Default::default()
Expand All @@ -368,7 +370,7 @@ mod tests {
},
JobModel {
name: "Job2".to_owned(),
job_id: 2,
job_id: "2".to_owned(),
status: JobStatus {
state: "FAILED".to_owned(),
..Default::default()
Expand All @@ -377,7 +379,7 @@ mod tests {
},
JobModel {
name: "Job3".to_owned(),
job_id: 3,
job_id: "3".to_owned(),
status: JobStatus {
state: "COMPLETED".to_owned(),
..Default::default()
Expand All @@ -386,7 +388,7 @@ mod tests {
},
JobModel {
name: "Job4".to_owned(),
job_id: 4,
job_id: "4".to_owned(),
status: JobStatus {
state: "PENDING".to_owned(),
..Default::default()
Expand All @@ -395,7 +397,7 @@ mod tests {
},
JobModel {
name: "Job5".to_owned(),
job_id: 5,
job_id: "5".to_owned(),
status: JobStatus {
state: "CANCELLED".to_owned(),
..Default::default()
Expand All @@ -418,14 +420,14 @@ mod tests {
let mut injector = InjectorPP::new();
injector
.when_called_async(injectorpp::async_func!(
firecrest_client::compute_api::get_compute_system_job(&client.client, "", 1,),
firecrest_client::compute_api::get_compute_system_job(&client.client, "", "1".to_owned(),),
Result<GetJobResponse>
))
.will_return_async(injectorpp::async_return!(
Ok(GetJobResponse {
jobs: Some(vec![JobModel {
name: "Job1".to_owned(),
job_id: 1,
job_id: "1".to_owned(),
Comment thread
Panaetius marked this conversation as resolved.
status: JobStatus {
state: "RUNNING".to_owned(),
..Default::default()
Expand All @@ -437,7 +439,7 @@ mod tests {
));
injector
.when_called_async(injectorpp::async_func!(
firecrest_client::compute_api::get_compute_system_job_metadata(&client.client, "", 1,),
firecrest_client::compute_api::get_compute_system_job_metadata(&client.client, "", "1".to_owned(),),
Result<GetJobMetadataResponse>
))
.will_return_async(injectorpp::async_return!(
Expand All @@ -449,7 +451,7 @@ mod tests {
}),
Result<GetJobMetadataResponse>
));
let result = client.get_job("test", 1).await;
let result = client.get_job("test", "1".into()).await;
Comment thread
Panaetius marked this conversation as resolved.
assert_ok!(result);
}
}
Expand All @@ -471,7 +473,7 @@ mod tests {
))
.will_return_async(injectorpp::async_return!(
Ok(UploadFileResponse {
transfer_job: LibDatatransfersDatatransferBaseTransferJob {
transfer_job: TransferJob {
Comment thread
Panaetius marked this conversation as resolved.
job_id: 1,
..Default::default()
},
Expand All @@ -486,7 +488,7 @@ mod tests {
Result<UploadFileResponse>
));
let result = client.transfer_upload("test", None, PathBuf::from("/test"), 100).await;
assert_eq!(result.unwrap().0, 1);
assert_eq!(result.unwrap().0.as_ref(), "1");
Comment thread
Panaetius marked this conversation as resolved.
}

#[tokio::test]
Expand All @@ -505,7 +507,7 @@ mod tests {
))
.will_return_async(injectorpp::async_return!(
Ok(DownloadFileResponse {
transfer_job: LibDatatransfersDatatransferBaseTransferJob {
transfer_job: TransferJob {
Comment thread
Panaetius marked this conversation as resolved.
job_id: 1,
..Default::default()
},
Expand All @@ -519,7 +521,7 @@ mod tests {
));
let result = client.transfer_download("test", None, PathBuf::from("/test")).await;
let result = result.unwrap();
assert_eq!(result.0, 1);
assert_eq!(result.0.as_ref(), "1");
Comment thread
Panaetius marked this conversation as resolved.
assert_eq!(result.1, Url::parse("http://download").unwrap())
}
}
Loading
Loading