arvados-cli 0.1.20140507111537 → 0.1.20140507113226

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/crunch-job +45 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 878dcd432ca0a5a9d5f3a5f8748bd37cbd6e4fc0
4
- data.tar.gz: 841aaed95eb94b5656db33d6adb2368620a904b5
3
+ metadata.gz: 4799416d5cef31a70a4c10ff82561bf85243afc6
4
+ data.tar.gz: 1700f4b6625d064d47179b184195ad50cd0c8103
5
5
  SHA512:
6
- metadata.gz: c4812e656ecd450fbfa185ece26b921181753c444cfaf41e833a38217b512bb553691d2d5ed69e91bf5be1dfa87e9bfab0a7d8e9975ea6516f6f09bacda83b22
7
- data.tar.gz: b0331563eddfdafe972e2d6da2fd65f135b8d46e7b0bf049bd283ea2a804439ca1762dfce015e1cff5d0ba631a3b822a7c2eb7e9c8cee50b9ea1ab70ca1e8d74
6
+ metadata.gz: c96958d07008b3ef0b1c6a31f14e48ad8bec9697558373f4cc4a3715b3d65dd5f5a098e139e0d7b1f6a796edea1e233b4a8ef94e28fecb501c7e67a6e7f44a76
7
+ data.tar.gz: 90ac89a22c4e48f709a1fa19494e127d93431d0289b630cb77f2192ba8e3c45df53689f14fd7f1ab4ccc0895b3e61a99b6de4b0e3f24d692886112b6666ba555
data/bin/crunch-job CHANGED
@@ -498,7 +498,30 @@ if (!$have_slurm)
498
498
  must_lock_now("$ENV{CRUNCH_TMP}/.lock", "a job is already running here.");
499
499
  }
500
500
 
501
-
501
+ # If this job requires a Docker image, install that.
502
+ my $docker_bin = "/usr/bin/docker.io";
503
+ my $docker_image = $Job->{runtime_constraints}->{docker_image} || "";
504
+ if ($docker_image) {
505
+ my $docker_pid = fork();
506
+ if ($docker_pid == 0)
507
+ {
508
+ srun (["srun", "--nodelist=" . join(' ', @node)],
509
+ [$docker_bin, 'pull', $docker_image]);
510
+ exit ($?);
511
+ }
512
+ while (1)
513
+ {
514
+ last if $docker_pid == waitpid (-1, WNOHANG);
515
+ freeze_if_want_freeze ($docker_pid);
516
+ select (undef, undef, undef, 0.1);
517
+ }
518
+ # If the Docker image was specified as a hash, pull will fail.
519
+ # Ignore that error. We'll see what happens when we try to run later.
520
+ if (($? != 0) && ($docker_image !~ /^[0-9a-fA-F]{5,}$/))
521
+ {
522
+ croak("Installing Docker image $docker_image returned exit code $?");
523
+ }
524
+ }
502
525
 
503
526
  foreach (qw (script script_version script_parameters runtime_constraints))
504
527
  {
@@ -603,7 +626,6 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
603
626
  qw(-n1 -c1 -N1 -D), $ENV{'TMPDIR'},
604
627
  "--job-name=$job_id.$id.$$",
605
628
  );
606
- my @execargs = qw(sh);
607
629
  my $build_script_to_send = "";
608
630
  my $command =
609
631
  "if [ -e $ENV{TASK_WORK} ]; then rm -rf $ENV{TASK_WORK}; fi; "
@@ -615,8 +637,27 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
615
637
  $command .=
616
638
  "&& perl -";
617
639
  }
618
- $command .=
619
- "&& exec arv-mount $ENV{TASK_KEEPMOUNT} --exec $ENV{CRUNCH_SRC}/crunch_scripts/" . $Job->{"script"};
640
+ $command .= "&& exec arv-mount --allow-other $ENV{TASK_KEEPMOUNT} --exec ";
641
+ if ($docker_image)
642
+ {
643
+ $command .= "$docker_bin run -i -a stdin -a stdout -a stderr ";
644
+ # Dynamically configure the container to use the host system as its
645
+ # DNS server. Get the host's global addresses from the ip command,
646
+ # and turn them into docker --dns options using gawk.
647
+ $command .=
648
+ q{$(ip -o address show scope global |
649
+ gawk 'match($4, /^([0-9\.:]+)\//, x){print "--dns", x[1]}') };
650
+ foreach my $env_key (qw(CRUNCH_SRC CRUNCH_TMP TASK_KEEPMOUNT))
651
+ {
652
+ $command .= "-v \Q$ENV{$env_key}:$ENV{$env_key}:rw\E ";
653
+ }
654
+ while (my ($env_key, $env_val) = each %ENV)
655
+ {
656
+ $command .= "-e \Q$env_key=$env_val\E ";
657
+ }
658
+ $command .= "$docker_image ";
659
+ }
660
+ $command .= "$ENV{CRUNCH_SRC}/crunch_scripts/" . $Job->{"script"};
620
661
  my @execargs = ('bash', '-c', $command);
621
662
  srun (\@srunargs, \@execargs, undef, $build_script_to_send);
622
663
  exit (111);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arvados-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20140507111537
4
+ version: 0.1.20140507113226
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvados Authors
@@ -146,7 +146,7 @@ dependencies:
146
146
  - - ~>
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0.8'
149
- description: This is the Arvados SDK CLI gem, git revision 8fcba3783d9a79bb18a00d339f9b3222f1eccd7f
149
+ description: This is the Arvados SDK CLI gem, git revision 222ce386e36b3d146e718a5d2f64a95fb30996bb
150
150
  email: gem-dev@curoverse.com
151
151
  executables:
152
152
  - arv