IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25822 for trunk/ippTasks


Ignore:
Timestamp:
Oct 9, 2009, 2:02:24 PM (17 years ago)
Author:
bills
Message:

code to clean up magicDSRuns

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/destreak.pro

    r25708 r25822  
    1010book init magicToDS
    1111book init magicDSToRevert
     12book init magicDSToCleanup
    1213
    1314### indexes into Database lists
     
    1617$magicDSToRevert_DB = 0
    1718$magicDSCompletedRevert_DB = 0
     19$magicDSToCleanup_DB = 0
    1820
    1921#list of stages
     
    3234    book listbook magicToDS
    3335    book listbook magicDSToRevert
     36    book init magicDSToCleanup
    3437end
    3538
     
    3841    book init magicToDS
    3942    book init magicDSToRevert
     43    book init magicDSToCleanup
    4044end
    4145
     
    7175end
    7276
     77macro destreak.cleanup.on
     78    task destreak.cleanup.load
     79        active true
     80    end
     81    task destreak.cleanup.run
     82        active true
     83    end
     84end
     85
    7386### Turn tasks off
    7487macro destreak.off
     
    92105    end
    93106    task destreak.completed.revert
     107        active false
     108    end
     109end
     110macro destreak.cleanup.off
     111    task destreak.cleanup.load
     112        active false
     113    end
     114    task destreak.cleanup.run
    94115        active false
    95116    end
     
    489510end
    490511
     512task           destreak.cleanup.load
     513  host         local
     514
     515  periods      -poll $LOADPOLL
     516  periods      -exec $LOADEXEC
     517  periods      -timeout 20
     518  npending     1
     519  active       false
     520
     521  stdout NULL
     522  stderr $LOGSUBDIR/destreak.cleanup.load.log
     523
     524  task.exec
     525    $run = magicdstool -tocleanup
     526    if ($DB:n == 0)
     527      option DEFAULT
     528    else
     529
     530      # save the DB name for the exit tasks
     531      option $DB:$magicDSToCleanup_DB
     532      $run = $run -dbname $DB:$magicDSToCleanup_DB
     533
     534      # only bump database number after we have gone through all of the stages
     535      $magicDSToCleanup_DB ++
     536      if ($magicDSToCleanup_DB >= $DB:n) set magicDSToCleanup_DB = 0
     537    end
     538    add_poll_args run
     539    add_poll_labels run
     540    command $run
     541  end
     542
     543  # success
     544  task.exit    0
     545    # convert 'stdout' to book format
     546    ipptool2book stdout magicDSToCleanup -key magic_ds_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     547    if ($VERBOSE > 2)
     548      book listbook magicDSToCleanup
     549    end
     550
     551    # delete existing entries in the appropriate pantaskStates
     552    process_cleanup magicDSToCleanup
     553  end
     554
     555  # locked list
     556  task.exit    default
     557    showcommand failure
     558  end
     559
     560  task.exit    crash
     561    showcommand crash
     562  end
     563
     564  # operation times out?
     565  task.exit    timeout
     566    showcommand timeout
     567  end
     568end
     569
     570task           destreak.cleanup.run
     571  periods      -poll $RUNPOLL
     572  periods      -exec $RUNEXEC
     573  periods      -timeout 60
     574  active       false
     575
     576  task.exec
     577    stdout $LOGSUBDIR/destreak.cleanup.run.log
     578    stderr $LOGSUBDIR/destreak.cleanup.run.log
     579
     580    book npages magicDSToCleanup -var N
     581    if ($N == 0) break
     582    if ($NETWORK == 0) break
     583   
     584    # look for new images (pantaskState == INIT)
     585    book getpage magicDSToCleanup 0 -var pageName -key pantaskState INIT
     586    if ("$pageName" == "NULL") break
     587
     588    book setword magicDSToCleanup $pageName pantaskState RUN
     589    book getword magicDSToCleanup $pageName magic_ds_id -var MAGIC_DS_ID
     590    book getword magicDSToCleanup $pageName camera -var CAMERA
     591    book getword magicDSToCleanup $pageName outroot -var OUTROOT
     592    book getword magicDSToCleanup $pageName dbname -var DBNAME
     593
     594    sprintf logfile "%s/mds.%s.cleanup.log" $OUTROOT $MAGIC_DS_ID
     595
     596    host anyhost
     597
     598    $run = magic_destreak_cleanup.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --logfile $logfile
     599
     600    add_standard_args run
     601
     602    # save the pageName for future reference below
     603    options $pageName
     604
     605    # create the command line
     606    if ($VERBOSE > 1)
     607      echo command $run
     608    end
     609    command $run
     610  end
     611
     612  # default exit status
     613  task.exit    0
     614    process_exit magicDSToCleanup $options:0 $JOB_STATUS
     615   end
     616
     617  # locked list
     618  task.exit    default
     619    showcommand failure
     620    process_exit magicDSToCleanup $options:0 $JOB_STATUS
     621  end
     622
     623  task.exit    crash
     624    showcommand crash
     625    book setword magicDSToCleanup $options:0 pantaskState CRASH
     626  end
     627
     628  # operation timed out?
     629  task.exit    timeout
     630    showcommand timeout
     631    book setword magicDSToCleanup $options:0 pantaskState TIMEOUT
     632  end
     633end
     634
Note: See TracChangeset for help on using the changeset viewer.