diff options
| author | diogo464 <[email protected]> | 2025-07-17 10:34:14 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-07-17 10:34:14 +0100 |
| commit | e656cc7423da2d9978048a0f80455b8cb40d4e2b (patch) | |
| tree | 6c6ecfda49afb93e51170c972e30dc6d370313c8 /src/main.rs | |
| parent | 6d88de0cead092710b7cf17a2ab029347be14b8d (diff) | |
improved cli help text
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 55a96cd..aa673cb 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -42,9 +42,12 @@ struct Cli { | |||
| 42 | 42 | ||
| 43 | #[derive(Debug, Args)] | 43 | #[derive(Debug, Args)] |
| 44 | struct Common { | 44 | struct Common { |
| 45 | /// oar job id | ||
| 45 | #[clap(long, env = "OAR_JOB_ID")] | 46 | #[clap(long, env = "OAR_JOB_ID")] |
| 46 | job_id: Option<u32>, | 47 | job_id: Option<u32>, |
| 47 | 48 | ||
| 49 | /// hostname used to access the frontend using ssh. | ||
| 50 | /// i.e. `ssh <frontend-hostname>` should work. | ||
| 48 | #[clap(long, env = "FRONTEND_HOSTNAME")] | 51 | #[clap(long, env = "FRONTEND_HOSTNAME")] |
| 49 | frontend_hostname: Option<String>, | 52 | frontend_hostname: Option<String>, |
| 50 | } | 53 | } |
| @@ -73,8 +76,35 @@ enum NetSubCmd { | |||
| 73 | struct NetUpArgs { | 76 | struct NetUpArgs { |
| 74 | #[clap(flatten)] | 77 | #[clap(flatten)] |
| 75 | common: Common, | 78 | common: Common, |
| 79 | /// specify how addresses will be created. | ||
| 80 | /// | ||
| 81 | /// the address allocation policy specifies how addresses will be created. there are 3 | ||
| 82 | /// different ways to allocate addresses. | ||
| 83 | /// | ||
| 84 | /// 1. total number of addresses: in this policy, a fixed number of addresses will be allocated | ||
| 85 | /// between all machines in the job. this is represented by a single number, for example, | ||
| 86 | /// `64` will allocated a total of 64 addresses evenly across all machines in the job. | ||
| 87 | /// | ||
| 88 | /// 2. per cpu: in this policy, a set number of addresses will be allocated per cpu. machines | ||
| 89 | /// with more cpus will have more addresses. this is represented by `<n>/cpu`, for example, | ||
| 90 | /// `4/cpu` will allocated 4 addresses per cpu on every machine. | ||
| 91 | /// | ||
| 92 | /// 3. per machine: in this policy, a set number of addresses will be allocated per machine. | ||
| 93 | /// each machine gets the same amount of addresses. this is represented by `<n>/machine`, | ||
| 94 | /// for example, `64/machine` will allocate 64 addresses per machine on every machine. | ||
| 76 | #[clap(long)] | 95 | #[clap(long)] |
| 77 | addresses: AddressAllocationPolicy, | 96 | addresses: AddressAllocationPolicy, |
| 97 | |||
| 98 | /// path to the latency matrix. | ||
| 99 | /// | ||
| 100 | /// the latency matrix is a square matrix of latency values in milliseconds. | ||
| 101 | /// here is an example latency matrix:{n} | ||
| 102 | /// {n} | ||
| 103 | /// 0.0 25.5687 78.64806 83.50032 99.91315 {n} | ||
| 104 | /// 25.5687 0.0 63.165894 66.74037 110.71518 {n} | ||
| 105 | /// 78.64806 63.165894 0.0 2.4708898 93.90618 {n} | ||
| 106 | /// 83.50032 66.74037 2.4708898 0.0 84.67561 {n} | ||
| 107 | /// 99.91315 110.71518 93.90618 84.67561 0.0 {n} | ||
| 78 | #[clap(long)] | 108 | #[clap(long)] |
| 79 | latency_matrix: PathBuf, | 109 | latency_matrix: PathBuf, |
| 80 | } | 110 | } |
| @@ -108,12 +138,44 @@ struct RunArgs { | |||
| 108 | #[clap(flatten)] | 138 | #[clap(flatten)] |
| 109 | common: Common, | 139 | common: Common, |
| 110 | 140 | ||
| 141 | /// directory where all the log files will be placed. | ||
| 142 | /// | ||
| 143 | /// this directory will be created if it does not exist. | ||
| 144 | /// for each container, there will be a seperate file for the stdout and sterr. | ||
| 111 | #[clap(long)] | 145 | #[clap(long)] |
| 112 | output_dir: PathBuf, | 146 | output_dir: PathBuf, |
| 113 | 147 | ||
| 148 | /// declare a signal. this flag can be used more than once to declare multiple signals. | ||
| 149 | /// | ||
| 150 | /// a signal is an empty file that will be come visible to all containers after some amount of | ||
| 151 | /// time under the `/oar-p2p/` directory. a sginal has the format `<signal name>:<delay>`, | ||
| 152 | /// where the delay is given in seconds. using the signal `start:10` as an example, this means | ||
| 153 | /// that after all containers are started, a 10 second timer will start and when that timer | ||
| 154 | /// expires the file `/oar-p2p/start` will become visible to all containers at roughtly the | ||
| 155 | /// same time allowing them to synchronize their start-ups to within milliseconds. to make use | ||
| 156 | /// of this, your program running in the container must somehow wait for this file to come into | ||
| 157 | /// existance and this can be as simple as having a while loop checking for the file's existing | ||
| 158 | /// with a short sleep, here is an example in java:{n} | ||
| 159 | ///```java{n} | ||
| 160 | ///01. import java.nio.file.Files;{n} | ||
| 161 | ///02. import java.nio.file.Path;{n} | ||
| 162 | ///03. {n} | ||
| 163 | ///04. public static void waitForStartFile() {{n} | ||
| 164 | ///05. Path startFile = Path.of("/oar-p2p/start");{n} | ||
| 165 | ///06. while (!Files.exists(startFile)) {{n} | ||
| 166 | ///07. try {{n} | ||
| 167 | ///08. Thread.sleep(250);{n} | ||
| 168 | ///09. } catch (InterruptedException e) {{n} | ||
| 169 | ///10. Thread.currentThread().interrupt();{n} | ||
| 170 | ///11. break;{n} | ||
| 171 | ///12. }{n} | ||
| 172 | ///13. }{n} | ||
| 173 | ///14. }{n} | ||
| 174 | ///```{n} | ||
| 114 | #[clap(long)] | 175 | #[clap(long)] |
| 115 | signal: Vec<SignalSpec>, | 176 | signal: Vec<SignalSpec>, |
| 116 | 177 | ||
| 178 | /// the schedule used for execution. if not specified, it will be read from stdin. | ||
| 117 | schedule: Option<PathBuf>, | 179 | schedule: Option<PathBuf>, |
| 118 | } | 180 | } |
| 119 | 181 | ||
