arvados-cli 0.1.20140216161445 → 0.1.20140310170846

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5fc8355046561f946b421f59f9cda012fd593af
4
- data.tar.gz: f37f1d1c0b3d516a73b5bc3385a420acf7433d6d
3
+ metadata.gz: 51f045c6a8d86776032cb36809d9aa92b257470f
4
+ data.tar.gz: b3a2d880cf093efa2fd4a26de5bd14fbf9096cf8
5
5
  SHA512:
6
- metadata.gz: b751048526cd02e64301d6744f621466c5bf0a88a94141bffb16d3dddc386b36bbe7943ed8479fecd76ee030cbb142bf2d71256e9112f95fafb97f5d4ec71f04
7
- data.tar.gz: 7e50ddf1f9d62a3f26f73b9e35ccff3270762631251a0e2e2103caaaaa4fdf6d016bbe365f9360d04350d0e6349d2e896f4697d369e429d91d762c1f44877178
6
+ metadata.gz: afdb95ce244b20f0331919486a3eb661d9d9bcc7f9c9ac9e14153fb690b01fe79256cddb2da96681b735c1b2a226c34a4d6bf4eb93f8144676c442f2fd69e23b
7
+ data.tar.gz: b38765ee32bda7e530bdfa3a8506086d55acacdb6461f15b8d2307d2e18642a0ea2e974f919c461cdd459ca02b36dac6316aa14bb8854284148ccb7746de8219
data/bin/arv CHANGED
@@ -36,10 +36,10 @@ case ARGV[0]
36
36
  when 'keep'
37
37
  ARGV.shift
38
38
  @sub = ARGV.shift
39
- if ['get', 'put'].index @sub then
39
+ if ['get', 'put', 'ls', 'normalize'].index @sub then
40
40
  # Native Arvados
41
41
  exec `which arv-#{@sub}`.strip, *ARGV
42
- elsif ['ls', 'less', 'check'].index @sub then
42
+ elsif ['less', 'check'].index @sub then
43
43
  # wh* shims
44
44
  exec `which wh#{@sub}`.strip, *ARGV
45
45
  else
@@ -2,8 +2,8 @@
2
2
 
3
3
  # == Synopsis
4
4
  #
5
- # wh-run-pipeline-instance --template pipeline-template-uuid [options] [--] [parameters]
6
- # wh-run-pipeline-instance --instance pipeline-instance-uuid [options]
5
+ # arv-run-pipeline-instance --template pipeline-template-uuid [options] [--] [parameters]
6
+ # arv-run-pipeline-instance --instance pipeline-instance-uuid [options]
7
7
  #
8
8
  # Satisfy a pipeline template by finding or submitting a mapreduce job
9
9
  # for each pipeline component.
@@ -21,7 +21,7 @@
21
21
  # to finish. Just find out whether jobs are finished,
22
22
  # queued, or running for each component
23
23
  #
24
- # [--create-instance-only] Do not try to satisfy any components. Just
24
+ # [--submit] Do not try to satisfy any components. Just
25
25
  # create an instance, print its UUID to
26
26
  # stdout, and exit.
27
27
  #
@@ -80,13 +80,15 @@ $arvados_api_token = ENV['ARVADOS_API_TOKEN'] or
80
80
 
81
81
  begin
82
82
  require 'rubygems'
83
- require 'google/api_client'
84
83
  require 'json'
85
84
  require 'pp'
86
85
  require 'trollop'
87
- rescue LoadError
86
+ require 'google/api_client'
87
+ rescue LoadError => l
88
+ puts $:
88
89
  abort <<-EOS
89
- #{$0}: fatal: some runtime dependencies are missing.
90
+ #{$0}: fatal: #{l.message}
91
+ Some runtime dependencies may be missing.
90
92
  Try: gem install pp google-api-client json trollop
91
93
  EOS
92
94
  end
@@ -173,10 +175,14 @@ p = Trollop::Parser.new do
173
175
  "UUID of pipeline instance.",
174
176
  :short => :none,
175
177
  :type => :string)
176
- opt(:create_instance_only,
178
+ opt(:submit,
177
179
  "Do not try to satisfy any components. Just create a pipeline instance and output its UUID.",
178
180
  :short => :none,
179
181
  :type => :boolean)
182
+ opt(:run_here,
183
+ "Manage the pipeline in process.",
184
+ :short => :none,
185
+ :type => :boolean)
180
186
  stop_on [:'--']
181
187
  end
182
188
  $options = Trollop::with_standard_exception_handling p do
@@ -185,13 +191,33 @@ end
185
191
  $debuglevel = $options[:debug_level] || ($options[:debug] && 1) || 0
186
192
 
187
193
  if $options[:instance]
188
- if $options[:template] or $options[:create_instance_only]
189
- abort "#{$0}: syntax error: --instance cannot be combined with --template or --create-instance-only."
194
+ if $options[:template] or $options[:submit]
195
+ abort "#{$0}: syntax error: --instance cannot be combined with --template or --submit."
190
196
  end
191
197
  elsif not $options[:template]
192
198
  abort "#{$0}: syntax error: you must supply a --template or --instance."
193
199
  end
194
200
 
201
+ if $options[:run_here] == $options[:submit]
202
+ abort "#{$0}: syntax error: you must supply either --run-here or --submit."
203
+ end
204
+
205
+ # Suppress SSL certificate checks if ARVADOS_API_HOST_INSECURE
206
+
207
+ module Kernel
208
+ def suppress_warnings
209
+ original_verbosity = $VERBOSE
210
+ $VERBOSE = nil
211
+ result = yield
212
+ $VERBOSE = original_verbosity
213
+ return result
214
+ end
215
+ end
216
+
217
+ if ENV['ARVADOS_API_HOST_INSECURE']
218
+ suppress_warnings { OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE }
219
+ end
220
+
195
221
  # Set up the API client.
196
222
 
197
223
  $client ||= Google::APIClient.
@@ -498,7 +524,7 @@ class WhRunPipelineInstance
498
524
  end
499
525
  elsif c[:job][:running] ||
500
526
  (!c[:job][:started_at] && !c[:job][:cancelled_at])
501
- moretodo ||= !@options[:no_wait]
527
+ moretodo ||= true
502
528
  elsif c[:job][:cancelled_at]
503
529
  debuglog "component #{cname} job #{c[:job][:uuid]} cancelled."
504
530
  end
@@ -507,6 +533,11 @@ class WhRunPipelineInstance
507
533
  @instance[:components] = @components
508
534
  @instance[:active] = moretodo
509
535
  report_status
536
+
537
+ if @options[:no_wait]
538
+ moretodo = false
539
+ end
540
+
510
541
  if moretodo
511
542
  begin
512
543
  sleep 10
@@ -516,7 +547,26 @@ class WhRunPipelineInstance
516
547
  end
517
548
  end
518
549
  end
519
- @instance[:success] = @components.reject { |cname,c| c[:job] and c[:job][:success] }.empty?
550
+
551
+ ended = 0
552
+ succeeded = 0
553
+ failed = 0
554
+ @components.each do |cname, c|
555
+ if c[:job]
556
+ if c[:job][:finished_at]
557
+ ended += 1
558
+ if c[:job][:success] == true
559
+ succeeded += 1
560
+ end
561
+ end
562
+ end
563
+ end
564
+
565
+ if ended == @components.length
566
+ @instance[:active] = false
567
+ @instance[:success] = (succeeded == @components.length)
568
+ end
569
+
520
570
  @instance.save
521
571
  end
522
572
 
@@ -579,7 +629,7 @@ begin
579
629
  end
580
630
  runner.apply_parameters(p.leftovers)
581
631
  runner.setup_instance
582
- if $options[:create_instance_only]
632
+ if $options[:submit]
583
633
  runner.instance.save
584
634
  puts runner.instance[:uuid]
585
635
  else
data/bin/crunch-job CHANGED
@@ -84,6 +84,7 @@ unless (defined $ENV{"CRUNCH_TMP"}) {
84
84
  }
85
85
  }
86
86
  $ENV{"JOB_WORK"} = $ENV{"CRUNCH_TMP"} . "/work";
87
+ $ENV{"CRUNCH_INSTALL"} = "$ENV{CRUNCH_TMP}/opt";
87
88
  $ENV{"CRUNCH_WORK"} = $ENV{"JOB_WORK"}; # deprecated
88
89
  mkdir ($ENV{"JOB_WORK"});
89
90
 
@@ -331,6 +332,15 @@ my $skip_install = ($local_job && $Job->{script_version} =~ m{^/});
331
332
  if ($skip_install)
332
333
  {
333
334
  $ENV{"CRUNCH_SRC"} = $Job->{script_version};
335
+ for my $src_path ("$ENV{CRUNCH_SRC}/arvados/sdk/python") {
336
+ if (-d $src_path) {
337
+ system("virtualenv", "$ENV{CRUNCH_TMP}/opt") == 0
338
+ or croak ("virtualenv $ENV{CRUNCH_TMP}/opt failed: exit ".($?>>8));
339
+ system ("cd $src_path && ./build.sh && \$CRUNCH_TMP/opt/bin/python setup.py install")
340
+ == 0
341
+ or croak ("setup.py in $src_path failed: exit ".($?>>8));
342
+ }
343
+ }
334
344
  }
335
345
  else
336
346
  {
@@ -367,7 +377,6 @@ else
367
377
 
368
378
  $ENV{"CRUNCH_SRC_COMMIT"} = $Job->{script_version};
369
379
  $ENV{"CRUNCH_SRC"} = "$ENV{CRUNCH_TMP}/src";
370
- $ENV{"CRUNCH_INSTALL"} = "$ENV{CRUNCH_TMP}/opt";
371
380
 
372
381
  my $commit;
373
382
  my $git_archive;
@@ -546,8 +555,10 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
546
555
  $ENV{"TASK_SLOT_NODE"} = $slot[$childslot]->{node}->{name};
547
556
  $ENV{"TASK_SLOT_NUMBER"} = $slot[$childslot]->{cpu};
548
557
  $ENV{"TASK_WORK"} = $ENV{"JOB_WORK"}."/".$slot[$childslot]->{cpu};
558
+ $ENV{"TASK_KEEPMOUNT"} = $ENV{"TASK_WORK"}."/keep";
549
559
  $ENV{"TASK_TMPDIR"} = $ENV{"TASK_WORK"}; # deprecated
550
560
  $ENV{"CRUNCH_NODE_SLOTS"} = $slot[$childslot]->{node}->{ncpus};
561
+ $ENV{"PATH"} = $ENV{"CRUNCH_INSTALL"} . "/bin:" . $ENV{"PATH"};
551
562
 
552
563
  $ENV{"GZIP"} = "-n";
553
564
 
@@ -561,7 +572,7 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
561
572
  my $build_script_to_send = "";
562
573
  my $command =
563
574
  "if [ -e $ENV{TASK_WORK} ]; then rm -rf $ENV{TASK_WORK}; fi; "
564
- ."mkdir -p $ENV{JOB_WORK} $ENV{CRUNCH_TMP} $ENV{TASK_WORK} "
575
+ ."mkdir -p $ENV{JOB_WORK} $ENV{CRUNCH_TMP} $ENV{TASK_WORK} $ENV{TASK_KEEPMOUNT} "
565
576
  ."&& cd $ENV{CRUNCH_TMP} ";
566
577
  if ($build_script)
567
578
  {
@@ -571,10 +582,10 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
571
582
  }
572
583
  $ENV{"PYTHONPATH"} =~ s{^}{:} if $ENV{"PYTHONPATH"};
573
584
  $ENV{"PYTHONPATH"} =~ s{^}{$ENV{CRUNCH_SRC}/sdk/python}; # xxx hack
574
- $ENV{"PYTHONPATH"} =~ s{^}{$ENV{CRUNCH_SRC}/arvados/sdk/python}; # xxx hack
585
+ $ENV{"PYTHONPATH"} =~ s{^}{$ENV{CRUNCH_SRC}/arvados/sdk/python:}; # xxx hack
575
586
  $ENV{"PYTHONPATH"} =~ s{$}{:/usr/local/arvados/src/sdk/python}; # xxx hack
576
587
  $command .=
577
- "&& exec $ENV{CRUNCH_SRC}/crunch_scripts/" . $Job->{"script"};
588
+ "&& exec arv-mount $ENV{TASK_KEEPMOUNT} --exec $ENV{CRUNCH_SRC}/crunch_scripts/" . $Job->{"script"};
578
589
  my @execargs = ('bash', '-c', $command);
579
590
  srun (\@srunargs, \@execargs, undef, $build_script_to_send);
580
591
  exit (111);
@@ -1361,16 +1372,27 @@ open STDOUT, ">", "$destdir.log";
1361
1372
  open STDERR, ">&STDOUT";
1362
1373
 
1363
1374
  mkdir $destdir;
1364
- open TARX, "|-", "tar", "-C", $destdir, "-xf", "-";
1365
- print TARX <DATA>;
1366
- if(!close(TARX)) {
1367
- die "'tar -C $destdir -xf -' exited $?: $!";
1375
+ my @git_archive_data = <DATA>;
1376
+ if (@git_archive_data) {
1377
+ open TARX, "|-", "tar", "-C", $destdir, "-xf", "-";
1378
+ print TARX @git_archive_data;
1379
+ if(!close(TARX)) {
1380
+ die "'tar -C $destdir -xf -' exited $?: $!";
1381
+ }
1368
1382
  }
1369
1383
 
1370
1384
  my $pwd;
1371
1385
  chomp ($pwd = `pwd`);
1372
1386
  my $install_dir = $ENV{"CRUNCH_INSTALL"} || "$pwd/opt";
1373
1387
  mkdir $install_dir;
1388
+
1389
+ for my $src_path ("$destdir/arvados/sdk/python") {
1390
+ if (-d $src_path) {
1391
+ shell_or_die ("virtualenv", $install_dir);
1392
+ shell_or_die ("cd $src_path && ./build.sh && $install_dir/bin/python setup.py install");
1393
+ }
1394
+ }
1395
+
1374
1396
  if (-e "$destdir/crunch_scripts/install") {
1375
1397
  shell_or_die ("$destdir/crunch_scripts/install", $install_dir);
1376
1398
  } elsif (!-e "./install.sh" && -e "./tests/autotests.sh") {
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.20140216161445
4
+ version: 0.1.20140310170846
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvados Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-16 00:00:00.000000000 Z
11
+ date: 2014-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client
@@ -132,7 +132,7 @@ dependencies:
132
132
  - - ~>
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0.8'
135
- description: This is the Arvados SDK CLI gem, git revision 25a646aef93c601334e9d1f676d7ba04e5868b0b
135
+ description: This is the Arvados SDK CLI gem, git revision c912d9d8d9e2a055a53967c5b01242c321dfbeb6
136
136
  email: gem-dev@curoverse.com
137
137
  executables:
138
138
  - arv
@@ -143,8 +143,8 @@ extensions: []
143
143
  extra_rdoc_files: []
144
144
  files:
145
145
  - bin/arv
146
- - bin/arv-crunch-job
147
146
  - bin/arv-run-pipeline-instance
147
+ - bin/arv-crunch-job
148
148
  - bin/arv-tag
149
149
  - bin/crunch-job
150
150
  homepage: http://arvados.org
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  version: '0'
168
168
  requirements: []
169
169
  rubyforge_project:
170
- rubygems_version: 2.2.1
170
+ rubygems_version: 2.0.14
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: Arvados SDK CLI