aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/address_allocation_policy.rs1
-rw-r--r--src/context.rs6
-rw-r--r--src/main.rs28
3 files changed, 17 insertions, 18 deletions
diff --git a/src/address_allocation_policy.rs b/src/address_allocation_policy.rs
index 758ab21..1d282c3 100644
--- a/src/address_allocation_policy.rs
+++ b/src/address_allocation_policy.rs
@@ -153,4 +153,3 @@ mod tests {
153 assert!(AddressAllocationPolicy::from_str("10/ cpu").is_err()); 153 assert!(AddressAllocationPolicy::from_str("10/ cpu").is_err());
154 } 154 }
155} 155}
156
diff --git a/src/context.rs b/src/context.rs
index 4c1b639..1ca4f68 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -15,7 +15,7 @@ pub struct Context {
15 job_id: Option<u32>, 15 job_id: Option<u32>,
16 infer_job_id: bool, 16 infer_job_id: bool,
17 frontend_hostname: Option<String>, 17 frontend_hostname: Option<String>,
18 cluster_username: Option<String> 18 cluster_username: Option<String>,
19} 19}
20 20
21impl Context { 21impl Context {
@@ -23,14 +23,14 @@ impl Context {
23 job_id: Option<u32>, 23 job_id: Option<u32>,
24 infer_job_id: bool, 24 infer_job_id: bool,
25 frontend_hostname: Option<String>, 25 frontend_hostname: Option<String>,
26 cluster_username: Option<String> 26 cluster_username: Option<String>,
27 ) -> Result<Self> { 27 ) -> Result<Self> {
28 Ok(Self { 28 Ok(Self {
29 node: get_execution_node().await?, 29 node: get_execution_node().await?,
30 job_id, 30 job_id,
31 infer_job_id, 31 infer_job_id,
32 frontend_hostname, 32 frontend_hostname,
33 cluster_username 33 cluster_username,
34 }) 34 })
35 } 35 }
36 36
diff --git a/src/main.rs b/src/main.rs
index 64b2b1f..ec3f8f1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -61,7 +61,6 @@ struct Common {
61 /// cluster username, needed if running locally with differing usernames 61 /// cluster username, needed if running locally with differing usernames
62 #[clap(long, env = "CLUSTER_USERNAME")] 62 #[clap(long, env = "CLUSTER_USERNAME")]
63 cluster_username: Option<String>, 63 cluster_username: Option<String>,
64
65} 64}
66 65
67#[derive(Debug, Subcommand)] 66#[derive(Debug, Subcommand)]
@@ -245,7 +244,7 @@ async fn context_from_common(common: &Common) -> Result<Context> {
245 common.job_id, 244 common.job_id,
246 common.infer_job_id, 245 common.infer_job_id,
247 common.frontend_hostname.clone(), 246 common.frontend_hostname.clone(),
248 common.cluster_username.clone() 247 common.cluster_username.clone(),
249 ) 248 )
250 .await?; 249 .await?;
251 250
@@ -692,7 +691,9 @@ async fn machine_containers_save_logs(
692async fn machine_copy_logs_dir(ctx: &Context, machine: Machine, output_dir: &Path) -> Result<()> { 691async fn machine_copy_logs_dir(ctx: &Context, machine: Machine, output_dir: &Path) -> Result<()> {
693 tracing::info!("copying container logs from machine"); 692 tracing::info!("copying container logs from machine");
694 693
695 let mut rsync_rsh = "ssh -o ConnectionAttempts=3 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null".to_string(); 694 let mut rsync_rsh =
695 "ssh -o ConnectionAttempts=3 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
696 .to_string();
696 if ctx.node == ExecutionNode::Unknown { 697 if ctx.node == ExecutionNode::Unknown {
697 rsync_rsh += &format!(" -J {}", ctx.frontend_hostname()?); 698 rsync_rsh += &format!(" -J {}", ctx.frontend_hostname()?);
698 } 699 }
@@ -828,9 +829,9 @@ async fn machine_run(
828 arguments.push("-J"); 829 arguments.push("-J");
829 arguments.push(frontend); 830 arguments.push(frontend);
830 if ctx.cluster_username().is_ok() { 831 if ctx.cluster_username().is_ok() {
831 arguments.push("-l"); 832 arguments.push("-l");
832 arguments.push(ctx.cluster_username()?); 833 arguments.push(ctx.cluster_username()?);
833 } 834 }
834 arguments.push(machine.hostname()); 835 arguments.push(machine.hostname());
835 arguments 836 arguments
836 } 837 }
@@ -1072,14 +1073,13 @@ fn machine_generate_configs(
1072 .push(address); 1073 .push(address);
1073 } 1074 }
1074 1075
1075 if !matrix_wrap 1076 if !matrix_wrap && addresses.len() > matrix.dimension() {
1076 && addresses.len() > matrix.dimension() { 1077 return Err(eyre::eyre!(
1077 return Err(eyre::eyre!( 1078 "latency matrix is too small, size is {} but {} was required",
1078 "latency matrix is too small, size is {} but {} was required", 1079 matrix.dimension(),
1079 matrix.dimension(), 1080 addresses.len()
1080 addresses.len() 1081 ));
1081 )); 1082 }
1082 }
1083 1083
1084 for &machine in machines { 1084 for &machine in machines {
1085 let machine_addresses = &addresses_per_machine[&machine]; 1085 let machine_addresses = &addresses_per_machine[&machine];