-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernize task CPU/memory usage example plugin (#675)
Detects cgroup v1 or v2 and adjusts accordingly
- Loading branch information
Showing
3 changed files
with
85 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version 1.1 | ||
# MINIWDL__LOG_TASK_USAGE__PERIOD=2 miniwdl run examples/plugin_log_task_usage/StressTest.wdl --dir /tmp --verbose | ||
# MINIWDL__LOG_TASK_USAGE__PERIOD=2 miniwdl-aws-submit plugin_log_task_usage/StressTest.wdl --verbose --follow | ||
task StressTest { | ||
input { | ||
Int cpu = 4 | ||
Int memory_G = 2 | ||
Int cpu_memory_duration_s = 10 | ||
Int disk_load_G = 4 | ||
|
||
String docker = "polinux/stress" # Docker image with stress tool | ||
} | ||
|
||
command <<< | ||
set -euxo pipefail | ||
|
||
>&2 ls -l /sys/fs/cgroup | ||
|
||
stress --cpu 4 --vm 1 --vm-bytes ~{memory_G}G --vm-hang 0 --timeout ~{cpu_memory_duration_s}s || true | ||
dd if=/dev/zero of=testfile bs=1G count=~{disk_load_G} | ||
sync | ||
cat testfile > /dev/null & | ||
sleep 5 | ||
>>> | ||
|
||
runtime { | ||
docker: docker | ||
memory: "${memory_G*2}G" | ||
cpu: cpu | ||
} | ||
|
||
output {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters