IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 17, 2023, 4:41:34 PM (3 years ago)
Author:
eugene
Message:

merging from trunk

Location:
branches/eam_branches/ipp-20230313/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/tools

  • branches/eam_branches/ipp-20230313/tools/eam/rawfix.20230221/src/rawfix.md5sum.pt

    r42405 r42531  
    1212  $RAWFIX_MD5SUM_INIT = 1
    1313end
     14
     15$MAX_MD5HOST = 2
    1416
    1517# select nights which are ready for md5sum calcs
     
    3537    # fields in the table will become words in the page
    3638    queue2book -raw-columns -key dateobs -uniq -setword pantaskState INIT -setword pantasksQuality OK stdout md5sum.book
     39    book delpage md5sum.book -key pantaskState DONE
    3740  end
    3841
     
    5457# output: md5host.book
    5558task nights.md5sum.loadhosts
    56 
    5759  periods      -poll $RPOLL
    5860  periods      -exec $REXEC
    5961  periods      -timeout 60
     62  host          local
    6063  npending 1
     64  # note: the tasks which return their results via stdout
     65  # seem to fail if run remotely. 
    6166
    6267  stdout $LOGDIR/md5sum.loadhosts.stdout.log 
     
    7782    book setword md5sum.book $pageName pantaskState RUN
    7883    book getword md5sum.book $pageName dateobs -var DATEOBS
     84    book getword md5sum.book $pageName iter    -var ITER
    7985    option $pageName
    8086    # save the page so we can use it below
    8187
     88    substr $DATEOBS 0 4 YEAR
     89
    8290    # write an entry point in the log for this night
    83     sprintf tmpline "%s/%s/md5sum.runhosts.log" $mypath $DATEOBS
     91    sprintf tmpline "%s/%s/%s/log.md5sum.runhosts.v%d" $mypath $YEAR $DATEOBS $ITER
    8492    date -var mydate
    8593    exec echo "# start runhosts $mydate" >> $tmpline
    8694
    87     command get_hosts_md5s.sh $DATEOBS
     95    # the command returns these fields: dateobs stage md5host
     96    # NOTE: stage == ITER
     97    command get_hosts_md5s.sh $mypath $DATEOBS $ITER
    8898  end
    8999
     
    91101    # convert the stdout 'queue' to entries in a book
    92102    # fields in the table will become words in the page
     103    # queueprint stdout
    93104    queuesize stdout -var Nhosts
    94105    queue2book -raw-columns -key dateobs:md5host -uniq -setword pantaskState INIT stdout md5host.book
    95106    book setword md5sum.book $options:0 NHOST {$Nhosts - 1}
    96107    book setword md5sum.book $options:0 NDONE 0
     108    # book list
     109    # book listbook md5sum.book
    97110    # use the queuesize (Nhosts) to track how many jobs are done / to be done
    98111  end
     
    116129end
    117130
     131# runs on the hosts identified by get_hosts_md5s.sh
    118132# output: md5host.book
    119 task nights.md5sum.runhosts
     133task nights.md5sum.run
    120134
    121135  periods      -poll $RPOLL
    122136  periods      -exec $REXEC
    123137  periods      -timeout 60
    124 
    125   stdout $LOGDIR/md5sum.runhosts.stdout.log 
    126   stderr $LOGDIR/md5sum.runhosts.stderr.log
    127138
    128139  task.exec
     
    138149    if ("$pageName" == "NULL") break
    139150
     151    # XXX NOTE: the output field is called 'stage'
    140152    book setword md5host.book $pageName pantaskState RUN
    141153    book getword md5host.book $pageName dateobs -var DATEOBS
     154    book getword md5host.book $pageName stage   -var ITER
    142155    book getword md5host.book $pageName md5host -var MD5HOST
    143156
    144     option $pageName $DATEOBS
     157    substr $DATEOBS 0 4 YEAR
     158
     159    option $pageName $DATEOBS $YEAR
    145160    # save DATEOBS so we can find the md5sum.book entry
    146 
    147     # XXX TEST: $USE_HOST = ipp060
     161    # also save YEAR for output log
     162
     163    # does the output go here?
     164    stdout $mypath/$YEAR/$DATEOBS/log.md5sum.$MD5HOST.v$ITER 
     165    stderr $mypath/$YEAR/$DATEOBS/log.md5sum.$MD5HOST.v$ITER 
    148166
    149167    $USE_HOST = $MD5HOST
     
    154172      $host:$USE_HOST = 0
    155173    end
    156     if (not($host:$USE_HOST))
     174    if ($host:$USE_HOST < $MAX_MD5HOST)
    157175      control host add $USE_HOST
    158       $host:$USE_HOST = 1
     176      $host:$USE_HOST ++
    159177    end
    160178
    161179    ## even when testing, use the original hostname here:
    162     $input = $mypath/$DATEOBS/$MD5HOST.inst.txt
     180    $input = $mypath/$DATEOBS/$MD5HOST.inst.$ITER.txt
    163181
    164182    # need to make sure this will work on the ipp b-nodes:
    165183    # if we are able to run the 'exec', use a short retry time to launch all outstanding jobs
    166184    periods -exec 0.05
    167     command $mypath/get_md5s_instances.pl --hostname $USE_HOST --input $input
     185    command get_md5s_instances.pl --hostname $USE_HOST --topdir $mypath --dateobs $DATEOBS --stage $ITER
    168186  end
    169187
    170188  task.exit 0
    171     nights.mdsum.exit OK
     189    nights.md5sum.exit OK
    172190  end
    173191
    174192  # exit values other than 0:
    175193  task.exit    default
    176     nights.mdsum.exit FAIL
     194    nights.md5sum.exit FAIL
    177195    showcommand failure
    178196  end
    179197
    180198  task.exit    crash
    181     nights.mdsum.exit CRASH
     199    nights.md5sum.exit CRASH
    182200    showcommand crash
    183201  end
     
    185203  # operation times out?
    186204  task.exit    timeout
    187     nights.mdsum.exit TIMEOUT
     205    nights.md5sum.exit TIMEOUT
    188206    showcommand timeout
    189207  end
     
    210228   
    211229    # look for completed nights in md5sum.book (pantaskState == DONE)
    212     book getpage md5sum.book 0 -var pageName -key pantaskState DONE
     230    book getpage md5sum.book 0 -var pageName -key pantaskState STOP
    213231    if ("$pageName" == "NULL") break
    214232
     
    232250    # now that the entry is set to done in the db, remove the pantasks book entry
    233251    echo "cleaning this page: $options:0"
    234     book delpage md5sum.book $options:0
     252    book setword md5sum.book $options:0 pantaskState DONE
    235253  end
    236254
     
    255273######################### UTILITIES #################################
    256274
    257 macro nights.mdsum.exit
     275macro nights.md5sum.exit
    258276  if ($0 != 2)
    259     echo "USAGE: nights.mdsum.exit (quality)"
     277    echo "USAGE: nights.md5sum.exit (quality)"
    260278    break
    261279  end
     280
     281  # options are : pagename DATEOBS YEAR
    262282
    263283  book setword md5host.book $options:0 pantaskState DONE
    264284  book getword md5sum.book $options:1 NHOST -var Nhosts
    265285  book getword md5sum.book $options:1 NDONE -var Ndone
     286  book getword md5sum.book $options:1 stage -var ITER
    266287  $Ndone ++
    267288  book setword md5sum.book $options:1 NDONE $Ndone
     289
     290  sprintf tmpline "%s/%s/%s/log.md5sum.runhosts.v%d" $mypath $options:2 $options:1 $ITER
    268291  if ("$1" != "OK")
    269292    book setword md5sum.book $options:1 pantasksQuality $1
    270     sprintf tmpline "%s/%s/md5sum.runhosts.log" $mypath $options:1
    271293    exec echo "failure $1 $options:0" >> $tmpline
    272294  else
     
    274296  end
    275297  if ($Ndone == $Nhosts)
    276     book setword md5sum.book $options:1 pantaskState DONE
     298    book setword md5sum.book $options:1 pantaskState STOP
    277299  end
    278300  book delpage md5host.book $options:0
Note: See TracChangeset for help on using the changeset viewer.