IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40803 for trunk


Ignore:
Timestamp:
Jun 20, 2019, 10:20:26 AM (7 years ago)
Author:
eugene
Message:

allow addstar_multi_run to limit the number of cmf files loaded at one time

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/addstar_multi_run.pl

    r39160 r40803  
    3333my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    3434my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1);
     35
    3536if ($missing_tools) {
    3637    warn("Can't find required tools.");
     
    4041
    4142my ( $label,$camera, $stage, $stage_id, $use_diff_inv, $outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
    42      $no_op, $redirect, $save_temps);
     43     $no_op, $redirect, $save_temps, $limit_number);
    4344GetOptions(
    44     'label=s'          => \$label, #addstar label
    45     'camera|c=s'        => \$camera, # Camera
    46     'stage|s=s'        => \$stage, # Camera
    47     'stage_id|w=s'   => \$stage_id,
    48     'use_diff_inv'   => \$use_diff_inv, #use inv images for diff cmf?
    49     'dbname|d=s'        => \$dbname, # Database name
    50     'outroot|w=s'       => \$outroot, # output file base name
    51     'stageroot|w=s'       => \$stageroot, # stage root name.
    52     'reduction=s'       => \$reduction, # Reduction class
    53     'dvodb|w=s'         => \$dvodb,  # output DVO database
    54     'minidvodb_name|w=s'=> \$minidvodb_name,  # miniDVO database name
    55     'minidvodb_group|w=s' => \$minidvodb_group, # miniDVO database group
    56     'minidvodb'         => \$minidvodb,  # use minidvodb?
    57     'image-only'        => \$image_only,   # Print to stdout
    58     'verbose'           => \$verbose,   # Print to stdout
    59     'no-update'         => \$no_update, # Update the database?
    60     'no-op'             => \$no_op, # Don't do any operations?
    61     'redirect-output'   => \$redirect,
    62     'save-temps'        => \$save_temps, # Save temporary files?
     45    'label=s'             => \$label, # addstar label
     46    'stage=s'             => \$stage, # stage (camera, fullforce, etc)
     47    'stage_id=s'          => \$stage_id,
     48    'camera=s'            => \$camera, # Camera
     49    'outroot=s'           => \$outroot, # output file base name
     50    'dvodb=s'             => \$dvodb,  # output DVO database
     51    'stageroot=s'         => \$stageroot, # stage root name.
     52    'limit=i'             => \$limit_number,
     53    'use_diff_inv'        => \$use_diff_inv, # use inv images for diff cmf?
     54    'dbname=s'            => \$dbname, # Database name
     55    'reduction=s'         => \$reduction, # Reduction class
     56    'minidvodb_name=s'    => \$minidvodb_name,  # miniDVO database name
     57    'minidvodb_group=s'   => \$minidvodb_group, # miniDVO database group
     58    'minidvodb'           => \$minidvodb,  # use minidvodb?
     59    'image-only'          => \$image_only,   # Print to stdout
     60    'verbose'             => \$verbose,   # Print to stdout
     61    'no-update'           => \$no_update, # Update the database?
     62    'no-op'               => \$no_op, # Don't do any operations?
     63    'redirect-output'     => \$redirect,
     64    'save-temps'          => \$save_temps, # Save temporary files?
    6365    ) or pod2usage( 2 );
    6466
    6567pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    6668pod2usage(
    67           -msg => "Required options: --label --stage_id --stage --camera --outroot --dvodb --stageroot",
     69          -msg => "Required options: --label --stage --stage_id --camera --outroot --dvodb --stageroot",
    6870          -exitval => 3,
    6971          ) unless
     
    111113#my $temp_file = $outroot.".log.".$label.".".$stage.".".$stage_id.".list";
    112114my $temp_file = "/tmp/addstar.list";
     115# XXX this temp_file is dangerous: multiple instances of this program will overwrite
    113116
    114117print "using $temp_file for list\n";
     
    116119open( TEMPLIST, ">$temp_file") or &my_die( "Can't open $temp_file\n", $stage_id,$stage,$label, $PS_EXIT_UNKNOWN_ERROR);
    117120
     121my @stage_extra1 = ();
     122
     123# query database for list of exposures: we need to generate the input list for addstar
    118124{
    119125    my $mdcParser = PS::IPP::Metadata::Config->new;
    120     my $command = "$addtool -pendingexp -stage_id ".$stage_id;
    121     $command .= " -stage $stage -label $label";
    122     $command .= " -dbname $dbname" if defined $dbname;
    123 
    124         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    125             run(command => $command, verbose => $verbose);
     126
     127    my $command = "$addtool -pendingexp";
     128    $command .= " -stage_id $stage_id";
     129    $command .= " -stage $stage";
     130    $command .= " -label $label";
     131    $command .= " -dbname $dbname"      if defined $dbname;
     132    $command .= " -limit $limit_number" if defined $limit_number;
     133   
     134    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     135        run(command => $command, verbose => $verbose);
    126136    &my_die( "Unable to get info on addRun", $stage_id,$stage, $label, $PS_EXIT_SYS_ERROR) unless $success;
     137
    127138    if (scalar @$stdout_buf == 0 ) {
    128         #&my_die( "empty addRun", $stage_id,$stage,$label, $PS_EXIT_SYS_ERROR);
     139        # if there are no entries, just exit (do not update database with a fault)
     140        # &my_die( "empty addRun", $stage_id,$stage,$label, $PS_EXIT_SYS_ERROR);
    129141        print "empty addRun, exiting... $stage,  $stage_id, $label\n";
    130142        exit 0;
    131     } else {
    132             my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    133                 &my_die("Unable to parse metadata config", $stage_id,$stage,$label, $PS_EXIT_PROG_ERROR);
    134             #this fails if there is nothing listed. I checked.
    135             my $components = parse_md_list($metadata) or
    136                 &my_die("Unable to parse metadata list", $stage_id,$stage,$label, $PS_EXIT_PROG_ERROR);
    137             my $num_components = scalar @$components;
    138             print "there are $num_components\n";
    139             foreach my $comp  (@$components) {
    140                 my  $mparsed = $comp->{stageroot};
    141            
    142                 if (!defined($mparsed)) {
    143                     &my_die("Unable to parse stageroot", $stage_id,$stage,$label, $PS_EXIT_PROG_ERROR);
    144                 } #but just to make sure, have it grab a minidvodb_name, to make sure it's not junk.
    145                 print "found a value for stageroot:$mparsed\n";
    146                 my $fpaObjects = $mparsed.'.cmf';
    147                 my $realFile = $ipprc->file_resolve($fpaObjects);
    148                 if (!defined($realFile)) {
    149                     &my_die("unable to resolve real file from $mparsed",$stage_id, $stage, $label, 7);
    150                 }
    151                 printf TEMPLIST "$realFile = $fpaObjects\n";
    152                 if ($stage =~ /diff/) { # hardwired  for now$use_diff_inv) {
    153                     print "finding the inv.cmf files\n";
    154                     my $fpaObjectsInv = $mparsed.'.inv.cmf';
    155                     my $realFileInv = $ipprc->file_resolve($fpaObjectsInv);
    156                     if (!defined($realFileInv)) {
    157                         &my_die("unable to resolve real file from $mparsed",$stage_id, $stage, $label, 7);
    158                     }
    159                     printf TEMPLIST "$realFileInv = $fpaObjectsInv\n";
    160                 }
    161                
     143    }
     144
     145    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     146        &my_die("Unable to parse metadata config", $stage_id,$stage,$label, $PS_EXIT_PROG_ERROR);
     147    # this fails if there is nothing listed. I checked.
     148    my $components = parse_md_list($metadata) or
     149        &my_die("Unable to parse metadata list", $stage_id,$stage,$label, $PS_EXIT_PROG_ERROR);
     150    my $num_components = scalar @$components;
     151    print "there are $num_components\n";
     152
     153    # go through the list of components to create addstar input list
     154    foreach my $comp  (@$components) {
     155        my $mparsed = $comp->{stageroot};
     156       
     157        if (!defined($mparsed)) {
     158            &my_die("Unable to parse stageroot", $stage_id,$stage,$label, $PS_EXIT_PROG_ERROR);
     159        } #but just to make sure, have it grab a minidvodb_name, to make sure it's not junk.
     160        print "found a value for stageroot:$mparsed\n";
     161
     162        my $fpaObjects = $mparsed . '.cmf';
     163        my $realFile = $ipprc->file_resolve($fpaObjects);
     164        if (!defined($realFile)) {
     165            &my_die("unable to resolve real file from $mparsed",$stage_id, $stage, $label, 7);
     166        }
     167
     168        printf TEMPLIST "$realFile = $fpaObjects\n";
     169        if ($stage =~ /diff/) { # hardwired for now: $use_diff_inv) {
     170            print "finding the inv.cmf files\n";
     171            my $fpaObjectsInv = $mparsed . '.inv.cmf';
     172            my $realFileInv = $ipprc->file_resolve($fpaObjectsInv);
     173            if (!defined($realFileInv)) {
     174                &my_die("unable to resolve real file from $mparsed", $stage_id, $stage, $label, 8);
    162175            }
    163 
    164     }
    165 }
     176            printf TEMPLIST "$realFileInv = $fpaObjectsInv\n";
     177        }
     178
     179        # save the stage_extra1 values so we can update the database correctly at the end
     180        my $stage_extra1_value = $comp->{stage_extra1};
     181        if (!defined($stage_extra1_value)) {
     182            &my_die("unable to find stage_extra1 value for $mparsed", $stage_id, $stage, $label, 9);
     183        }
     184        push @stage_extra1, $stage_extra1_value;
     185    }
     186}
     187
    166188close(TEMPLIST);
    167189print "saved $temp_file here\n";
     
    173195    $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal ) or &my_die("can't get path for dvodb", $stage_id,$stage,$label, $PS_EXIT_CONFIG_ERROR);
    174196}
     197
    175198my $dtime_addstar = 0;
    176199if (defined $dvodbReal) {
     
    200223            &my_die("Unable to parse minidvodb_name", $stage_id,$stage,$label, $PS_EXIT_PROG_ERROR);
    201224        }
    202     }
    203     else {
     225    } else {
    204226        $minidvodb_path = $dvodbReal;
    205227    }
    206228   
    207229    unless ($no_op) {
    208             print $dvodbReal;
    209            
    210             ## addstar can either save the full set of detections, or just
    211             ## the image metadata, in the dvodb.  this is set in the
    212             ## database table addRun
    213 
    214             # addstar requires the user to have a valid .ptolemyrc which
    215             # in turn points at ippconfig/dvo.site
    216 
    217             # get the names for the camera and the real input file
    218             my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar
    219            
    220 #           my $realFile = $ipprc->file_resolve($fpaObjects) or  &my_die("Unable to resolve $fpaObjects", $stage_id,$stage,$label, $PS_EXIT_SYS_ERROR);
    221 
    222             # most cameras use CHIP_HEADER.  other exceptions:
    223             # gpc1 @ camera : PHU_HEADER
    224             # gpc1 @ staticsky : NOMINAL (is uncalibrated)
    225 
    226             # temporary hard-wired info
    227             my $zeroPointOption = "CHIP_HEADER";
    228             if (($camdir =~ /gpc1/) && ($stage =~ /staticsky/)) {
    229                 $zeroPointOption = "NOMINAL";
    230             }           
    231             if (($camdir =~ /gpc1/) && ($stage =~ /cam/)) {
    232                 $zeroPointOption = "PHU_HEADER";
    233             }           
    234 
    235             # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
    236             my $command  = "$addstar -update"; # XXX optionally set -update?
    237             $command .= " -D CAMERA $camdir";
    238             $command .= " -D CATDIR $minidvodb_path";
    239             $command .= " -D ZERO_POINT_OPTION $zeroPointOption";
    240             $command .= " -list $temp_file";
    241             $command .= " -image" if $image_only;
    242             if ($stage =~ /staticsky/) {
    243                 $command .= " -accept-astrom -quick-airmass";
    244             }  #careful here - this matches staticsky and staticsky_multi
    245             if ($stage =~ /skycal/) {
    246                 $command .= " -quick-airmass";
    247             }  #careful here - this matches staticsky and staticsky_multi
    248             if ($stage =~ /diff/) {
    249                 $command .= " -accept-astrom";
    250                 if ($use_diff_inv) {
    251                     $command .= " -diff-inv";
    252                 }
     230        print $dvodbReal;
     231       
     232        ## addstar can either save the full set of detections, or just
     233        ## the image metadata, in the dvodb.  this is set in the
     234        ## database table addRun
     235
     236        # addstar requires the user to have a valid .ptolemyrc which
     237        # in turn points at ippconfig/dvo.site
     238
     239        # get the names for the camera and the real input file
     240        my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar
     241       
     242        # most cameras use CHIP_HEADER.  other exceptions:
     243        # gpc1 @ camera : PHU_HEADER
     244        # gpc1 @ staticsky : NOMINAL (is uncalibrated)
     245
     246        # temporary hard-wired info
     247        my $zeroPointOption = "CHIP_HEADER";
     248        if (($camdir =~ /gpc1/) && ($stage =~ /staticsky/)) {
     249            $zeroPointOption = "NOMINAL";
     250        }               
     251        if (($camdir =~ /gpc1/) && ($stage =~ /cam/)) {
     252            $zeroPointOption = "PHU_HEADER";
     253        }               
     254
     255        # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
     256        my $command  = "$addstar -update"; # XXX optionally set -update?
     257        $command .= " -D CAMERA $camdir";
     258        $command .= " -D CATDIR $minidvodb_path";
     259        $command .= " -D ZERO_POINT_OPTION $zeroPointOption";
     260        $command .= " -list $temp_file";
     261        $command .= " -image" if $image_only;
     262        if ($stage =~ /staticsky/) {
     263            $command .= " -accept-astrom -quick-airmass";
     264        }  #careful here - this matches staticsky and staticsky_multi
     265        if ($stage =~ /skycal/) {
     266            $command .= " -quick-airmass";
     267        }  #careful here - this matches staticsky and staticsky_multi
     268        if ($stage =~ /diff/) {
     269            $command .= " -accept-astrom";
     270            if ($use_diff_inv) {
     271                $command .= " -diff-inv";
    253272            }
    254            
    255             if ($stage =~ /fullforce/) {
    256                 $command .= " -accept-astrom -xrad";
    257             }
    258 
    259             my $mjd_addstar_start = DateTime->now->mjd;   # MJD of starting script
    260 
    261             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    262                 run(command => $command, verbose => $verbose);
    263             unless ($success) {
    264                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    265                 &my_die("Unable to perform addstar: $error_code", $stage_id,$stage,$label, $error_code);
    266             }
    267             $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start);   # MJD of starting script
    268     }
    269 }
    270 
    271 
    272 my $fpaCommand = "$addtool -multiadd -stage_id $stage_id";
     273        }
     274       
     275        if ($stage =~ /fullforce/) {
     276            $command .= " -accept-astrom -xrad";
     277        }
     278
     279        my $mjd_addstar_start = DateTime->now->mjd;   # MJD of starting script
     280
     281        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     282            run(command => $command, verbose => $verbose);
     283        unless ($success) {
     284            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     285            &my_die("Unable to perform addstar: $error_code", $stage_id,$stage,$label, $error_code);
     286        }
     287        $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start);   # MJD of starting script
     288    }
     289}
     290
     291my $stage_extra1_list = "";
     292my $Nstage_extra1_list = @stage_extra1;
     293
     294for (my $i = 0; $i < $Nstage_extra1_list; $i ++) {
     295    $stage_extra1_list .= "$stage_extra1[$i]";
     296    if ($i < $Nstage_extra1_list - 1) {
     297        $stage_extra1_list .= ",";
     298    }
     299    print "STAGE EXTRA1 : $stage_extra1[$i]\n";
     300}
     301
     302# at the end, we need to update the database with the entries we actually processed
     303# these are identified by stage_extra1, listed in the array @stage_extra1
     304my $fpaCommand = "$addtool -addprocessedexp";
     305$fpaCommand .= " -multiadd";
    273306$fpaCommand .= " -stage $stage";
     307$fpaCommand .= " -stage_id $stage_id";
    274308$fpaCommand .= " -multiaddlabel $label";
    275 $fpaCommand .= " -addprocessedexp";
     309$fpaCommand .= " -dtime_addstar $dtime_addstar";
     310if ($Nstage_extra1_list > 0) {
     311    $fpaCommand .= " -stage_extra1_list $stage_extra1_list";
     312}
    276313$fpaCommand .= " -path_base $outroot";
    277 $fpaCommand .= " -dtime_addstar $dtime_addstar";
    278314$fpaCommand .= " -dvodb_path $minidvodb_path" if defined $minidvodb_path;
    279315$fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name;
    280316$fpaCommand .= " -dbname $dbname" if defined $dbname;
     317
    281318print $fpaCommand;
     319
    282320# Add the result into the database
    283321unless ($no_update) {
     
    314352        $command .= " -path_base $outroot" if defined $outroot;
    315353        $command .= (" -dtime_addstar " . ((DateTime->now->mjd - $mjd_start) * 86400));
    316    #    $command .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; don't think we want it recorded (not sure)
     354        # $command .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; don't think we want it recorded (not sure)
    317355        $command .= " -dbname $dbname" if defined $dbname;
    318356        print $command;
  • trunk/ippScripts/scripts/addstar_run.pl

    r39286 r40803  
    3131my $addtool = can_run('addtool') or (warn "Can't find addtool" and $missing_tools = 1);
    3232my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1);
     33my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
     34my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1);
     35
     36# these are only used by addstar_run, not addstar_multi
    3337my $fftool  = can_run('fftool') or (warn "Can't find fftool" and $missing_tools = 1);
    34 
    35 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1);
    36 
    37 my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1);
    3838my $loadgalphot = can_run('loadgalphot') or (warn "Can't find loadgalphot" and $missing_tools = 1);
    3939
     
    415415
    416416# This needs to be updated when addtool is written. BROKEN
    417 my $fpaCommand = "$addtool -add_id $add_id";
    418 $fpaCommand .= " -addprocessedexp";
     417my $fpaCommand = "$addtool -addprocessedexp";
     418$fpaCommand .= " -add_id $add_id";
     419$fpaCommand .= " -dtime_addstar $dtime_addstar";
     420
    419421$fpaCommand .= " -path_base $outroot";
    420 $fpaCommand .= " -dtime_addstar $dtime_addstar";
    421422$fpaCommand .= " -dvodb_path $minidvodb_path" if defined $minidvodb_path;
    422423$fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name;
     424$fpaCommand .= " -dbname $dbname" if defined $dbname;
     425
    423426$fpaCommand .= " -stage_extra1 $stage_extra1" if defined $stage_extra1;
    424 $fpaCommand .= " -dbname $dbname" if defined $dbname;
     427
    425428print $fpaCommand;
     429
    426430# Add the result into the database
    427431unless ($no_update) {
  • trunk/ippScripts/scripts/staticsky.pl

    r38566 r40803  
    148148        my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot);
    149149
     150        # XXX this script and psphotStack use the recipe file inconsistently:
     151        # XXX psphotStack respects the value of PSPHOT.STACK.USE.RAW from the config,
     152        # XXX but this script ignores it: if PSPHOT.STACK.USE.RAW is FALSE (needConvolvedImages = 1)
     153        # XXX then psphotStack will expect entries in the input mdc file (CNV:) that this script
     154        # XXX is not supplying.
    150155        my $needConvolvedImages = 0;
    151156
  • trunk/ippTasks/addstar.pro

    r39160 r40803  
    66check.globals
    77
    8 
    98if ($?ADDSTAGES:n == 0)       set ADDSTAGES:n = 0
    10 if ($?MULTIADDSTAGES:n == 0)       set MULTIADDSTAGES:n = 0
    11 
    12 
     9if ($?MULTIADDSTAGES:n == 0)  set MULTIADDSTAGES:n = 0
    1310
    1411book init addPendingExp
    1512book init addPendingMultiExp
    16 
    1713   
    1814macro addstar.status
     
    243239$addstar_multi_stages_DB = 0
    244240
    245     #this may not work for more databases (addstar) will do that later)
     241# this may not work for more databases (addstar) will do that later)
    246242$addstar_revert_DB_C = 0
    247243$addstar_revert_DB_S = 0
     
    253249$addstar_revert_DB_DF = 0
    254250
    255 
    256251#$LOADEXEC_ADD = 300
    257252$LOADEXEC_ADD = 10
    258253
     254if ($?addstar_multiadd_limit == 0) set addstar_multiadd_limit = 0
     255
     256macro set.multiadd.limit
     257  if ($0 != 2)
     258    echo "USAGE: set.multiadd.limit (Nentry)"
     259    break
     260  end
     261
     262  $addstar_multiadd_limit = $1
     263end
     264
     265macro get.multiadd.limit
     266  echo "addstar multi limit : $addstar_multiadd_limit"
     267end
    259268
    260269# select images ready for addstar analysis
     
    545554  periods      -poll $RUNPOLL
    546555  periods      -exec $RUNEXEC
    547   periods      -timeout 1200
     556  periods      -timeout 3600
     557  # addstar MD fields with 250 exp takes about 2400 sec to load
    548558
    549559  ## we want only a single outstanding addstar job. 
     
    641651   # end
    642652
    643 
     653    if ($addstar_multiadd_limit > 0)
     654      $run = $run --limit $addstar_multiadd_limit
     655    end
    644656
    645657    if ("$IMAGE_ONLY" == "T")
    646658      $run = $run --image-only
    647659    end
     660
    648661    if ("$MINIDVODB" == "T")
    649662    $run = $run --minidvodb
  • trunk/ippTools/src/addtool.c

    r39528 r40803  
    138138    PXOPT_LOOKUP_BOOL(destreaked, config->args, "-destreaked", false);
    139139    PXOPT_LOOKUP_BOOL(uncensored, config->args, "-uncensored", false);
     140
     141    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     142
    140143    PXOPT_LOOKUP_BOOL(pretend,    config->args, "-pretend", false);
    141144    PXOPT_LOOKUP_BOOL(simple,     config->args, "-simple", false);
     
    421424      psStringAppend(&query, " GROUP BY ff_id ");  //needs to be checked, but should be fine: want 1 ff summary cmf.
    422425    }
     426
     427    // treat limit == 0 as "no limit"
     428    if (limit) {
     429        psString limitString = psDBGenerateLimitSQL(limit);
     430        psStringAppend(&query, " %s", limitString);
     431        psFree(limitString);
     432    }
     433
    423434    psError(PS_ERR_UNKNOWN, false, "query: %s\n", query);
    424435
     
    12091220      PXOPT_COPY_STR(config->args, where, "-stage", "addRun.stage","==");
    12101221      PXOPT_COPY_S64(config->args, where, "-stage_id", "addRun.stage_id", "==");
     1222
    12111223      //PXOPT_LOOKUP_S64(stage_id, config->args, "-stage_id", false, false);
    12121224    } else {
     
    12311243    psFree(where);
    12321244   
     1245    if (multiadd) {
     1246      // optional -stage_extra1_list extra1,extra1,extra1 to restrict
     1247      PXOPT_LOOKUP_STR(stage_extra1_list, config->args, "-stage_extra1_list", false, false);
     1248      if (stage_extra1_list) {
     1249        psStringAppend(&query, " AND stage_extra1 IN (%s)", stage_extra1_list);
     1250      }
     1251    }
     1252
     1253
    12331254    //if (multiadd) {
    12341255    //  psStringAppend(&query, "group by  %s", "stage_extra1");
  • trunk/ippTools/src/addtoolConfig.c

    r38571 r40803  
    7070    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend",           0, "do not actually modify the database", false);
    7171    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple",            0, "use the simple output format", false);
     72    psMetadataAddU64(definebyqueryArgs, PS_LIST_TAIL, "-limit",              0, "limit result set to N items", 0);
     73
    7274    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb",            0, "use minidvodb", false);
    7375    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb_group", 0,   "define minidvodb_group", NULL);
     
    134136    psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
    135137    psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-stage_extra1",  0,            "set stage_extra1", 0);
     138    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-stage_extra1_list",  0, "restrict multiadd ops to a set of stage_extra1 values", 0);
    136139    psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-stage_id",  0,            "set stage_id", 0);
    137140    psMetadataAddBool(addprocessedexpArgs, PS_LIST_TAIL, "-multiadd",           0, "for addstar multi mode, group by stage_id ", false);
Note: See TracChangeset for help on using the changeset viewer.