changeset 294:cc2945816b75

job index arg to doit, slightly better diagnostic output
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Tue, 22 Apr 2025 14:32:07 +0100
parents 12d13a1d387f
children a63f9c2de887
files bin/_runme.sh
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/bin/_runme.sh	Fri Apr 18 13:39:55 2025 +0100
+++ b/bin/_runme.sh	Tue Apr 22 14:32:07 2025 +0100
@@ -15,9 +15,11 @@
 then
  shift
  xarg="$1"
+ xa="run $1 "
  shift
 else
  xarg=
+ xa=
 fi
  
 cd "$1"
@@ -32,15 +34,15 @@
 if [ "$1" = "-t" ]
 then
   shift
-  threadsPerTask=$1
+  threadsPerJob=$1
   shift
 else
-  threadsPerTask=2
+  threadsPerJob=2
 fi
 
-pjobs=$((c / $threadsPerTask))
+pjobs=$((c / $threadsPerJob))
 
-echo $(date) task $n.$task on $nodename:$N.$node start $pjobs jobs 1>&2
+echo $(date) ${xa}task $n.$task on $nodename:$N.$node start $pjobs jobs 1>&2
 
 PATH=$W/$USER/bin:$W/shared/bin:$PATH
 export task PATH n xarg
@@ -70,16 +72,17 @@
 
 doit () {
  arg="$1"
- echo $(date) start $task $PARALLEL_SEQ "|$cmd|$xarg|$arg|"
+ i="$2"
+ echo $(date) start $task $i "|$xarg|$arg|"
  eval "$cmd"
- echo $(date) end $task $PARALLEL_SEQ
+ echo $(date) end $task $i
 }
 
 export -f doit
 
 if [ "$debug" ]
 then
- echo $(date) task $n.$task cmd "|$cmd|" doit $(type doit)
+ echo $(date) task $n.$task cmd "|$cmd|" $(type doit)
 fi
 
 eval "$input" | \
@@ -93,7 +96,7 @@
    then
     xargs -I ^ -n 1 bash -lc "doit ^"
    else
-    parallel --line-buffer -j $pjobs doit '{}'
+    parallel --line-buffer -j $pjobs doit '{}' '{#}'
    fi
 
 echo $(date) task $n.$task on $nodename:$N.$node end 1>&2