IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 27, 2010, 2:42:17 PM (16 years ago)
Author:
rhenders
Message:

Loads of stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/roboczar.pl

    r28715 r28719  
    44use strict;
    55use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     6use POSIX qw/strftime/;
    67
    78# local classes
     
    910use czartool::Gpc1Db;
    1011use czartool::Pantasks;
     12use czartool::Czarplot;
    1113
    1214
    1315my $period = 60;
    1416my $czarDbName = "czardb"; # TODO variables for other Db stuff, host etc
    15 my $save_temps = 1;
     17my $save_temps = 0;
    1618
    1719my $czarDb = new czartool::CzarDb($czarDbName, "ippdb01", "ipp", "ipp");
    1820my $gpc1Db = new czartool::Gpc1Db("gpc1", "ippdb01", "ippuser", "ippuser");
    1921my $pantasks = new czartool::Pantasks();
     22my $czarplot = new czartool::Czarplot($czarDb, "%Y%m%d-%H%M%S", "png", "~/", $save_temps);
     23$czarDb->setDateFormat("%Y%m%d-%H%i%s");
     24
    2025my @stages = ("chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist");
    2126
     
    7984    my $full;
    8085    my $faults;
    81     my $currentTime;
    8286    my $stage;
    8387    my ($totalNew,$totalFull,$totalFaults);
     
    8892    my $rows = undef;
    8993    my $row = undef;
     94    my $begin = undef;
     95    my $end = undef;
     96    my $priority = undef;
    9097
    9198    while (1) {
     
    94101        updateLabels();
    95102        if (!$czarDb->getCurrentLabels("stdscience", \$rows)) {next;}
     103
     104        my $size = @{$rows};
     105        if($size < 1) {
     106           
     107            print "* WARNING: no stdscience labels found in Db\n";
     108            next;
     109        }
     110
     111        # get priority
     112        foreach $row ( @{$rows} ) {
     113            my ($label) = @{$row};
     114            $priority = $gpc1Db->getPriority($label);
     115            $czarDb->setLabelPriority($label, $priority);
     116        }
     117
     118        # sort out times
     119        $begin =  strftime('%Y-%m-%d 07:00',localtime);
     120        $end = $czarDb->getNowTimestamp();
    96121
    97122        foreach $stage (@stages) {
     
    112137                $full = $gpc1Db->countExposures($label, $stage, "full");
    113138                $faults = $gpc1Db->countFaults($label, $stage);
    114                 $currentTime = time();
    115139
    116140                #printf("%ld, %s, %s, %d, %d\n", $currentTime, $label, $stage, $new, $faults);
     
    125149        }
    126150
     151        print "* Generating plots\n";
    127152        foreach $row ( @{$rows} ) {
    128153            my ($label) = @{$row};
     154
     155            $czarplot->createTimeSeries($label, undef, $begin, $end);
     156            $czarplot->createHistogram($label, $begin, $end);
     157
    129158            #routineChecks($label, "1 HOUR");
    130159        }
     160            $czarplot->createTimeSeries("all_labels", undef, $begin, $end);
     161            $czarplot->createHistogram("all_labels", $begin, $end);
    131162        print "--------------------------------------------------------------------------\n";
    132163        print "* Going to sleep\n";
Note: See TracChangeset for help on using the changeset viewer.