IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11085


Ignore:
Timestamp:
Jan 12, 2007, 4:28:00 PM (19 years ago)
Author:
eugene
Message:

added error handling

Location:
branches/eam_branch_00/ippTasks
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_00/ippTasks/pantasks.pro

    r11059 r11085  
    100100  end
    101101end
     102
     103macro process_exit
     104  if ($0 != 4)
     105    echo "USAGE: process_exit (bookName) (pageName) (exitCode)"
     106    break
     107  end
     108
     109  $bookName = $1
     110  $pageName = $2
     111  $exitCode = $3
     112
     113  # success
     114  if ($exitCode == $EXIT_SUCCESS)
     115    # the handler scripts update DB the tables; here we just update the page
     116    book setword $bookName $pageName state DONE
     117    return
     118  end
     119
     120  # failure related to the data files
     121  # jobs which result in DATAERR must have db state updated
     122  if ($exitCode == $EXIT_DATA_ERR)
     123    showcommand failure
     124    book setword $bookName $pageName state DATA_ERR
     125    return
     126  end
     127
     128  # failure related to the data files
     129  if ($exitCode == $EXIT_SYS_ERR)
     130    halt
     131    showcommand "system failure"
     132    book setword $bookName $pageName state SYS_ERR
     133    return
     134  end
     135
     136  # failure related to the data files
     137  if ($exitCode == $EXIT_CONFIG_ERR)
     138    halt
     139    showcommand "config error"
     140    book setword $bookName $pageName state CONFIG_ERR
     141    return
     142  end
     143
     144  # failure related to the data files
     145  if ($exitCode == $EXIT_PROG_ERR)
     146    halt
     147    showcommand "programming error"
     148    book setword $bookName $pageName state PROG_ERR
     149    return
     150  end
     151
     152  # any other exit status
     153  showcommand failure
     154  book setword $bookName $pageName state UNKNOWN_ERR
     155end
  • branches/eam_branch_00/ippTasks/phase0.pro

    r11059 r11085  
    11## this file contains the tasks for running the phase 0 stage
    2 ## these tasks use the books Phase0Imfiles and Phase0Exposures
     2## these tasks use the books p0PendingImfile and p0PendingExp
    33
    44if ($?network == 0)
     
    2020exec mkdir -p $LOGSUBDIR
    2121
    22 book init Phase0Imfiles
    23 book init Phase0Exposures
     22book init p0PendingImfile
     23book init p0PendingExp
    2424
    2525macro phase0.status
    26   book listbook Phase0Imfiles
    27   book listbook Phase0Exposures
     26  book listbook p0PendingImfile
     27  book listbook p0PendingExp
    2828end
    2929
    3030# select images ready for phase0 analysis
    31 # new entries are added to Phase0Imfiles
     31# new entries are added to p0PendingImfile
    3232# compare the new list with the ones already selected
    3333task           phase0.imfile.load
     
    4949  task.exit    $EXIT_SUCCESS
    5050    # convert 'stdout' to book format
    51     ipptool2book stdout Phase0Imfiles -key exp_tag -uniq
     51    ipptool2book stdout p0PendingImfile -key exp_tag -uniq
    5252    if ($VERBOSE > 2)
    53       book listbook Phase0Imfiles
    54     end
    55 
    56     # delete existing entries which are DONE
    57     book delpage Phase0Imfiles -key state DONE
    58     echo "p0tool -pendingimfile dtime: $JOB_DTIME"
     53      book listbook p0PendingImfile
     54    end
     55
     56    # delete existing entries which are DONE or DATAERR
     57    book delpage p0PendingImfile -key state DONE
     58    book delpage p0PendingImfile -key state DATA_ERR
    5959  end
    6060
     
    7777
    7878  task.exec
    79     book npages Phase0Imfiles -var N
     79    book npages p0PendingImfile -var N
    8080    if ($N == 0) break
    8181    if ($network == 0) break
    8282   
    83     # look for new images in Phase0Imfiles
    84     book getpage Phase0Imfiles 0 -var pageName -key state NULL
     83    # look for new images in p0PendingImfile
     84    book getpage p0PendingImfile 0 -var pageName -key state NULL
    8585    if ($pageName == NULL) break
    8686
    87     book setword Phase0Imfiles $pageName state RUN
    88     # Phase0Imfiles->pageName->state = RUN
    89 
    90     book getword Phase0Imfiles $pageName exp_tag -var EXP_TAG
    91     # $EXP_TAG = Phase0Imfiles->pageName->exp_tag
    92     book getword Phase0Imfiles $pageName class -var CLASS
    93     book getword Phase0Imfiles $pageName class_id -var CLASS_ID
    94     book getword Phase0Imfiles $pageName uri -var URI
     87    book setword p0PendingImfile $pageName state RUN
     88    # p0PendingImfile->pageName->state = RUN
     89
     90    book getword p0PendingImfile $pageName exp_tag -var EXP_TAG
     91    # $EXP_TAG = p0PendingImfile->pageName->exp_tag
     92    book getword p0PendingImfile $pageName class -var CLASS
     93    book getword p0PendingImfile $pageName class_id -var CLASS_ID
     94    book getword p0PendingImfile $pageName uri -var URI
    9595
    9696    # specify choice of remote host
     
    120120
    121121  # success
    122   task.exit 0
    123     # phase0_imfile.pl updates DB tables, here we just update the page
    124     book setword Phase0Imfiles $options:0 state DONE
    125     # equiv to: Phase0Imfiles->pageName->state = DONE
    126   end
    127 
    128   # default exit status
    129   task.exit    default
    130     showcommand failure
    131     book setword Phase0Imfiles $options:0 state FAIL
    132   end
    133 
    134   # operation times out?
    135   task.exit    timeout
    136     showcommand timeout
    137     book setword Phase0Imfiles $options:0 state TIMEOUT
     122  task.exit default
     123    process_exit p0PendingImfile $options:0 $JOB_STATUS
     124  end
     125
     126  # operation timed out?
     127  task.exit    timeout
     128    showcommand timeout
     129    book setword p0PendingImfile $options:0 state TIMEOUT
    138130  end
    139131end
     
    157149  task.exit    0
    158150    # convert 'stdout' to book format
    159     ipptool2book stdout Phase0Exposures -key exp_tag -uniq
     151    ipptool2book stdout p0PendingExp -key exp_tag -uniq
    160152    if ($VERBOSE > 2)
    161       book listbook Phase0Exposures
     153      book listbook p0PendingExp
    162154    end
    163155
    164156    # delete existing entries which are DONE
    165     book delpage Phase0Exposures -key state DONE
    166     echo "p0tool -pendingexp dtime: $JOB_DTIME"
     157    book delpage p0PendingExp -key state DONE
     158    book delpage p0PendingExp -key state DATA_ERR
    167159  end
    168160
     
    185177
    186178  task.exec
    187     book npages Phase0Exposures -var N
     179    book npages p0PendingExp -var N
    188180    if ($N == 0) break
    189181    if ($network == 0) break
    190182   
    191     # look for new images in Phase0Exposures (state == NULL)
    192     book getpage Phase0Exposures 0 -var pageName -key state NULL
     183    # look for new images in p0PendingExp (state == NULL)
     184    book getpage p0PendingExp 0 -var pageName -key state NULL
    193185    if ($pageName == NULL) break
    194186
    195     book setword Phase0Exposures $pageName state RUN
    196     book getword Phase0Exposures $pageName exp_tag -var EXP_TAG
     187    book setword p0PendingExp $pageName state RUN
     188    book getword p0PendingExp $pageName exp_tag -var EXP_TAG
    197189
    198190    # specify choice of remote host:(need to choose based on chips)
     
    222214
    223215  # success
    224   task.exit 0
    225     # phase0exp.pl updates DB tables, here we just update the page
    226     book setword Phase0Exposures $options:0 state DONE
    227   end
    228 
    229   # default exit status
    230   task.exit    default
    231     showcommand failure
    232     book setword Phase0Exposures $options:0 state FAIL
     216  task.exit default
     217    process_exit p0PendingExp $options:0 $JOB_STATUS
    233218  end
    234219
     
    236221  task.exit    timeout
    237222    showcommand timeout
    238     book setword Phase0Exposures $options:0 state TIMEOUT
     223    book setword p0PendingExp $options:0 state TIMEOUT
    239224  end
    240225end
Note: See TracChangeset for help on using the changeset viewer.