IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26030


Ignore:
Timestamp:
Nov 4, 2009, 11:34:42 AM (17 years ago)
Author:
bills
Message:

add tasks and scripts that execute magicdstool -definebyquery and disttool -definebyquery

Location:
trunk
Files:
1 added
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/Build.PL

    r25822 r26030  
    6060        scripts/magic_destreak_revert.pl
    6161        scripts/magic_destreak_cleanup.pl
     62        scripts/magic_destreak_defineruns.pl
    6263        scripts/ippdb.pl
    6364        scripts/ipp_cleanup.pl
     
    8788        scripts/dist_advancerun.pl
    8889        scripts/dist_make_fileset.pl
    89         scripts/dist_queue_runs.pl
     90        scripts/dist_defineruns.pl
    9091        scripts/receive_source.pl
    9192        scripts/receive_fileset.pl
  • trunk/ippScripts/scripts/dist_defineruns.pl

    r26023 r26030  
    11#!/usr/bin/env perl
     2#
     3# dist_queue_runs.pl : run disttool -definebyquery for the various stages or one stage
     4#
    25
    36use Carp;
     
    4043my ($stage, $stage_limit, $dist_root, $no_magic);
    4144my ($dbname, $save_temps, $verbose, $no_update, $logfile);
     45my @labels;
    4246
    4347GetOptions(
     48           'stage=s'        => \$stage,      # stage to queue
     49           'label=s'        => \@labels,     # labels
     50           'stage_limit=s'  => \$stage_limit,# maximum number of runs queued for each stage
    4451           'dist_root=s'    => \$dist_root,  # root of distribution work area
    45            'stage=s'        => \$stage,      # stage to queue
    46            'stage_limit=s'  => \$stage_limit,# maximum number of runs queued for each stage
    47            'no_magic'       => \$no_magic,   # queue runs without requiring magic
     52           'no_magic'       => \$no_magic,   # queue runs without requiring magic (for testing only)
    4853           'dbname=s'       => \$dbname,     # Database name
    4954           'verbose'        => \$verbose,    # Print stuff?
     
    5459
    5560pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    56 if (0) {
    57 pod2usage( -msg => "Required options: --stage",
     61pod2usage( -msg => "Required options: --label",
    5862           -exitval => 3) unless
    59     defined $stage;
    60 }
     63    (scalar @labels > 0);
    6164
    6265$ipprc->redirect_output($logfile) if $logfile;
     
    6770}
    6871
    69 my ($day, $month, $year) = (localtime)[3,4,5];
     72my ($day, $month, $year) = (gmtime)[3,4,5];
    7073my $datestr = sprintf "%04d%02d%02d", $year+1900, $month + 1, $day;
    7174
     
    8285}
    8386
    84 # XXX: how shall we deal with labels?
    85 my $label = 'proc';
    86 
    8787foreach my $stage (@stages) {
    88     my $command = "$disttool -definebyquery -stage $stage -workdir $workdir";
    89     $command .= " -no_magic" if $no_magic;
    90     $command .= " -dry_run" if $no_update;
    91     $command .= " -limit $stage_limit" if $stage_limit;
    92     $command .= " -set_label $label";
    93     $command .= " -dbname $dbname" if defined $dbname;
    94     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    95         run(command => $command, verbose => $verbose);
    96     unless ($success) {
    97         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    98         &my_die("Unable to perform $command error_code: $error_code", $error_code);
     88    foreach my $label (@labels) {
     89        my $command = "$disttool -definebyquery -stage $stage -workdir $workdir -label $label";
     90        $command .= " -no_magic" if $no_magic;
     91        $command .= " -dry_run" if $no_update;
     92        $command .= " -limit $stage_limit" if $stage_limit;
     93        $command .= " -set_label $label";
     94        $command .= " -dbname $dbname" if defined $dbname;
     95        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     96            run(command => $command, verbose => $verbose);
     97        unless ($success) {
     98            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     99            &my_die("Unable to perform $command error_code: $error_code", $error_code);
     100        }
     101        # display the output from the command
     102        print STDERR join "", @$stdout_buf if $verbose;
    99103    }
    100     # display the output from the command
    101     print STDERR join "", @$stdout_buf if $verbose;
    102104}
    103105
     106if (0) {
     107# notyet
    104108# queue rcRuns for any distRuns that have completed and have interested destinations
    105 {
    106109    my $command = "$disttool -queuercrun";
    107110    $command .= " -dbname $dbname" if defined $dbname;
  • trunk/ippTasks/survey.pro

    r25946 r26030  
    1212  book create SURVEY_MAGIC
    1313end
     14book getbook SURVEY_DESTREAK -var isBook
     15if ("$isBook" == "NULL")
     16  book create SURVEY_DESTREAK
     17end
     18book getbook SURVEY_DIST -var isBook
     19if ("$isBook" == "NULL")
     20  book create SURVEY_DIST
     21end
    1422
    1523$SURVEY_DIFF_DB = 0
    1624$SURVEY_MAGIC_DB = 0
     25$SURVEY_DESTREAK_DB = 0
     26$SURVEY_DIST_DB = 0
    1727
    1828$SURVEY_EXEC = 120
     
    7484  end
    7585  book listbook SURVEY_MAGIC
     86end
     87
     88# user functions to manipulate destreak labels
     89macro survey.add.destreak
     90  if ($0 != 3)
     91    echo "USAGE: survey.add.destreak (label) (workdir base)"
     92    break
     93  end
     94  book newpage SURVEY_DESTREAK $1
     95  book setword SURVEY_DESTREAK $1 WORKDIR $2
     96  book setword SURVEY_DESTREAK $1 STATE PENDING
     97end
     98
     99macro survey.del.destreak
     100  if ($0 != 2)
     101    echo "USAGE: survey.del.destreak (label)"
     102    break
     103  end
     104  book delpage SURVEY_DESTREAK $1
     105end
     106
     107macro survey.show.destreak
     108  if ($0 != 1)
     109    echo "USAGE: survey.show.destreak"
     110    break
     111  end
     112  book listbook SURVEY_DESTREAK
     113end
     114
     115# user functions to manipulate dist labels
     116macro survey.add.dist
     117  if ($0 != 2)
     118    echo "USAGE: survey.add.dist (label)"
     119    break
     120  end
     121  book newpage SURVEY_DIST $1
     122  book setword SURVEY_DIST $1 STATE PENDING
     123end
     124
     125macro survey.del.dist
     126  if ($0 != 2)
     127    echo "USAGE: survey.del.dist (label)"
     128    break
     129  end
     130  book delpage SURVEY_DIST $1
     131end
     132
     133macro survey.show.dist
     134  if ($0 != 1)
     135    echo "USAGE: survey.show.dist"
     136    break
     137  end
     138  book listbook SURVEY_DIST
    76139end
    77140
     
    229292end
    230293
     294task survey.destreak
     295  host local
     296 
     297  periods      -poll $SURVEY_POLL
     298  periods      -exec $SURVEY_EXEC
     299  periods      -timeout $SURVEY_TIMEOUT
     300  npending     1
     301
     302  active false
     303
     304  stdout $LOGDIR/survey.destreak.log
     305  stderr $LOGDIR/survey.destreak.log
     306
     307  # generate destreak runs
     308  task.exec
     309    book npages SURVEY_DESTREAK -var N
     310    if ($N == 0)
     311#      echo "No labels for processing"
     312      break
     313    endif
     314
     315    book getpage SURVEY_DESTREAK 0 -var label -key STATE NEW
     316    if ("$label" == "NULL")
     317      # All labels have been done --- reset
     318#      echo "Resetting labels"
     319      for i 0 $N
     320        book getpage SURVEY_DESTREAK $i -var label
     321        book setword SURVEY_DESTREAK $label STATE NEW
     322      end
     323      book getpage SURVEY_DESTREAK 0 -var label -key STATE NEW
     324
     325      # Select different database
     326      $SURVEY_DESTREAK_DB ++
     327      if ($SURVEY_DESTREAK_DB >= $DB:n)
     328        set $SURVEY_DESTREAK_DB = 0
     329      end
     330    end
     331
     332    book setword SURVEY_DESTREAK $label STATE DONE
     333    book getword SURVEY_DESTREAK $label WORKDIR -var workdir
     334 
     335    $run = magic_destreak_defineruns.pl --label $label --workdir $workdir/$label/
     336
     337    if ($DB:n == 0)
     338      option DEFAULT
     339    else
     340      $run = $run -dbname $DB:$SURVEY_MAGIC_DB
     341      option $DB:$SURVEY_MAGIC_DB
     342    end
     343   
     344#    echo $run
     345    command $run
     346  end
     347
     348  # success
     349  task.exit    0
     350#    echo "Success"
     351  end
     352
     353  # locked list
     354  task.exit    default
     355    showcommand failure
     356  end
     357
     358  task.exit    crash
     359    showcommand crash
     360  end
     361
     362  # operation times out?
     363  task.exit    timeout
     364    showcommand timeout
     365  end
     366end
     367
     368task survey.dist
     369  host local
     370 
     371  periods      -poll $SURVEY_POLL
     372  periods      -exec $SURVEY_EXEC
     373  periods      -timeout $SURVEY_TIMEOUT
     374  npending     1
     375
     376  stdout $LOGDIR/survey.dist.log
     377  stderr $LOGDIR/survey.dist.log
     378
     379  # generate distribution runs
     380  task.exec
     381    book npages SURVEY_DIST -var N
     382    if ($N == 0)
     383#      echo "No labels for processing"
     384      break
     385    endif
     386
     387    book getpage SURVEY_DIST 0 -var label -key STATE NEW
     388    if ("$label" == "NULL")
     389      # All labels have been done --- reset
     390#      echo "Resetting labels"
     391      for i 0 $N
     392        book getpage SURVEY_DIST $i -var label
     393        book setword SURVEY_DIST $label STATE NEW
     394      end
     395      book getpage SURVEY_DIST 0 -var label -key STATE NEW
     396
     397      # Select different database
     398      $SURVEY_DIST_DB ++
     399      if ($SURVEY_DIST_DB >= $DB:n)
     400        set $SURVEY_DIST_DB = 0
     401      end
     402    end
     403
     404    book setword SURVEY_DIST $label STATE DONE
     405 
     406    # note workdir is set by the script based on site.config
     407    $run = dist_defineruns.pl --label $label
     408
     409    if ($DB:n == 0)
     410      option DEFAULT
     411    else
     412      $run = $run --dbname $DB:$SURVEY_DIST_DB
     413      option $DB:$SURVEY_DIST_DB
     414    end
     415   
     416#    echo $run
     417    command $run
     418  end
     419
     420  # success
     421  task.exit    0
     422#    echo "Success"
     423  end
     424
     425  # locked list
     426  task.exit    default
     427    showcommand failure
     428  end
     429
     430  task.exit    crash
     431    showcommand crash
     432  end
     433
     434  # operation times out?
     435  task.exit    timeout
     436    showcommand timeout
     437  end
     438end
Note: See TracChangeset for help on using the changeset viewer.