IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 26, 2010, 10:33:29 AM (16 years ago)
Author:
eugene
Message:

merge updates from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101103/tools/czarplot.pl

    r29580 r29834  
    88
    99use czartool::CzarDb;
     10use czartool::Gpc1Db;
    1011use czartool::Plotter;
     12use czartool::StageMetrics;
    1113
    1214my $czarDbName = "czardb";
     
    1416my $stage = undef;
    1517my $save_temps = undef;
    16 my $interval = undef;
     18my $timeinpast = undef;
    1719my $begin = undef;
    1820my $end = undef;
     
    2325my $timeSeries = undef;
    2426my $rate = undef;
     27my $magicMask = undef;
     28my $rateInterval = undef;
    2529my $deriv = undef;
    2630my $showCleanup = undef;
     
    2832my $savingToFile = undef;
    2933my $analysis = undef;
     34my $exposureId = undef;
    3035my $log = undef;
    3136
     
    3439        "label|l=s" => \$label,
    3540        "stage|s=s" => \$stage,
    36         "interval|i=s" => \$interval,
     41        "timeinpast|p=s" => \$timeinpast,
     42        "rateinterval|i=s" => \$rateInterval,
     43        "exposureid|x=s" => \$exposureId,
     44        "mask|m" => \$magicMask,
    3745        "begin|b=s" => \$begin,
    3846        "end|e=s" => \$end,
     
    5765    print "* UNKNKOWN: option                          @ARGV\n";
    5866}
     67if ($analysis && !$stage) {
     68    $quit = 1;
     69    print "* REQUIRED: choose a stage for analsis      -s <chip|cam|warp|etc>      (default=none)\n";}
    5970if (!$histogram) {
    6071    print "* OPTIONAL: plot histogram                  -h                          (default=off)\n";}
    6172if (!$timeSeries) {
    6273    print "* OPTIONAL: plot timeseries                 -t                          (default=on)\n";}
     74if (!$magicMask) {
     75    print "* OPTIONAL: plot magic mask for these times -m                          (default=off)\n";}
     76if (!$exposureId) {
     77    print "* OPTIONAL: set exposure ID for magic mask  -x                          (default=none)\n";}
    6378if (!$rate) {
    64     print "* OPTIONAL: plot timeseries of rate         -r                          (default=off)\n";}
     79    print "* OPTIONAL: plot histogram of rate          -r                          (default=off)\n";}
    6580if (!$deriv) {
    6681    $deriv = 0;
     
    7489if (!$log) {
    7590    $log = 0;
    76     print "* OPTIONAL: use log plots                   -g                          (default=$log\n";}
     91    print "* OPTIONAL: use log plots                   -g                          (default=$log)\n";}
    7792if (!$nebulous) {
    7893    print "* OPTIONAL: plot nebulous disk space        -n                          (default=off)\n";}
     
    8297if (!$stage) {
    8398    print "* OPTIONAL: choose a stage                  -s <chip|cam|warp|etc>      (default=none)\n";}
    84 if (!$interval) {
    85     print "* OPTIONAL: choose time interval in past    -i <'1 hour'|'1 day'|etc>   (default=none\n";}
     99if (!$timeinpast) {
     100    print "* OPTIONAL: choose time interval in past    -p <'1 hour'|'1 day'|etc>   (default=none\n";}
     101if (!$rateInterval) {
     102    print "* OPTIONAL: time interval for rate plot     -i <'1 hour'|'1 day'|etc>   (default=depends on time frame)\n";}
    86103if (!$begin) {
    87104    print "* OPTIONAL: choose a begin time             -b <datetime>               (default=6:35am this morning)\n";}
     
    98115
    99116# default values
    100 if (!$nebulous && !$histogram && !$timeSeries) {$timeSeries = 1; $histogram = 0;}
     117if (!$rate && !$magicMask && !$nebulous && !$histogram && !$analysis && !$timeSeries) {$timeSeries = 1;}
    101118if (!$verbose) {$verbose = 0;}
    102119if (!$save_temps) {$save_temps = 0;}
     
    104121else {$savingToFile = 1;}
    105122
     123my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser");
    106124my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp", $verbose, $save_temps);
    107125$czarDb->setDateFormat("%Y%m%d-%H%i%s");
     
    109127
    110128my $plotter = new czartool::Plotter(
     129        $gpc1Db,
    111130        $czarDb,
    112131        "%Y%m%d-%H%M%S",
     
    121140    $begin =  "$day 06:35";
    122141    $end = "$day 23:59";
     142        print "JKJKJK '$begin' '$end' \n";
     143
    123144}
    124145else {
     
    127148    if (!$begin) {
    128149
    129         if ($interval) {$begin = $czarDb->subtractInterval($end, $interval);}
     150        if ($timeinpast) {$begin = $czarDb->subtractInterval($end, $timeinpast);}
    130151        else {$begin =  strftime('%Y-%m-%d 06:35',localtime);}
    131152    }
     
    134155
    135156if ($rate) {
    136 
    137     if (!$interval) {$interval = "1 HOUR";}
    138     $plotter->createRateTimeSeries($label, $stage, $begin, $end, $interval, $log);
     157    $plotter->createRateTimeSeries($label, $stage, $begin, $end, $rateInterval, $log);
    139158    exit;
    140159}
     
    143162if ($nebulous && $timeSeries) {$plotter->plotStorageTimeSeries($begin, $end);}
    144163elsif ($nebulous) {$plotter->plotDiskUsageHistogram();}
     164if ($magicMask) {
     165   
     166    if ($exposureId) {$plotter->plotMagicMaskFractionForThisExposure($exposureId);}
     167    else {$plotter->plotMagicMaskFractionHistogram($begin, $end);}
    145168
     169}
    146170
    147171if($analysis) {
    148172
    149     my ($started, $finished, $stuck, $processed, $pending, $faults, $totalTime);
    150     $czarDb->runAnalysis($label, $stage, $begin, $end, \$started, \$finished, \$stuck, \$processed, \$pending, \$faults, \$totalTime);
    151 
    152     if (defined $started) {print "* Processing started at $started\n";}
    153     if (defined $finished) {print "* Processing finished at $finished and took $totalTime\n";}
    154     else {print "* Processing has not finished\n";}
    155     if (defined $stuck) {print "* Processing has been stuck since $stuck\n";}
    156     print "* $processed exposures have been processed, with $pending pending and $faults faults\n";
    157 
    158     print "*******************************************************************************\n";
     173    my $stageMetrics = new czartool::StageMetrics($stage, $label, $begin, $end);
     174    if ($czarDb->runAnalysis($stageMetrics)) {$stageMetrics->printMe();}
    159175}
Note: See TracChangeset for help on using the changeset viewer.