4f1877c2974ee37a984000e1add2c4c27da0de7b
hiram
  Fri Oct 25 18:48:17 2024 -0700
the TMPDIR needs to be set locally on the para node not where the driver script is making the sub-script refs #34685

diff --git src/hg/utils/automation/doBlastzChainNet.pl src/hg/utils/automation/doBlastzChainNet.pl
index e448b0f..96efc7c 100755
--- src/hg/utils/automation/doBlastzChainNet.pl
+++ src/hg/utils/automation/doBlastzChainNet.pl
@@ -1657,30 +1657,45 @@
 ln -s $liftOverDir/$over $gpLiftOverDir/$over
 _EOF_
       );
     if ($tDb !~ m/^GC/) {
       $bossScript->add(<<_EOF_
 mkdir -p $gbdbLiftOverDir
 rm -f $gbdbLiftOverDir/$over
 ln -s $liftOverDir/$over $gbdbLiftOverDir/$over
 hgAddLiftOverChain -minMatch=0.1 -multiple -path=$gbdbLiftOverDir/$over \\
   $tDb $qDb
 _EOF_
       );
     }
 
     $bossScript->add(<<_EOF_
+if [ -d "/data/tmp" ]; then
+  export TMPDIR="/data/tmp"
+elif [ -d "/scratch/tmp" ]; then
+  export TMPDIR="/scratch/tmp"
+else
+  tmpSz=`df --output=avail -k /tmp | tail -1`
+  shmSz=`df --output=avail -k /dev/shm | tail -1`
+  if [ "\${shmSz}" -gt "\${tmpSz}" ]; then
+     mkdir -p /dev/shm/tmp
+     chmod 777 /dev/shm/tmp
+     export TMPDIR="/dev/shm/tmp"
+  else
+     export TMPDIR="/tmp"
+  fi
+fi
 # Update (or create) liftOver/md5sum.txt with the new .over.chain.gz.
 if (-e $gpLiftOverDir/md5sum.txt) then
   set tmpFile = `mktemp -t tmpMd5.XXXXXX`
   csh -c "grep -v $over $gpLiftOverDir/md5sum.txt || true" > \$tmpFile
   md5sum $gpLiftOverDir/$over \\
   | sed -e 's\@$gpLiftOverDir/\@\@' >> \$tmpFile
   sort \$tmpFile > $gpLiftOverDir/md5sum.txt
   rm \$tmpFile
 else
   md5sum $gpLiftOverDir/$over | sed -e 's\@$gpLiftOverDir/\@\@' \\
 	> $gpLiftOverDir/md5sum.txt
 endif
 _EOF_
       );
   }