-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest-final.sh
executable file
·30 lines (23 loc) · 1.12 KB
/
test-final.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Run the final container with the ../test/test_config.yaml, write results and logs to /tmp
export LC_ALL="C"
set -euo pipefail
# Full path to the 'test' directory that has config and isolates
TEST_DIR="$(realpath "$(dirname "$0")/../test")"
# Use a system mktemp directory for the outputs
TMP_DIR="$(mktemp -d)"
mkdir -p "$TMP_DIR/logs" "$TMP_DIR/results"
# Would rather use -u "$(id -u):$(id -g)" to run the container as the invoking user, but it can't be readonly
# (snakemake chokes on that), and the files inside are root-owned, so our output will be root-owned unless
# the Docker daemon was set up with user namespaces. Time to move on to Podman or Singularity.
docker run -it --rm --tmpfs /.cache --tmpfs /run --tmpfs /tmp \
-v "$TEST_DIR:/test:ro" -v "$TMP_DIR/results:/results" -v "$TMP_DIR/logs:/logs" \
'localhost/hamronization_workflow' \
snakemake --configfile 'test/test_config.yaml' --use-conda --cores $(nproc) || true
printf '
--------------------------------
Container test outputs are here:
- logs: %s/logs
- results: %s/results
--------------------------------
' "$TMP_DIR" "$TMP_DIR"