arvados-cli 0.1.20140411091748 → 0.1.20140411125904

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 +25 -24
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cba7f82e4335b9b3357138ac4c4b47a5c918a2f
4
- data.tar.gz: 3f81643087ac0846f8cde35db1322786b74c2758
3
+ metadata.gz: 430e3b338861a82a044d330ea865cbc28dfa765c
4
+ data.tar.gz: 75b0bbb95586d7a5f3aba520f9eb11ebb47b07b9
5
5
  SHA512:
6
- metadata.gz: 21f7168b59a90d64bde78d20a8ad2834adf288b0f3ab2d2dd0d4a20e28521ce37efa1a5dff49a641f51f552d103bf34cb5deec80478891276cffbe21c58c5646
7
- data.tar.gz: dc9a561d780df2b202d828cdb6b4bbe695d36be4cdbb70941a8c57d39f271754352a9307d2a578ac18244cfdb68472f6fd3f18ee9900342a947424721084d651
6
+ metadata.gz: 6e8a5ecc6a13ae9976392f8e9deea6bf248c6f02df7b05dfb7d05b8e135db3d7c0b845de0975fa4f957bc5cf9e47c1f51fd9c1e5cee2205f2f3c39dde6903758
7
+ data.tar.gz: 57f2939115c38df100c30a8a7029acc21a028ced07238501eeb43b292cd8fb6b00b97b3be1086aca525c3afe9ee4c241b9ef6d3db7c55d0324d4d70518e29e45
data/bin/crunch-job CHANGED
@@ -195,7 +195,7 @@ if (!$have_slurm)
195
195
  }
196
196
  if (exists $ENV{SLURM_NODELIST})
197
197
  {
198
- push @sinfo, `sinfo -h --format='%c %N' --nodes='$ENV{SLURM_NODELIST}'`;
198
+ push @sinfo, `sinfo -h --format='%c %N' --nodes=\Q$ENV{SLURM_NODELIST}\E`;
199
199
  }
200
200
  foreach (@sinfo)
201
201
  {
@@ -400,24 +400,33 @@ else
400
400
  my $commit;
401
401
  my $git_archive;
402
402
  my $treeish = $Job->{'script_version'};
403
- my $repo = $git_dir || $ENV{'CRUNCH_DEFAULT_GIT_DIR'};
404
- # Todo: let script_version specify repository instead of expecting
405
- # parent process to figure it out.
406
- $ENV{"CRUNCH_SRC_URL"} = $repo;
407
403
 
408
- # Create/update our clone of the remote git repo
404
+ # If we're running under crunch-dispatch, it will have pulled the
405
+ # appropriate source tree into its own repository, and given us that
406
+ # repo's path as $git_dir. If we're running a "local" job, and a
407
+ # script_version was specified, it's up to the user to provide the
408
+ # full path to a local repository in Job->{repository}.
409
+ #
410
+ # TODO: Accept URLs too, not just local paths. Use git-ls-remote and
411
+ # git-archive --remote where appropriate.
412
+ #
413
+ # TODO: Accept a locally-hosted Arvados repository by name or
414
+ # UUID. Use arvados.v1.repositories.list or .get to figure out the
415
+ # appropriate fetch-url.
416
+ my $repo = $git_dir || $ENV{'CRUNCH_DEFAULT_GIT_DIR'} || $Job->{'repository'};
417
+
418
+ $ENV{"CRUNCH_SRC_URL"} = $repo;
409
419
 
410
- if (!-d $ENV{"CRUNCH_SRC"}) {
411
- system(qw(git clone), $repo, $ENV{"CRUNCH_SRC"}) == 0
412
- or croak ("git clone $repo failed: exit ".($?>>8));
413
- system("cd $ENV{CRUNCH_SRC} && git config clean.requireForce false");
420
+ if (-d "$repo/.git") {
421
+ # We were given a working directory, but we are only interested in
422
+ # the index.
423
+ $repo = "$repo/.git";
414
424
  }
415
- `cd $ENV{CRUNCH_SRC} && git remote set-url origin \"\$CRUNCH_SRC_URL\" && git fetch -q --tags origin`;
416
425
 
417
426
  # If this looks like a subversion r#, look for it in git-svn commit messages
418
427
 
419
428
  if ($treeish =~ m{^\d{1,4}$}) {
420
- my $gitlog = `cd $ENV{CRUNCH_SRC} && git log --pretty="format:%H" --grep="git-svn-id:.*\@$treeish " origin/master`;
429
+ my $gitlog = `git --git-dir=\Q$repo\E log --pretty="format:%H" --grep="git-svn-id:.*\@"\Q$treeish\E" " master`;
421
430
  chomp $gitlog;
422
431
  if ($gitlog =~ /^[a-f0-9]{40}$/) {
423
432
  $commit = $gitlog;
@@ -428,15 +437,7 @@ else
428
437
  # If that didn't work, try asking git to look it up as a tree-ish.
429
438
 
430
439
  if (!defined $commit) {
431
-
432
- my $cooked_treeish = $treeish;
433
- if ($treeish !~ m{^[0-9a-f]{5,}$}) {
434
- # Looks like a git branch name -- make sure git knows it's
435
- # relative to the remote repo
436
- $cooked_treeish = "origin/$treeish";
437
- }
438
-
439
- my $found = `cd $ENV{CRUNCH_SRC} && git rev-list -1 $cooked_treeish`;
440
+ my $found = `git --git-dir=\Q$repo\E rev-list -1 ''\Q$treeish\E`;
440
441
  chomp $found;
441
442
  if ($found =~ /^[0-9a-f]{40}$/s) {
442
443
  $commit = $found;
@@ -461,7 +462,7 @@ else
461
462
  $ENV{"CRUNCH_SRC_COMMIT"} = $commit;
462
463
  @execargs = ("sh", "-c",
463
464
  "mkdir -p $ENV{CRUNCH_INSTALL} && cd $ENV{CRUNCH_TMP} && perl -");
464
- $git_archive = `cd $ENV{CRUNCH_SRC} && git archive $commit`;
465
+ $git_archive = `git --git-dir=\Q$repo\E archive ''\Q$commit\E`;
465
466
  }
466
467
  else {
467
468
  croak ("could not figure out commit id for $treeish");
@@ -758,7 +759,7 @@ if ($job_has_uuid) {
758
759
  if ($Job->{'output'})
759
760
  {
760
761
  eval {
761
- my $manifest_text = `arv keep get \Q$Job->{'output'}\E`;
762
+ my $manifest_text = `arv keep get ''\Q$Job->{'output'}\E`;
762
763
  $arv->{'collections'}->{'create'}->execute('collection' => {
763
764
  'uuid' => $Job->{'output'},
764
765
  'manifest_text' => $manifest_text,
@@ -1235,7 +1236,7 @@ sub save_meta
1235
1236
  return if $justcheckpoint; # checkpointing is not relevant post-Warehouse.pm
1236
1237
 
1237
1238
  $local_logfile->flush;
1238
- my $cmd = "arv keep put --filename \Q$keep_logfile\E "
1239
+ my $cmd = "arv keep put --filename ''\Q$keep_logfile\E "
1239
1240
  . quotemeta($local_logfile->filename);
1240
1241
  my $loglocator = `$cmd`;
1241
1242
  die "system $cmd failed: $?" if $?;
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.20140411091748
4
+ version: 0.1.20140411125904
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 51db46ba942baf7f718ae12544008e6f6b2f7ea4
149
+ description: This is the Arvados SDK CLI gem, git revision 45ff1f04cf0a562b870e18ca13b02d914db6bcb3
150
150
  email: gem-dev@curoverse.com
151
151
  executables:
152
152
  - arv