arvados-cli 0.1.20150323181012 → 0.1.20150408134718

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/crunch-job +30 -4
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2252134e27620eaa1147541b7454f7aca71f0eb
4
- data.tar.gz: 2d196c22729eb463cddc1016d51d7a27e7c5559e
3
+ metadata.gz: e449c9c026214121443a9ad97d7cc09ae6f2c3e6
4
+ data.tar.gz: 90798faa1b238688f89c8a7b663ef01ee2e88eca
5
5
  SHA512:
6
- metadata.gz: b15ca8ad6b008a4eadbca525f5c6f58b170fc158f5dd63e62a7f2f4b2b316cc39f2eb47845da2220d7ab17bcaccca116fd69a74839d7ca7865c445147707c035
7
- data.tar.gz: 12046acc2de9a57f0f02375604c9cb185710cf0331d6f9ed76bc0a4722119667abc038ec9ae7a0f1f3dd8f1e567430fa06aa0a5e276fe2d31777aefdadf675fd
6
+ metadata.gz: 5647d10464a059f48e80497b8c8ccdc43aa4285f832407712cb6edf1d5133425750433764765aad1537018bff850b2ee01287726cf495f175ab6282d089caef6
7
+ data.tar.gz: 1c166d1f37f97014e3183f63e3a818c8400b37fd6b8ef2f1f4758e9e69eefa6825edb5159910797bc0ed73e84d0c52bd6b217a3e962a703d996231c3fe75c81b
data/bin/crunch-job CHANGED
@@ -376,7 +376,7 @@ if (!defined $no_clear_tmp) {
376
376
 
377
377
  # If this job requires a Docker image, install that.
378
378
  my $docker_bin = "/usr/bin/docker.io";
379
- my ($docker_locator, $docker_stream, $docker_hash);
379
+ my ($docker_locator, $docker_stream, $docker_hash, $docker_limitmem);
380
380
  if ($docker_locator = $Job->{docker_image_locator}) {
381
381
  ($docker_stream, $docker_hash) = find_docker_image($docker_locator);
382
382
  if (!$docker_hash)
@@ -408,6 +408,12 @@ fi
408
408
  .exit_status_s($?));
409
409
  }
410
410
 
411
+ # Determine whether this version of Docker supports memory+swap limits.
412
+ srun(["srun", "--nodelist=" . $node[0]],
413
+ ["/bin/sh", "-ec", "$docker_bin run --help | grep -qe --memory-swap="],
414
+ {fork => 1});
415
+ $docker_limitmem = ($? == 0);
416
+
411
417
  if ($Job->{arvados_sdk_version}) {
412
418
  # The job also specifies an Arvados SDK version. Add the SDKs to the
413
419
  # tar file for the build script to install.
@@ -653,6 +659,10 @@ update_progress_stats();
653
659
 
654
660
 
655
661
  THISROUND:
662
+ my $tasks_this_level = 0;
663
+ foreach my $id (@jobstep_todo) {
664
+ $tasks_this_level++ if ($jobstep[$id]->{level} == $level);
665
+ }
656
666
  for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
657
667
  {
658
668
  my $id = $jobstep_todo[$todo_ptr];
@@ -710,6 +720,11 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
710
720
 
711
721
  $ENV{"GZIP"} = "-n";
712
722
 
723
+ my $max_node_concurrent_tasks = $ENV{CRUNCH_NODE_SLOTS};
724
+ if ($tasks_this_level < $max_node_concurrent_tasks) {
725
+ $max_node_concurrent_tasks = $tasks_this_level;
726
+ }
727
+
713
728
  my @srunargs = (
714
729
  "srun",
715
730
  "--nodelist=".$childnode->{name},
@@ -720,14 +735,25 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
720
735
  "if [ -e $ENV{TASK_WORK} ]; then rm -rf $ENV{TASK_WORK}; fi; "
721
736
  ."mkdir -p $ENV{CRUNCH_TMP} $ENV{JOB_WORK} $ENV{TASK_WORK} $ENV{TASK_KEEPMOUNT} "
722
737
  ."&& cd $ENV{CRUNCH_TMP} "
723
- ."&& MEM=\$(cat /proc/meminfo | grep MemTotal | sed 's/\\s\\s*/ /g' |cut -d' ' -f2) "
724
- ."&& MEMLIMIT=\$(( (\$MEM * 95) / ($ENV{CRUNCH_NODE_SLOTS} * 100) )) ";
738
+ # These environment variables get used explicitly later in
739
+ # $command. No tool is expected to read these values directly.
740
+ .q{&& MEM=$(awk '($1 == "MemTotal:"){print $2}' </proc/meminfo) }
741
+ .q{&& SWAP=$(awk '($1 == "SwapTotal:"){print $2}' </proc/meminfo) }
742
+ ."&& MEMLIMIT=\$(( (\$MEM * 95) / ($max_node_concurrent_tasks * 100) )) "
743
+ ."&& let SWAPLIMIT=\$MEMLIMIT+\$SWAP ";
725
744
  $command .= "&& exec arv-mount --by-id --allow-other $ENV{TASK_KEEPMOUNT} --exec ";
726
745
  if ($docker_hash)
727
746
  {
728
747
  my $cidfile = "$ENV{CRUNCH_TMP}/$Jobstep->{arvados_task}->{uuid}-$Jobstep->{failures}.cid";
729
748
  $command .= "crunchstat -cgroup-root=/sys/fs/cgroup -cgroup-parent=docker -cgroup-cid=$cidfile -poll=10000 ";
730
- $command .= "$docker_bin run --rm=true --attach=stdout --attach=stderr --attach=stdin -i --user=crunch --cidfile=$cidfile --sig-proxy --memory=\${MEMLIMIT}k ";
749
+ $command .= "$docker_bin run --rm=true --attach=stdout --attach=stderr --attach=stdin -i --user=crunch --cidfile=$cidfile --sig-proxy ";
750
+ # We only set memory limits if Docker lets us limit both memory and swap.
751
+ # Memory limits alone have been supported longer, but subprocesses tend
752
+ # to get SIGKILL if they exceed that without any swap limit set.
753
+ # See #5642 for additional background.
754
+ if ($docker_limitmem) {
755
+ $command .= "--memory=\${MEMLIMIT}k --memory-swap=\${SWAPLIMIT}k ";
756
+ }
731
757
 
732
758
  # Dynamically configure the container to use the host system as its
733
759
  # DNS server. Get the host's global addresses from the ip command,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arvados-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20150323181012
4
+ version: 0.1.20150408134718
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvados Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-23 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arvados
@@ -178,7 +178,7 @@ dependencies:
178
178
  - - "<"
179
179
  - !ruby/object:Gem::Version
180
180
  version: 1.0.0
181
- description: Arvados command line tools, git commit c1b4ee5b62630d6df3037955b68aa77ec3ee1f5a
181
+ description: Arvados command line tools, git commit e009f03d9f3a620f375cf187291bd12c2bf1d74c
182
182
  email: gem-dev@curoverse.com
183
183
  executables:
184
184
  - arv