Set up virtualenv and install custom SDK only if SDK appears in
authorTom Clegg <tom@curoverse.com>
Fri, 28 Feb 2014 23:28:55 +0000 (15:28 -0800)
committerTom Clegg <tom@curoverse.com>
Fri, 28 Feb 2014 23:28:55 +0000 (15:28 -0800)
arvados/sdk/python -- ignore sdk/python.

This means scripts that are run straight from the arvados tree will
use whatever SDK is installed on the compute node, rather than
installing the SDK and dependencies into a virtualenv.

If you want your scripts to be in [a fork of] the arvados tree rather
than bringing in arvados as a submodule, *and* you want to pin jobs to
a specific SDK version, add a symbolic link in your source tree
(/arvados -> .).

sdk/cli/bin/crunch-job

index fec23d4fc4d267c6d636d27be31e2c42443284f8..2ba36f2b25ba939957ee3c6fb81baad66797a16e 100755 (executable)
@@ -332,11 +332,10 @@ my $skip_install = ($local_job && $Job->{script_version} =~ m{^/});
 if ($skip_install)
 {
   $ENV{"CRUNCH_SRC"} = $Job->{script_version};
-  system("virtualenv", "$ENV{CRUNCH_TMP}/opt") == 0
-      or croak ("virtualenv $ENV{CRUNCH_TMP}/opt failed: exit ".($?>>8));
-  for my $src_path ("$ENV{CRUNCH_SRC}/arvados/sdk/python",
-                    "$ENV{CRUNCH_SRC}/sdk/python") {
+  for my $src_path ("$ENV{CRUNCH_SRC}/arvados/sdk/python") {
     if (-d $src_path) {
+      system("virtualenv", "$ENV{CRUNCH_TMP}/opt") == 0
+          or croak ("virtualenv $ENV{CRUNCH_TMP}/opt failed: exit ".($?>>8));
       system ("cd $src_path && ./build.sh && \$CRUNCH_TMP/opt/bin/python setup.py install")
           == 0
           or croak ("setup.py in $src_path failed: exit ".($?>>8));
@@ -1387,9 +1386,9 @@ chomp ($pwd = `pwd`);
 my $install_dir = $ENV{"CRUNCH_INSTALL"} || "$pwd/opt";
 mkdir $install_dir;
 
-shell_or_die ("virtualenv", $install_dir);
-for my $src_path ("$destdir/arvados/sdk/python", "$destdir/sdk/python") {
+for my $src_path ("$destdir/arvados/sdk/python") {
   if (-d $src_path) {
+    shell_or_die ("virtualenv", $install_dir);
     shell_or_die ("cd $src_path && ./build.sh && $install_dir/bin/python setup.py install");
   }
 }