arvados-cli 0.1.20150527201024 → 0.1.20150529160203

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 +42 -10
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bafef169f074ca61d533298a5e462905d9764846
4
- data.tar.gz: bd2e304a1cef255c8362650d82ed490d88d7a56d
3
+ metadata.gz: bf3f34e6509a6c3847bd333b357dc0289fe35ea3
4
+ data.tar.gz: 3b0d0d5db9a1db742ebcff2d09f03745e010d733
5
5
  SHA512:
6
- metadata.gz: fb00c43e5d7d57f3b17f82efaf494426766b12d5af483195ce89252ec11d402c9dcc5149c3d5dc340f393a125d37c53d93e6ef90d7a60808f2124aa44e7c6688
7
- data.tar.gz: d7879e42888f1bb9a0b4305f4d1b1d2e24acb2b0bbf64fde6be45b33f560aee935c1ab936d62e21ddd330467b05cb234032214e47deee6dc76432b775ea3ad9a
6
+ metadata.gz: c27558d79844645f535a5d406fe7a3db73a3b3e21e3453950b54065c392016c431a7d7bdf0b32fcf110d590b20d8372ba3b0bf7ac4e46ba73b6bdddc81f2de55
7
+ data.tar.gz: 273174a7e34f5675a0d4c6b62cfc46b20a45435776af812e7852345296f75ff76621cbc515ecd3830027781f71ab8f1e0c608f2500f590249bb4bf5f7618fafc
data/bin/crunch-job CHANGED
@@ -125,12 +125,14 @@ my $jobspec;
125
125
  my $job_api_token;
126
126
  my $no_clear_tmp;
127
127
  my $resume_stash;
128
+ my $docker_bin = "/usr/bin/docker.io";
128
129
  GetOptions('force-unlock' => \$force_unlock,
129
130
  'git-dir=s' => \$git_dir,
130
131
  'job=s' => \$jobspec,
131
132
  'job-api-token=s' => \$job_api_token,
132
133
  'no-clear-tmp' => \$no_clear_tmp,
133
134
  'resume-stash=s' => \$resume_stash,
135
+ 'docker-bin=s' => \$docker_bin,
134
136
  );
135
137
 
136
138
  if (defined $job_api_token) {
@@ -138,7 +140,6 @@ if (defined $job_api_token) {
138
140
  }
139
141
 
140
142
  my $have_slurm = exists $ENV{SLURM_JOBID} && exists $ENV{SLURM_NODELIST};
141
- my $local_job = 0;
142
143
 
143
144
 
144
145
  $SIG{'USR1'} = sub
@@ -150,8 +151,6 @@ $SIG{'USR2'} = sub
150
151
  $main::ENV{CRUNCH_DEBUG} = 0;
151
152
  };
152
153
 
153
-
154
-
155
154
  my $arv = Arvados->new('apiVersion' => 'v1');
156
155
 
157
156
  my $Job;
@@ -160,12 +159,41 @@ my $dbh;
160
159
  my $sth;
161
160
  my @jobstep;
162
161
 
163
- my $User = api_call("users/current");
164
-
162
+ my $local_job;
165
163
  if ($jobspec =~ /^[-a-z\d]+$/)
166
164
  {
167
165
  # $jobspec is an Arvados UUID, not a JSON job specification
168
166
  $Job = api_call("jobs/get", uuid => $jobspec);
167
+ $local_job = 0;
168
+ }
169
+ else
170
+ {
171
+ $Job = JSON::decode_json($jobspec);
172
+ $local_job = 1;
173
+ }
174
+
175
+
176
+ # Make sure our workers (our slurm nodes, localhost, or whatever) are
177
+ # at least able to run basic commands: they aren't down or severely
178
+ # misconfigured.
179
+ my $cmd = ['true'];
180
+ if ($Job->{docker_image_locator}) {
181
+ $cmd = [$docker_bin, 'ps', '-q'];
182
+ }
183
+ Log(undef, "Sanity check is `@$cmd`");
184
+ srun(["srun", "--nodes=\Q$ENV{SLURM_NNODES}\E", "--ntasks-per-node=1"],
185
+ $cmd,
186
+ {fork => 1});
187
+ if ($? != 0) {
188
+ Log(undef, "Sanity check failed: ".exit_status_s($?));
189
+ exit EX_TEMPFAIL;
190
+ }
191
+ Log(undef, "Sanity check OK");
192
+
193
+
194
+ my $User = api_call("users/current");
195
+
196
+ if (!$local_job) {
169
197
  if (!$force_unlock) {
170
198
  # Claim this job, and make sure nobody else does
171
199
  eval { api_call("jobs/lock", uuid => $Job->{uuid}); };
@@ -177,8 +205,6 @@ if ($jobspec =~ /^[-a-z\d]+$/)
177
205
  }
178
206
  else
179
207
  {
180
- $Job = JSON::decode_json($jobspec);
181
-
182
208
  if (!$resume_stash)
183
209
  {
184
210
  map { croak ("No $_ specified") unless $Job->{$_} }
@@ -376,7 +402,6 @@ if (!defined $no_clear_tmp) {
376
402
  }
377
403
 
378
404
  # If this job requires a Docker image, install that.
379
- my $docker_bin = "/usr/bin/docker.io";
380
405
  my ($docker_locator, $docker_stream, $docker_hash, $docker_limitmem);
381
406
  if ($docker_locator = $Job->{docker_image_locator}) {
382
407
  ($docker_stream, $docker_hash) = find_docker_image($docker_locator);
@@ -1139,7 +1164,7 @@ sub reapchildren
1139
1164
 
1140
1165
  Log ($jobstepid, sprintf('failure (#%d, %s) after %d seconds',
1141
1166
  ++$Jobstep->{'failures'},
1142
- $temporary_fail ? 'temporary ' : 'permanent',
1167
+ $temporary_fail ? 'temporary' : 'permanent',
1143
1168
  $elapsed));
1144
1169
 
1145
1170
  if (!$temporary_fail || $Jobstep->{'failures'} >= 3) {
@@ -1708,7 +1733,13 @@ sub srun
1708
1733
  my $show_cmd = Dumper($args);
1709
1734
  $show_cmd =~ s/(TOKEN\\*=)[^\s\']+/${1}[...]/g;
1710
1735
  $show_cmd =~ s/\n/ /g;
1711
- warn "starting: $show_cmd\n";
1736
+ if ($opts->{fork}) {
1737
+ Log(undef, "starting: $show_cmd");
1738
+ } else {
1739
+ # This is a child process: parent is in charge of reading our
1740
+ # stderr and copying it to Log() if needed.
1741
+ warn "starting: $show_cmd\n";
1742
+ }
1712
1743
 
1713
1744
  if (defined $stdin) {
1714
1745
  my $child = open STDIN, "-|";
@@ -2052,6 +2083,7 @@ if (readlink ("$destdir.archive_hash") eq $archive_hash && -d $destdir) {
2052
2083
  unlink "$destdir.archive_hash";
2053
2084
  mkdir $destdir;
2054
2085
 
2086
+ warn "Extracting archive: $archive_hash\n";
2055
2087
  if (!open(TARX, "|-", "tar", "-xC", $destdir)) {
2056
2088
  die "Error launching 'tar -xC $destdir': $!";
2057
2089
  }
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.20150527201024
4
+ version: 0.1.20150529160203
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-05-27 00:00:00.000000000 Z
11
+ date: 2015-05-29 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 7a53d874994a5a9af273cee1329d9635b7e03edb
181
+ description: Arvados command line tools, git commit 1ec1d552c77e18e2912e400ae395ca00f4e51c3c
182
182
  email: gem-dev@curoverse.com
183
183
  executables:
184
184
  - arv