[ARVADOS] created: c96d48a6a5c06a36fb3931c1c9650131e21d79c5
git at public.curoverse.com
git at public.curoverse.com
Thu Mar 19 10:49:08 EDT 2015
at c96d48a6a5c06a36fb3931c1c9650131e21d79c5 (commit)
commit c96d48a6a5c06a36fb3931c1c9650131e21d79c5
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Mar 19 10:52:42 2015 -0400
5425: Set memory limit on container as a fraction of total system memory
allocated to task each when invoking Docker.
diff --git a/sdk/cli/bin/crunch-job b/sdk/cli/bin/crunch-job
index b74d7af..ea9a987 100755
--- a/sdk/cli/bin/crunch-job
+++ b/sdk/cli/bin/crunch-job
@@ -719,13 +719,15 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
my $command =
"if [ -e $ENV{TASK_WORK} ]; then rm -rf $ENV{TASK_WORK}; fi; "
."mkdir -p $ENV{CRUNCH_TMP} $ENV{JOB_WORK} $ENV{TASK_WORK} $ENV{TASK_KEEPMOUNT} "
- ."&& cd $ENV{CRUNCH_TMP} ";
+ ."&& cd $ENV{CRUNCH_TMP} "
+ ."&& MEM=\$(cat /proc/meminfo | grep MemTotal | sed 's/\\s\\s*/ /g' |cut -d' ' -f2) "
+ ."&& MEMLIMIT=\$(( (\$MEM * 95) / ($ENV{CRUNCH_NODE_SLOTS} * 100) )) ";
$command .= "&& exec arv-mount --by-id --allow-other $ENV{TASK_KEEPMOUNT} --exec ";
if ($docker_hash)
{
my $cidfile = "$ENV{CRUNCH_TMP}/$Jobstep->{arvados_task}->{uuid}-$Jobstep->{failures}.cid";
$command .= "crunchstat -cgroup-root=/sys/fs/cgroup -cgroup-parent=docker -cgroup-cid=$cidfile -poll=10000 ";
- $command .= "$docker_bin run --rm=true --attach=stdout --attach=stderr --attach=stdin -i --user=crunch --cidfile=$cidfile --sig-proxy ";
+ $command .= "$docker_bin run --rm=true --attach=stdout --attach=stderr --attach=stdin -i --user=crunch --cidfile=$cidfile --sig-proxy --memory=\${MEMLIMIT}k ";
# Dynamically configure the container to use the host system as its
# DNS server. Get the host's global addresses from the ip command,
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list