IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29720 for trunk/ippTasks


Ignore:
Timestamp:
Nov 9, 2010, 2:46:22 PM (16 years ago)
Author:
bills
Message:

delete the troublesome task publish.trigger and implement a survey task

Location:
trunk/ippTasks
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/publish.pro

    r29507 r29720  
    1515
    1616macro publish.on
    17   task publish.trigger
    18     active true
    19   end
    2017  task publish.load
    2118    active true
    … …  
    3027
    3128macro publish.off
    32   task publish.trigger
    33     active false
    34   end
    3529  task publish.load
    3630    active false
    … …  
    5953
    6054# this variable will cycle through the known database names
    61 $publish_trigger_DB = 0
    6255$publish_load_DB = 0
    6356$publish_revert_DB = 0
    64 
    65 task           publish.trigger
    66   host         local
    67 
    68   periods      -poll $LOADPOLL
    69   periods      -exec $LOADEXEC
    70   periods      -timeout 30
    71   npending     1
    72 
    73   stdout NULL
    74   stderr $LOGDIR/publish.trigger.log
    75 
    76   task.exec
    77     if ($LABEL:n == 0) break
    78     #otherwise everything will be queued when there is no label.
    79     $run = pubtool -definerun
    80     if ($DB:n == 0)
    81       option DEFAULT
    82     else
    83       # save the DB name for the exit tasks
    84       option $DB:$publish_trigger_DB
    85       $run = $run -dbname $DB:$publish_trigger_DB
    86       $publish_trigger_DB ++
    87       if ($publish_trigger_DB >= $DB:n) set publish_trigger_DB = 0
    88     end
    89     add_poll_labels run
    90     command $run
    91   end
    92 
    93   # success
    94   task.exit    0
    95   end
    96 
    97   # locked list
    98   task.exit    default
    99     showcommand failure
    100   end
    101 
    102   task.exit    crash
    103     showcommand crash
    104   end
    105 
    106   # operation times out?
    107   task.exit    timeout
    108     showcommand timeout
    109   end
    110 end
    11157
    11258task           publish.load
  • trunk/ippTasks/survey.pro

    r29587 r29720  
    3232 book create SURVEY_CHIP_BG
    3333 book create SURVEY_WARP_BG
     34 book create SURVEY_PUBLISH
    3435 $haveSurveyBooks = TRUE
    3536end
    … …  
    4445$SURVEY_CHIP_BG_DB = 0
    4546$SURVEY_WARP_BG_DB = 0
    46 
    47 $SURVEY_EXEC = 120
     47$SURVEY_PUBLISH_DB = 0
     48
     49$SURVEY_EXEC = 5
    4850$SURVEY_POLL = 10
    4951$SURVEY_TIMEOUT = 600
    … …  
    7779    active true
    7880  end
     81  task survey.publish
     82    active true
     83  end
    7984end
    8085
    … …  
    105110  end
    106111  task survey.warp.bg
     112    active false
     113  end
     114  task survey.publish
    107115    active false
    108116  end
    … …  
    355363  book listbook SURVEY_WARP_BG
    356364end
     365
     366# user functions to manipulate publish labels
     367macro survey.add.publish
     368  if ($0 != 3)
     369    echo "USAGE: survey.add.publish (label) (client_id)"
     370    break
     371  end
     372  book newpage SURVEY_PUBLISH $1
     373  book setword SURVEY_PUBLISH $1 CLIENT_ID $2
     374  book setword SURVEY_PUBLISH $1 STATE PENDING
     375end
     376
     377macro survey.del.publish
     378  if ($0 != 2)
     379    echo "USAGE: survey.del.publish (label)"
     380    break
     381  end
     382  book delpage SURVEY_PUBLISH $1
     383end
     384
     385macro survey.show.publish
     386  if ($0 != 1)
     387    echo "USAGE: survey.show.publish"
     388    break
     389  end
     390  book listbook SURVEY_PUBLISH
     391end
     392
    357393
    358394task survey.diff
    … …  
    579615    end
    580616   
    581     echo $run
     617    # echo $run
    582618    command $run
    583619  end
    … …  
    651687    end
    652688   
    653     echo $run
     689    # echo $run
    654690    command $run
    655691  end
    … …  
    674710  end
    675711end
     712
    676713
    677714task survey.addstar
    … …  
    723760   
    724761    $run = $run -definebyquery -destreaked -label $label -set_dvodb $dvodb -set_minidvodb_group $minidvodb_group -set_minidvodb -set_label $minidvodb_group
    725     echo $run
     762    # echo $run
    726763    command $run
    727764  end
    … …  
    934971    end
    935972   
    936     echo $run
     973    # echo $run
    937974    command $run
    938975  end
    … …  
    957994  end
    958995end
     996
     997
     998
    959999
    9601000task survey.warp.bg
    … …  
    10041044    end
    10051045   
    1006     echo $run
     1046    # echo $run
    10071047    command $run
    10081048  end
    … …  
    10271067  end
    10281068end
     1069
     1070task survey.publish
     1071  host local
     1072 
     1073  periods      -poll $SURVEY_POLL
     1074  periods      -exec $SURVEY_EXEC
     1075  periods      -timeout $SURVEY_TIMEOUT
     1076  npending     1
     1077
     1078#  stdout $LOGDIR/survey.publish.log
     1079#  stderr $LOGDIR/survey.publish.log
     1080
     1081  # generate publish runs
     1082  task.exec
     1083    book npages SURVEY_PUBLISH -var N
     1084    if ($N == 0)
     1085      echo "No labels for processing"
     1086      break
     1087    endif
     1088
     1089    book getpage SURVEY_PUBLISH 0 -var label -key STATE NEW
     1090    if ("$label" == "NULL")
     1091      # All labels have been done --- reset
     1092      echo "Resetting labels"
     1093      for i 0 $N
     1094        book getpage SURVEY_PUBLISH $i -var label
     1095        book setword SURVEY_PUBLISH $label STATE NEW
     1096      end
     1097      book getpage SURVEY_PUBLISH 0 -var label -key STATE NEW
     1098
     1099      # Select different database
     1100      $SURVEY_PUBLISH ++
     1101      if ($SURVEY_PUBLISH >= $DB:n) set SURVEY_PUBLISH = 0
     1102    end
     1103
     1104    book setword SURVEY_PUBLISH $label STATE DONE
     1105    book getword SURVEY_PUBLISH $label CLIENT_ID -var client_id
     1106 
     1107    $run = pubtool -definerun -label $label -client_id $client_id
     1108
     1109    if ($DB:n == 0)
     1110      option DEFAULT
     1111    else
     1112      $run = $run -dbname $DB:$SURVEY_PUBLISH
     1113      option $DB:$SURVEY_PUBLISH
     1114    end
     1115   
     1116    echo $run
     1117    command echo $run
     1118  end
     1119
     1120  # success
     1121  task.exit    0
     1122    echo "Success"
     1123  end
     1124
     1125  # locked list
     1126  task.exit    default
     1127    showcommand failure
     1128  end
     1129
     1130  task.exit    crash
     1131    showcommand crash
     1132  end
     1133
     1134  # operation times out?
     1135  task.exit    timeout
     1136    showcommand timeout
     1137  end
     1138end
Note: See TracChangeset for help on using the changeset viewer.