diff options
| author | diogo464 <[email protected]> | 2025-07-13 11:10:11 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-07-13 11:10:11 +0100 |
| commit | bec283768544295a7dc18d36796447c7d0ab37c7 (patch) | |
| tree | a5901fe06fa55c6001bc0017ad0a85c12d90e8a3 | |
| parent | 56ee437c6d2dde9a80e9674d45be96fb7a18eec8 (diff) | |
updated README
| -rw-r--r-- | README.md | 24 |
1 files changed, 24 insertions, 0 deletions
| @@ -146,3 +146,27 @@ when the command finishes running the logs should be under the `logs/` directory | |||
| 146 | 9 │ round-trip min/avg/max = 50.337/50.377/50.421 ms | 146 | 9 │ round-trip min/avg/max = 50.337/50.377/50.421 ms |
| 147 | ───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── | 147 | ───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
| 148 | ``` | 148 | ``` |
| 149 | |||
| 150 | #### signals | ||
| 151 | the run subcommand tries to start all containers at the same time but even then, when running hundreds of containers, some of them will start tens of seconds apart from each other. to help synchronize container start up this subcommand also provides a way to signal containers. | ||
| 152 | a signal is an empty file located under the `/oar-p2p/` directory that is visible to the container. you can add code inside your container to loop and wait until a certain file exists under this dirctory. for example, starting containers with the following command: | ||
| 153 | ``` | ||
| 154 | oar-p2p run --output-dir logs --signal start:10 | ||
| 155 | ``` | ||
| 156 | will make the file `/oar-p2p/start` visibile to all containers 10 seconds after all containers are done starting. if the code inside the containers is made to wait for this file to appear then it is possible for all containers to start up within milliseconds of each other. here is some example java code you might use: | ||
| 157 | ```java | ||
| 158 | import java.nio.file.Files; | ||
| 159 | import java.nio.file.Path; | ||
| 160 | |||
| 161 | public static void waitForStartFile() { | ||
| 162 | Path startFile = Path.of("/oar-p2p/start"); | ||
| 163 | while (!Files.exists(startFile)) { | ||
| 164 | try { | ||
| 165 | Thread.sleep(250); | ||
| 166 | } catch (InterruptedException e) { | ||
| 167 | Thread.currentThread().interrupt(); | ||
| 168 | break; | ||
| 169 | } | ||
| 170 | } | ||
| 171 | } | ||
| 172 | ``` | ||
