IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

File:
1 moved

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.