4f202ee8fcfdcec142628ab0da1ba73fe81b72fb
hiram
  Sat Dec 31 10:52:42 2022 -0800
correctly use the tmpDir for parasol no redmine

diff --git src/hg/utils/automation/doRepeatModeler.pl src/hg/utils/automation/doRepeatModeler.pl
index 1a86ca7..948b453 100755
--- src/hg/utils/automation/doRepeatModeler.pl
+++ src/hg/utils/automation/doRepeatModeler.pl
@@ -133,49 +133,39 @@
     die "Error: required file $unmaskedSeq does not exist.";
   }
 
   my $whatItDoes =
 "Construct .fa file from unmasked.2bit, then run BuildDatabase from
 RepeatModeler to prepare rmblastn index files.";
 
   my $bossScript = newBash HgRemoteScript("$runDir/blastDb.bash", $workhorse,
 				      $runDir, $whatItDoes);
 
   $bossScript->add(<<_EOF_
 export asmId="${db}"
 export unmasked2Bit="${unmaskedSeq}"
 export bDatabase="${BuildDatabase}"
 
-export tmpDir=`mktemp -d -p /dev/shm rModeler.XXXXXX`
-
-# working directory
-cd "\${tmpDir}"
-
 if [ "\${unmasked2Bit}" -nt "\${asmId}.fa" ]; then
   twoBitToFa "\${unmasked2Bit}" "\${asmId}.fa"
   touch -r "\${unmasked2Bit}" "\${asmId}.fa"
 fi
 
 if [ "\${asmId}.fa" -nt "\${asmId}.nsq" ]; then
   time (\$bDatabase -name "\${asmId}" -engine ncbi "\${asmId}.fa") > blastDb.log 2>&1
 fi
 
-cd ${runDir}
-rsync -a -P "\${tmpDir}/" ./
-rm -fr "\${tmpDir}/"
-chmod 775 ${runDir}
-
 _EOF_
     );
 
   $bossScript->execute() if (! $opt_debug);
 } # sub doBlastDb
 
 #########################################################################
 # * step: cluster [bigClusterHub]
 sub doCluster {
   my $runDir = "$buildDir";
   my $paraHub = $bigClusterHub;
 
   # First, make sure previous step has completed:
   if ( ! $opt_debug ) {
     if ( ! -s "$runDir/$db.nsq" ) {
@@ -200,43 +190,42 @@
 printf '#!/bin/bash
 
 set -beEu -o pipefail
 
 export tmpDir=`mktemp -d -p /dev/shm rModeler.XXXXXX`
 
 # working directory
 cd "\${tmpDir}"
 rsync -a -P "${runDir}/" "\${tmpDir}/"
 
 export asmId="\${1}"
 export threadCount="${threadCount}"
 export rModeler="${RepeatModeler}"
 
 time (\$rModeler -engine ncbi \$threadCount -database "\${asmId}") > modeler.log 2>&1
+rsync -a -P ./ "${runDir}/"
+cd "${runDir}"
+rm -fr "\${tmpDir}/"
+chmod 775 "${runDir}"
 ' > oneJob
 chmod +x oneJob
 printf "oneJob ${db} {check out line+ ${db}-rmod.log}\n" > jobList
 para make $parasolOpts jobList
 para check
 para time > run.time
 cat run.time
 
-cd ${runDir}
-rsync -a -P "\${tmpDir}/" ./
-rm -fr "\${tmpDir}/"
-chmod 775 ${runDir}
-
 _EOF_
   );
   $bossScript->execute() if (! $opt_debug);
 } # doCluster
 
 #########################################################################
 # * step: cleanup [workhorse]
 sub doCleanup {
   my $runDir = "$buildDir";
 
   # First, make sure previous step has completed:
   if ( ! $opt_debug ) {
     if ( -s "$runDir/run.time" && ! -s "$runDir/${db}-families.fa" ) {
       die "cleanup: previous 'cluster' step appears to be broken, run.time is present but ${db}-families.fa is not present ?";
     }