Skip to content

Commit c6ed8a8

Browse files
committed
docs: added paragraphs about dynamic resource allocation (#79)
1 parent 03a22e6 commit c6ed8a8

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

docs/further.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,57 @@ export SNAKEMAKE_PROFILE="$HOME/.config/snakemake"
226226

227227
Further note, that there is further development ongoing to enable differentiation of file access patterns.
228228

229+
## Retries - Or Trying again when a Job failed
230+
231+
Some cluster jobs may fail. In this case Snakemake can be instructed to try another submit before the entire workflow fails, in this example up to 3 times:
232+
233+
```console
234+
snakemake --retries=3
235+
```
236+
237+
If a workflow fails entirely (e.g. when there are cluster failures), it can be resumed as any other Snakemake workflow:
238+
239+
```console
240+
snakemake --rerun-incomplete
241+
```
242+
243+
To prevent failures due to faulty parameterization, we can dynamically adjust the runtime behaviour:
244+
245+
## Dynamic Parameterization
246+
247+
Using dynamic parameterization we can react on different different inputs and prevent our HPC jobs from failing.
248+
249+
### Adjusting Memory Requirements
250+
251+
Input size of files may vary. [If we have an estimate for the RAM requirement due to varying input file sizes, we can use this to dynamically adjust our jobs.](https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#dynamic-resources)
252+
253+
### Adjusting Runtime
254+
255+
Runtime adjustments can be made in a Snakefile:
256+
257+
```Python
258+
def get_time(wildcards, attempt):
259+
return f"{1 * attempt}h"
260+
261+
rule foo:
262+
input: ...
263+
output: ...
264+
resources:
265+
runtime=get_time
266+
...
267+
```
268+
269+
or in a workflow profile
270+
271+
```YAML
272+
set-resources:
273+
foo:
274+
runtime: f"{1 * attempt}h"
275+
```
276+
277+
Be sure to use sensible settings for your cluster and make use of parallel execution (e.g. threads) and [global profiles](#using-profiles) to avoid I/O contention.
278+
279+
229280
## Summary:
230281

231282
When put together, a frequent command line looks like:

0 commit comments

Comments
 (0)