IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 20, 2009, 4:13:39 PM (17 years ago)
Author:
eugene
Message:

updates from head

Location:
branches/eam_branches/20091113
Files:
3 deleted
67 edited
14 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091113/DataStore/lib/DataStore/File.pm

    r17552 r26236  
    233233                optional    => 1,
    234234            },
     235            no_proxy     => {
     236                type        => SCALAR,
     237                optional    => 1,
     238            },
    235239        },
    236240    );
     
    245249        $ua = LWP::UserAgent->new;
    246250    }
     251
     252    # load proxy environment variables (if any)
     253    if (!$p{no_proxy}) {
     254        $ua->env_proxy;
     255    }
     256
    247257    my $request = HTTP::Request->new(GET => $self->uri);
    248258    my $filename = $p{filename};
  • branches/eam_branches/20091113/DataStore/lib/DataStore/FileSet.pm

    r17637 r26236  
    189189        {
    190190            ua_args     => {
     191                optional    => 1,
     192            },
     193            no_proxy     => {
     194                type        => SCALAR,
    191195                optional    => 1,
    192196            },
     
    201205        $ua = LWP::UserAgent->new;
    202206    }
     207
     208    if (!$p{no_proxy}) {
     209        # load proxy environment variables (if any)
     210        $ua->env_proxy;
     211    }
     212
    203213    my $request = HTTP::Request->new(GET => $self->uri);
    204214    my $response = $ua->request($request);
  • branches/eam_branches/20091113/DataStore/lib/DataStore/Product.pm

    r17637 r26236  
    172172                optional    => 1,
    173173            },
     174            no_proxy     => {
     175                type        => SCALAR,
     176                optional    => 1,
     177            },
    174178        },
    175179    );
     
    182186        $ua = LWP::UserAgent->new;
    183187    }
     188
     189    if (!$p{no_proxy}) {
     190        # load proxy environment variables (if any)
     191        $ua->env_proxy;
     192    }
    184193
    185194    my $request;
  • branches/eam_branches/20091113/DataStore/lib/DataStore/Root.pm

    r17637 r26236  
    136136                optional    => 1,
    137137            },
     138            no_proxy        => {
     139                type        => SCALAR,
     140                optional    => 1,
     141            },
    138142        },
    139143    );
     
    145149    } else {
    146150        $ua = LWP::UserAgent->new;
     151    }
     152
     153    if (!$p{no_proxy}) {
     154        # load proxy environment variables (if any)
     155        $ua->env_proxy;
    147156    }
    148157
  • branches/eam_branches/20091113/DataStore/scripts/dsfilesetls

    r17752 r26236  
    1616use Pod::Usage qw( pod2usage );
    1717
    18 my ($uri, $timeout);
     18my ($uri, $timeout, $no_proxy);
    1919
    2020GetOptions(
    2121    'uri|u=s'           => \$uri,
    2222    'timeout|t=s'       => \$timeout,
     23    'no-proxy'          => \$no_proxy,
    2324) or pod2usage( 2 );
    2425
     
    3132# default http request timeout is 30s
    3233$timeout ||= 30;
     34$no_proxy = 0 if !defined $no_proxy;
    3335
    3436my $response = DataStore::FileSet->new( uri => $uri )->request(
    3537        ua_args  => { timeout => $timeout },
     38        no_proxy => $no_proxy,
    3639    );
    3740
     
    9194Optional.
    9295
     96=item * --no-proxy
     97
     98Do not load proxy environment variables.
     99
     100Optional.
     101
    93102=back
    94103
  • branches/eam_branches/20091113/DataStore/scripts/dsget

    r25692 r26236  
    2828    $timeout,
    2929    @xattrs,
     30    $no_proxy,
    3031);
    3132
     
    4445    'timeout|t=s'   => \$timeout,
    4546    'xattr|x=s'     => \@xattrs,
     47    'no-proxy'      => \$no_proxy,
    4648) or pod2usage( 2 );
    4749
     
    8082# default http request timeout is 30s
    8183$timeout ||= 30;
     84$no_proxy = 0 if !defined $no_proxy;
    8285
    8386my %p = (
     
    140143        filename => $tmpfilename,
    141144        ua_args  => { timeout => $timeout },
     145        no_proxy => $no_proxy,
    142146    );
    143147
     
    302306Optional.
    303307
     308=item * --no-proxy
     309
     310Do not load proxy environment variables.
     311
     312Optional.
     313
    304314=item * --copies <n>
    305315
  • branches/eam_branches/20091113/DataStore/scripts/dsgetfileset

    r25574 r26236  
    1717use File::Basename qw( basename );
    1818
    19 my ($uri, $outdir, $timeout, $verbose);
     19my ($uri, $outdir, $timeout, $no_proxy, $verbose);
    2020
    2121GetOptions(
     
    2323    'outdir|o=s'        => \$outdir,
    2424    'timeout|t=s'       => \$timeout,
     25    'no-proxy'          => \$no_proxy,
    2526    'verbose|v'         => \$verbose,
    2627) or pod2usage( 2 );
     
    3435# default http request timeout is 30s
    3536$timeout ||= 30;
     37$no_proxy = 0 if !defined $no_proxy;
    3638
    3739my $response = DataStore::FileSet->new( uri => $uri )->request(
    3840        ua_args  => { timeout => $timeout },
     41        no_proxy => $no_proxy,
    3942    );
    4043
     
    117120Optional.
    118121
     122=item * --no-proxy
     123
     124Do not load proxy environment variables.
     125
     126Optional.
     127
    119128=back
    120129
  • branches/eam_branches/20091113/DataStore/scripts/dsleech

    r17739 r26236  
    1818use Pod::Usage qw( pod2usage );
    1919
    20 my ($dir, $uri, $last_fileset, $overwrite, $recall, $remember, $verbose, $timeout);
     20my ($dir, $uri, $last_fileset, $overwrite, $recall, $remember, $verbose, $timeout, $no_proxy);
    2121
    2222GetOptions(
     
    2828    'remember'          => \$remember,
    2929    'verbose|v'         => \$verbose,
    30     'timeout|t'         => \$timeout,
     30    'timeout|t=i'       => \$timeout,
     31    'no-proxy'          => \$no_proxy,
    3132) or pod2usage( 2 );
    3233
     
    3940# default http request timeout is 30s
    4041$timeout ||= 30;
     42$no_proxy = 0 if !defined $no_proxy;
    4143
    4244my %p = (
     
    6567my $response = DataStore::Product->new(%p)->request(
    6668    ua_args  => { timeout => $timeout },
     69    no_proxy => $no_proxy,
    6770);
    6871
     
    281284Optional.
    282285
     286=item * --no-proxy
     287
     288Do not load proxy environment variables.
     289
     290Optional.
     291
    283292=back
    284293
  • branches/eam_branches/20091113/DataStore/scripts/dsproductls

    r25631 r26236  
    1616use Pod::Usage qw( pod2usage );
    1717
    18 my ($uri, $last_fileset, $timeout, $extra);
     18my ($uri, $last_fileset, $timeout, $extra, $no_proxy);
    1919
    2020GetOptions(
     
    2222    'last_fileset|l=s'  => \$last_fileset,
    2323    'timeout|t=s'       => \$timeout,
    24     'extra|e'         => \$extra,
     24    'extra|e'           => \$extra,
     25    'no-proxy'          => \$no_proxy,
    2526) or pod2usage( 2 );
    2627
     
    3334# default http request timeout is 30s
    3435$timeout ||= 30;
     36$no_proxy = 0 if !defined $no_proxy;
    3537
    3638my %p = (
     
    4244my $response = DataStore::Product->new(%p)->request(
    4345        ua_args  => { timeout => $timeout },
     46        no_proxy => $no_proxy,
    4447    );
    4548
     
    111114Optional.
    112115
     116=item * --no-proxy
     117
     118Do not load proxy environment variables.
     119
     120Optional.
     121
    113122=back
    114123
  • branches/eam_branches/20091113/DataStore/scripts/dsrootls

    r17739 r26236  
    1616use Pod::Usage qw( pod2usage );
    1717
    18 my ($uri, $timeout);
     18my ($uri, $timeout, $no_proxy);
    1919
    2020GetOptions(
    2121    'uri|u=s'       => \$uri,
    22     'timeout|t'     => \$timeout,
     22    'timeout|t=i'   => \$timeout,
     23    'no-proxy'      => \$no_proxy,
    2324) or pod2usage( 2 );
    2425
     
    3132# default http request timeout is 30s
    3233$timeout ||= 30;
     34$no_proxy = 0 if !defined $no_proxy;
    3335
    3436my %p = (
     
    3840my $response = DataStore::Root->new(%p)->request(
    3941        ua_args  => { timeout => $timeout },
     42        no_proxy => $no_proxy,
    4043    );
    4144
     
    9396Optional.
    9497
     98=item * --no-proxy
     99
     100Do not load proxy environment variables.
     101
     102Optional.
     103
    95104=back
    96105
  • branches/eam_branches/20091113/DataStoreServer/scripts/dsprodtool

    r25668 r26236  
    6767
    6868# will exit if neither or both -add and -del were specified
    69 $err .= "Must specify either --add or --del.\n"
     69show_usage( "Must specify either --add or --del.")
    7070    unless $add xor $del;
    7171
     
    7979    }
    8080
    81 } else {
     81} elsif ($del) {
    8282    $product = $del;
    8383    if (! -t STDIN) {
  • branches/eam_branches/20091113/Ohana/src/getstar/src/MatchCoords.c

    r25208 r26236  
    5555        }
    5656
     57#ifdef notdef
     58        printf("%d %8.1f %8.1f %s\n", i, x, y, dbImages[i].name);
     59#endif
     60
    5761        if ((x >= xmin && x <= xmax) && (y >= ymin && y <= ymax)) {
    5862            totalMatches++;
  • branches/eam_branches/20091113/PS-IPP-Config/lib/PS/IPP/Config.pm

    r26085 r26236  
    1616use File::Spec 0.87;
    1717use File::Temp qw( tempfile );
    18 use IO::Handle;
    1918
    2019use PS::IPP::Metadata::Config 1.00;
     
    696695        print STDERR "   redirect stdout to $filename succeded on try $try\n";
    697696    }
    698     # turn off buffering of output so that output from this script doesn't appear later
    699     # that output from execed programs
    700     STDOUT->autoflush(1);
    701697    open STDERR, ">>$filename" or ( carp "failed to redirect stderr to $filename" and return undef );
    702     STDERR->autoflush(1);
    703698
    704699    return 1;
  • branches/eam_branches/20091113/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm

    r25793 r26236  
    8484
    8585        my $image = $results->[0];
    86         if (($img_type eq "raw") or ($img_type eq "chip")) {
    87             $req_type = "byexp";
    88             $id = $image->{exp_name};
     86        if ($img_type eq "raw") {
     87            $req_type = "byid";
     88            $id = $image->{exp_id};
    8989            return undef if !$id;
    90             # fall through and lookup byexp
     90            # fall through and lookup byid
     91        } elsif ($img_type eq "chip") {
     92            $req_type = "byid";
     93            $id = $image->{chip_id};
     94            return undef if !$id;
     95            # fall through and lookup byid
    9196        } elsif ($img_type eq "warp") {
    9297            $req_type = "byid";
     
    171176    }
    172177
     178    # note $magic_arg may be cleared below depending on $req_type
    173179    my $magic_arg = $need_magic ? " -destreaked" : "";
     180
    174181    my $component_args;
    175182    if ($img_type eq "raw") {
     
    229236        $command .= " $id_opt $id";
    230237        $command .= $component_args if $component_args;
     238        # don't include -destreaked if lookup is byid. Let pstampparse check so that the
     239        # error code returned to the client for a given component is 'not destreaked'
     240        # instead of 'not found'
     241        $magic_arg = "";
    231242    } elsif ($req_type eq "byexp") {
    232243        $command .= " -exp_name $id";
    233244        $command .= $component_args if $component_args;
     245        # don't include -destreaked if lookup is byexp. Let pstampparse check so that the error code gives
     246        # the reason as 'not destreaked'
     247        $magic_arg = "";
    234248    } elsif ($req_type eq "byskycell") {
    235249        die "tess_id and component are required for byskycell" if !$tess_id or ! $skycell_id;
     
    237251    } elsif ($req_type eq "bycoord") {
    238252        $command .= " -radius 3.0 -ra $x -decl $y";
     253        if ($img_type ne "raw") {
     254            $command .= " -tess_id $tess_id" if $tess_id;
     255            $command .= " -skycell_id $skycell_id" if $skycell_id;
     256        }
    239257    } else {
    240258        die "Unknown req_type supplied: $req_type";
     
    299317        # (we do this here for raw stage)
    300318        $out->{image}  = $image->{uri};
     319
    301320        if ($set_class_id) {
    302321            $class_id = $image->{class_id};
    303322            $out->{component} = $class_id;
     323        } else {
     324            $out->{component} = $image->{skycell_id};
    304325        }
    305326        my $stage_id;
     
    307328            $stage_id = $image->{exp_id};
    308329        } elsif ($img_type eq "chip") {
    309             $stage_id = $image->{chip};
     330            $stage_id = $image->{chip_id};
    310331        } elsif ($img_type eq "warp") {
    311332            $stage_id = $image->{warp_id};
     
    315336            $stage_id = $image->{stack_id};
    316337        }
    317         $image->{stage_id} = $stage_id;
    318         $image->{stage}    = $img_type;
    319         $image->{image_db} = $image_db;
     338        $out->{stage_id} = $stage_id;
     339        $out->{stage}    = $img_type;
     340        $out->{image_db} = $image_db;
    320341
    321342        # find the mask and weight images
     
    402423        }
    403424
    404         my ($warp_id, $exp_id, $exp_name);
     425        my ($warp_id, $exp_id, $exp_name, $chip_id, $cam_id);
    405426        if ($inverse and !$image->{bothways}) {
    406427            print STDERR "Inverse images requested for diffRun that is not bothways. Ignoring.\n";
     
    411432            $exp_id = $image->{exp_id_2};
    412433            $exp_name = $image->{exp_name_2};
     434            $chip_id = $image->{chip_id_2};
     435            $cam_id = $image->{cam_id_2};
    413436        } else {
    414437            $warp_id =  $image->{warp1};
    415438            $exp_id = $image->{exp_id_1};
    416439            $exp_name = $image->{exp_name_1};
     440            $chip_id = $image->{chip_id_1};
     441            $cam_id = $image->{cam_id_1};
    417442        }
    418443        # XXX difftool currently returns max long long for null
     
    422447            $image->{exp_id} = $exp_id;
    423448            $image->{exp_name} = $exp_name;
     449            $image->{chip_id} = $chip_id;
     450            $image->{cam_id} = $cam_id;
    424451        } else {
    425452            print STDERR "unexpected result warp_id not defined\n";
     
    561588    }
    562589
    563     # If there are multiple cam runs for this exposure, take the last one
    564     # assuming that it has the best astrometry
    565     my $camdata = pop @$camruns;
     590    # If there are multiple cam runs for this exposure, take the last completed one
     591    # on the assumption that it has the best astrometry.
     592    my $camdata;
     593    while ($camdata = pop @$camruns) {
     594        last if (($camdata->{quality} eq 0) and ($camdata->{fault} eq 0));
     595    }
    566596    if (!$camdata) {
    567597        # no cam runs for this exposure id therefore best astrometry is whatever is in the header
  • branches/eam_branches/20091113/archive/ducttape

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/catalyst

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/catalyst/2007.0-specs

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/catalyst/2008.0-specs

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/catalyst/2008.0-specs/hardened

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/dbconfig/changes.txt

    r26015 r26236  
    1616-- Version 1.1.22 --> 1.1.23
    1717-- Adding support for reduction classes (which are used to specify recipes for parts of the pipeline).
    18 # Adding 'reduction' to detRun
    19 # Renaming 'recipe' in {chip,cam}{Pending,Processed}Exp to 'reduction'
     18-- Adding 'reduction' to detRun
     19-- Renaming 'recipe' in {chip,cam}{Pending,Processed}Exp to 'reduction'
    2020
    2121alter table detRun add column reduction varchar(64) NULL DEFAULT NULL after exp_type;
     
    8282alter table stackSumSkyfile add column hostname varchar(64) after dtime_stack;
    8383
    84 #alter table warpSkyfile add column ( dtime_warp float, hostname varchar(64) );
     84-- alter table warpSkyfile add column ( dtime_warp float, hostname varchar(64) );
    8585alter table warpSkyfile add column dtime_warp float after bg_stdev;
    8686alter table warpSkyfile add column hostname varchar(64) after dtime_warp;
     
    14241424ALTER TABLE publishClient ADD COLUMN active TINYINT DEFAULT 0 AFTER client_id;
    14251425
    1426 # add outdir to allow spreading files over multiple hosts
     1426-- add outdir to allow spreading files over multiple hosts
    14271427ALTER TABLE distRun ADD COLUMN outdir VARCHAR(255) AFTER outroot;
    14281428ALTER TABLE distComponent ADD COLUMN outdir VARCHAR(255) AFTER state;
    14291429
    1430 # populate the existing runs (except for bills' test runs)
     1430-- populate the existing runs (except for bills' test runs)
    14311431UPDATE distRun SET outdir = CONCAT_WS('.', outroot, dist_id) WHERE outroot not like '%@HOST@%';
    14321432UPDATE distRun join distComponent using(dist_id) SET distComponent.outdir = CONCAT_WS('.', distRun.outroot, dist_id);
  • branches/eam_branches/20091113/dbconfig/config.md

    r25835 r26236  
    22    pkg_name        STR     ippdb
    33    pkg_namespace   STR     ippdb
    4     pkg_version     STR     1.1.56
     4    pkg_version     STR     1.1.57
    55END
  • branches/eam_branches/20091113/doc/latex/panstarrs.cls

    r26114 r26236  
    1111\NeedsTeXFormat{LaTeX2e}
    1212\ProvidesClass{panstarrs}[2003/06/29 LaTeX class for PanSTARRS]
    13 \LoadClass[12pt]{article}
    14 \RequirePackage{tocloft,ifthen,fancyhdr,vmargin}
    15 \RequirePackage{hyperref,times,amsmath,amssymb}
     13\LoadClass[11pt,letterpaper]{article}
     14\RequirePackage{tocloft,ifthen,fancyhdr,vmargin,longtable}
     15\RequirePackage{html}
     16\RequirePackage[colorlinks,ps2pdf,bookmarks=true,bookmarksnumbered=true,plainpages=false]{hyperref} %avoid ``destination with the same identifier'' errors
     17\RequirePackage{times,amsmath,amssymb,multirow}
    1618\RequirePackage{color,fullpage,boxedminipage,acronym,epsfig}
     19\RequirePackage{psmisc}
     20\RequirePackage{fancyvrb}
    1721
    1822% -- panstarrs definitions--
    1923\DeclareOption{panstarrs}{\input{panstarrs.def}}
     24\DeclareOption{spec}{\input{spec.def}}
    2025
    2126% -- page layout options --
     
    2934\textheight=9.0in
    3035\textwidth=7.35in
    31 \headheight=12pt
     36\headheight=15pt
    3237\headsep = 24pt
    3338\footskip=30pt
     
    3843\addtolength{\cftfignumwidth}{2em}
    3944
    40 % -- section numbering --
    41 \let\@section=\section \let\@subsection=\subsection
    42 \let\@subsubsection=\subsubsection
    43 \def\section{\renewcommand{\thefigure}{\thesection -\arabic{figure}} \setcounter{figure}{0} \@section}
    44 \def\subsection{\renewcommand{\thefigure}{\thesubsection -\arabic{figure}} \setcounter{figure}{0} \@subsection}
    45 \def\subsubsection{\renewcommand{\thefigure}{\thesubsubsection -\arabic{figure}} \setcounter{figure}{0} \@subsubsection}
    46 \def\paragraph{\@startsection{paragraph}{4}{\z@}%
    47   {-3.5ex\@plus -1ex \@minus -.2ex}%
    48   {1.5ex \@plus .2ex}%
    49   {\normalsize\bf}}
    50 \def\subparagraph{\@startsection{subparagraph}{5}{\z@}%
    51   {-3.5ex\@plus -1ex \@minus -.2ex}%
    52   {1.5ex \@plus .2ex}%
    53   {\normalsize\bf}}
    54 \def\subsubparagraph{\@startsection{subsubparagraph}{6}{\z@}%
    55   {-3.5ex\@plus -1ex \@minus -.2ex}%
    56   {1.5ex \@plus .2ex}%
    57   {\normalsize\it}}
    58 \let\subsubsubsection=\paragraph
     45%  % -- SRS section numbering / plain enumerate types --
     46%  \let\@section=\section
     47%  \let\@subsection=\subsection
     48%  \let\@subsubsection=\subsubsection
     49
     50%  \def\section{
     51%  %  uncomment these to label figures by section number
     52%  %  \renewcommand{\thefigure}{\thesection -\arabic{figure}}
     53%  %  \setcounter{figure}{0}
     54%    \@section
     55%  }
     56
     57%  \def\subsection{
     58%  %  uncomment these to label figures by section number
     59%  %  \renewcommand{\thefigure}{\thesubsection -\arabic{figure}}
     60%  %  \setcounter{figure}{0}
     61%    \@subsection
     62%  }
     63
     64%  \def\subsubsection{
     65%  %  uncomment these to label figures by section number
     66%  %  \renewcommand{\thefigure}{\thesubsubsection -\arabic{figure}}
     67%  %  \setcounter{figure}{0}
     68%    \@subsubsection
     69%  }
     70
     71%  \def\paragraph{
     72%    \@startsection{paragraph}{4}{\z@}%
     73%      {-3.5ex\@plus -1ex \@minus -.2ex}%
     74%      {1.5ex \@plus .2ex}%
     75%      {\normalsize\bf}
     76%  }
     77
     78%  \def\subparagraph{
     79%    \@startsection{subparagraph}{5}{\z@}%
     80%      {-3.5ex\@plus -1ex \@minus -.2ex}%
     81%      {1.5ex \@plus .2ex}%
     82%      {\normalsize\bf}
     83%  }
     84
     85%  \def\subsubparagraph{
     86%    \@startsection{subsubparagraph}{6}{\z@}%
     87%      {-3.5ex\@plus -1ex \@minus -.2ex}%
     88%      {1.5ex \@plus .2ex}%
     89%      {\normalsize\it}
     90%  }
     91
     92%  \let\subsubsubsection=\paragraph
     93%  \let\subsubsubsubsection=\subparagraph
     94
    5995
    6096% -- section display --
    61 \setcounter{secnumdepth}{4} % lowest level at which counters are displayed
     97\setcounter{secnumdepth}{5} % lowest level at which counters are displayed
    6298\setcounter{tocdepth}{3} % lowest level to be included in toc
    6399
     
    71107\newcommand\thesubtitle{}
    72108\newcommand\thedistribution{Approved for Public Release -- Distribution is Unlimited}
     109\newcommand\theaudience{panstarrs team}
    73110
    74111\newcommand{\docnumber}[1]{\renewcommand\thedocnumber{#1} }
     
    80117\newcommand{\subtitle}[1]{ \renewcommand\thesubtitle{#1} }
    81118\newcommand{\distribution}[1]{ \renewcommand\thedistribution{#1} }
     119\newcommand{\audience}[1]{ \renewcommand\theaudience{#1} }
     120
     121%%%%%%%%%%%%%%%%%%%% start of time code %%%%%%%%%%%%%%%%%%%%
     122%
     123% Code for printing the time by Michael Doob <mdoob@cc.umanitoba.ca>
     124%
     125\newcount\hour \newcount\minute
     126\hour=\time  \divide \hour by 60
     127\minute=\time
     128\loop \ifnum \minute > 59 \advance \minute by -60 \repeat
     129\def\nowtwelve{\ifnum \hour<13 \number\hour:%           % supresses leading 0's
     130                      \ifnum \minute<10 0\fi%           % so add it it
     131                      \number\minute
     132                      \ifnum \hour<12 \ A.M.\else \ P.M.\fi
     133         \else \advance \hour by -12 \number\hour:%     % supresses leading 0's
     134                      \ifnum \minute<10 0\fi%           % add it in
     135                      \number\minute \ P.M.\fi}
     136\def\nowtwentyfour{\ifnum \hour<10 0\fi%                % need a leading 0
     137                \number\hour:%                          % supresses leading 0's
     138                \ifnum \minute<10 0\fi%                 % add it in
     139                \number\minute}
     140\def\now{\nowtwelve}
     141%%%%%%%%%%%%%%%%%%%% end of time code %%%%%%%%%%%%%%%%%%%%
     142
    82143
    83144% -- MAKETITLE --
     
    101162
    102163\def\@maketitle{
    103   \pagenumbering{roman}
    104   \thispagestyle{empty}
    105   \unitlength 1.0in
    106   \begin{picture}(0.0,0.0)(0.0,9.375)
    107   \small
    108 
    109   \put (7.50, 9.85){\makebox(0,0)[br]{\small      {\bf Pan-STARRS Document Control}}}
    110   \put (7.50, 9.70){\makebox(0,0)[br]{\small      {\bf \thedocnumber-\theversion}}}
    111 
    112   \put (4.006, 8.30){\line(1,0){0.1}} % put the macron on Manoa
    113   \put (0.50, 8.10){\makebox(0,0)[bl]{\fontA UNIVERSITY OF HAWAII AT MANOA}}
    114   \put (0.50, 7.88){\makebox(0,0)[bl]{\fontB Institute for Astrononmy}}
    115 
    116   \put (0.50, 7.83){\line(1,0){6.5}}
    117   \put (0.50, 7.63){\makebox(0,0)[bl]{\small      {\bf Pan-STARRS Project Management System}}}
    118 
    119   \put (3.75, 5.25){\makebox(0,0)[bc]{\large {\bf \@title}}}
    120   \put (3.75, 5.00){\makebox(0,0)[bc]{\large {\bf \thesubtitle}}}
    121 
    122   \put (2.15, 4.75){\makebox(0,0)[l]{{\bf Grant Award No. }}}
    123   \put (2.15, 4.57){\makebox(0,0)[l]{{\bf Prepared For    }}}
    124   \put (2.15, 4.39){\makebox(0,0)[l]{{\bf Prepared By     }}}
    125   \put (2.15, 4.21){\makebox(0,0)[l]{{\bf Document No.    }}}
    126   \put (2.15, 4.03){\makebox(0,0)[l]{{\bf Document Date   }}}
    127   \put (2.15, 3.85){\makebox(0,0)[l]{{\bf Revision        }}}
    128 
    129   \put (3.75, 4.75){\makebox(0,0)[l]{{\bf : F29601-02-1-0268}}}
    130   \put (3.75, 4.57){\makebox(0,0)[l]{{\bf : Pan-STARRS Team}}}
    131   \put (3.75, 4.39){\makebox(0,0)[l]{{\bf : \@author}}}
    132   \put (3.75, 4.21){\makebox(0,0)[l]{{\bf : \thedocnumber-\theversion}}}
    133   \put (3.75, 4.03){\makebox(0,0)[l]{{\bf : \today}}}
    134   \put (3.75, 3.85){\makebox(0,0)[l]{{\bf : \theversion}}}
    135 
    136   \put (3.75, 2.50){\makebox(0,0)[c]{{\bf DISTRIBUTION STATEMENT}}}
    137   \put (3.75, 2.30){\makebox(0,0)[c]{{\bf \thedistribution}}}
    138 
    139   \put (3.75, 1.30){\makebox(0,0)[bc]{\scriptsize {\bf \copyright Institute for Astronomy, University of Hawaii}}}
    140   \put (3.75, 1.15){\makebox(0,0)[bc]{\scriptsize {\bf 2680 Woodlawn Drive, Honolulu, Hawaii 96822}}}
    141   \put (3.75, 1.00){\makebox(0,0)[bc]{\scriptsize {\bf An Equal Opportunity/Affirmative Action Institution}}}
    142   \end{picture}
    143 
    144   \pagebreak
    145   \unitlength 1.0in
    146   \begin{picture}(0.0,0.0)(0.5,9.375)
    147   \small
    148 
    149   \put (1.00, 8.50){\makebox(0,0)[l]{Submitted By:}}
    150   \put (1.00, 8.00){\line(1,0){5.5}}
    151   \put (6.70, 8.00){\line(1,0){0.8}}
    152   \put (1.00, 7.90){\makebox(0,0)[l]{[Insert Signature Block of Authorized Developer Representative]}}
    153   \put (6.70, 7.90){\makebox(0,0)[l]{Date}}
    154 
    155   \put (1.00, 7.00){\makebox(0,0)[l]{Approved By:}}
    156   \put (1.00, 6.50){\line(1,0){5.5}}
    157   \put (6.70, 6.50){\line(1,0){0.8}}
    158   \put (1.00, 6.40){\makebox(0,0)[l]{[Insert Signature Block of Customer Developer Representative]}}
    159   \put (6.70, 6.40){\makebox(0,0)[l]{Date}}
    160 
    161   \end{picture}
    162   \pagebreak
     164      \pagenumbering{roman}
     165      \thispagestyle{empty}
     166      \unitlength 1.0in
     167      \begin{picture}(0.0,0.0)(0.0,9.375)
     168      \small
     169   
     170      \put (7.50, 9.85){\makebox(0,0)[br]{\small      {\bf Pan-STARRS Document Control}}}
     171      \put (7.50, 9.70){\makebox(0,0)[br]{\small      {\bf \thedocnumber-\theversion}}}
     172   
     173      \put (4.006, 8.30){\line(1,0){0.1}} % put the macron on Manoa
     174      \put (0.50, 8.10){\makebox(0,0)[bl]{\fontA UNIVERSITY OF HAWAII AT MANOA}}
     175      \put (0.50, 7.88){\makebox(0,0)[bl]{\fontB Institute for Astrononmy}}
     176   
     177      \put (0.50, 7.83){\line(1,0){6.5}}
     178      \put (0.50, 7.63){\makebox(0,0)[bl]{\small      {\bf Pan-STARRS Project Management System}}}
     179   
     180      \put (3.75, 5.25){\makebox(0,0)[bc]{\large {\bf \@title}}}
     181      \put (3.75, 5.00){\makebox(0,0)[bc]{\large {\bf \thesubtitle}}}
     182   
     183      \put (2.15, 4.75){\makebox(0,0)[l]{{\bf Coop. Agreement No. }}}
     184      \put (2.15, 4.57){\makebox(0,0)[l]{{\bf Prepared For    }}}
     185      \put (2.15, 4.39){\makebox(0,0)[l]{{\bf Prepared By     }}}
     186      \put (2.15, 4.21){\makebox(0,0)[l]{{\bf Document No.    }}}
     187      \put (2.15, 4.03){\makebox(0,0)[l]{{\bf Document Date   }}}
     188      \put (2.15, 3.85){\makebox(0,0)[l]{{\bf Revision        }}}
     189   
     190      \put (3.75, 4.75){\makebox(0,0)[l]{{\bf : FA9451-06-2-0338}}}
     191      \put (3.75, 4.57){\makebox(0,0)[l]{{\bf : \theaudience}}}
     192      \put (3.75, 4.39){\makebox(0,0)[l]{{\bf : \@author}}}
     193      \put (3.75, 4.21){\makebox(0,0)[l]{{\bf : \thedocnumber-\theversion}}}
     194      \put (3.75, 4.03){\makebox(0,0)[l]{{\bf : \today}}}
     195      \put (3.75, 3.85){\makebox(0,0)[l]{{\bf : \theversion}}}
     196   
     197      \put (3.75, 2.50){\makebox(0,0)[c]{{\bf DISTRIBUTION STATEMENT}}}
     198      \put (3.75, 2.30){\makebox(0,0)[c]{{\bf \thedistribution}}}
     199   
     200      \put (3.75, 1.30){\makebox(0,0)[bc]{\footnotesize {\copyright Institute for Astronomy, University of Hawaii}}}
     201      \put (3.75, 1.15){\makebox(0,0)[bc]{\footnotesize {2680 Woodlawn Drive, Honolulu, Hawaii 96822}}}
     202      \put (3.75, 1.00){\makebox(0,0)[bc]{\footnotesize {An Equal Opportunity/Affirmative Action Institution}}}
     203      \end{picture}
     204   
     205      \pagebreak
     206      \unitlength 1.0in
     207      \begin{picture}(0.0,0.0)(0.5,9.375)
     208      \small
     209   
     210      \put (1.00, 8.50){\makebox(0,0)[l]{Submitted By:}}
     211      \put (1.00, 8.00){\line(1,0){5.5}}
     212      \put (6.70, 8.00){\line(1,0){0.8}}
     213      \put (1.00, 7.90){\makebox(0,0)[l]{[Insert Signature Block of Authorized Developer Representative]}}
     214      \put (6.70, 7.90){\makebox(0,0)[l]{Date}}
     215   
     216      \put (1.00, 7.00){\makebox(0,0)[l]{Approved By:}}
     217      \put (1.00, 6.50){\line(1,0){5.5}}
     218      \put (6.70, 6.50){\line(1,0){0.8}}
     219      \put (1.00, 6.40){\makebox(0,0)[l]{[Insert Signature Block of Customer Developer Representative]}}
     220      \put (6.70, 6.40){\makebox(0,0)[l]{Date}}
     221   
     222      \end{picture}
     223      \pagebreak
    163224}               
    164225
     
    174235% Make verbatim use a \footnotesize font (to allow 110-character lines)
    175236\let\oldverbatim@font=\verbatim@font
    176 \def\verbatim@font{\oldverbatim@font\footnotesize}
     237\def\verbatim@font{\oldverbatim@font\scriptsize}
    177238
    178239\def\RevisionsStart{
  • branches/eam_branches/20091113/doc/latex/panstarrs.def

    r26114 r26236  
    66% LaTeX variables (cntl sequences) for entities significant to Pan-STARRS.
    77   \newcommand{\PS}{Pan-STARRS}
    8    \newcommand{\pipelinename}{Image Processing Pipeline}
    9    \newcommand{\thisdocument}{\PS/ \pipelinename\ Software Design Description}
    108   \newcommand\Object{\ensuremath{f}}                % an object
    119   \newcommand\ObjectSet{\ensuremath{\mathbf{f}}}    % a set of objects
     
    2725   \newcommand\AngularPitch{\ensuremath{p_{\text{\scriptsize pixel}}}}   % angular pitch of a pixel (e.g. 0.3 arcsec)
    2826
     27   \def\degree{\hbox{$^\circ$}}
     28   \def\arcmin{\hbox{$^\prime$}}
     29   \def\arcsec{\hbox{$^{\prime\prime}$}}
     30
    2931%
    3032% Typsetting documentation
     
    3739% \begin{verbatim}...\end{verbatim} for longer blocks
    3840%
     41
    3942\def\uncatcodespecials{\def\do##1{\catcode`##1=12}\dospecials}%
    4043{\catcode`\`=\active\gdef`{\relax\lq}}% this line inhibits Spanish
     
    4447     \spaceskip=0pt \xspaceskip=0pt % just in case...
    4548     \catcode`\`=\active
    46      \obeylines \uncatcodespecials \obeyspaces
     49     \uncatcodespecials \obeyspaces
    4750     \catcode`\{=1\catcode`\}=2
    4851    }%
     
    5154     \spaceskip=0pt \xspaceskip=0pt % just in case...
    5255     \catcode`\`=\active
    53      \obeylines \uncatcodespecials \obeyspaces
     56     \uncatcodespecials \obeyspaces
    5457    }%
    5558
     
    6063\def\CODE{\begingroup\SETUPC@DE\D@CODE}%
    6164
    62 \newcommand\note[1]{{\bf #1}}
    63 \newcommand\tbd[1]{\textbf{[{\color{red}#1}]}}
     65\newcommand\note[1]{\textbf{\color{red}#1}}
     66%\newcommand\tbd[1]{\textbf{\color{red}#1 (TBD)}}
     67%\newcommand\tbr[1]{\textbf{\color{blue}#1 (TBR)}}
    6468\newcommand\TBD[1]{\par\tbd{#1}\par}
     69\renewcommand\comment[1]{\footnote{{\color{red}#1}}}
    6570
    6671\newcommand{\file}[1]{\textit{#1}}%
     72
     73%
     74% embedded software function prototypes and datatypes
     75%
     76
     77\DefineVerbatimEnvironment%
     78  {prototype}{Verbatim}{fontsize=\footnotesize}
     79
     80\DefineVerbatimEnvironment%
     81  {datatype}{Verbatim}{fontsize=\footnotesize}
    6782
    6883%------------------------------------------------------------------------------
  • branches/eam_branches/20091113/doc/latex/psreport.def

    r26114 r26236  
    3636  \put (3.75, 5.00){\makebox(0,0)[bc]{\Large {\bf \@title}}}
    3737
    38   \put (3.75, 4.70){\makebox(0,0)[bc]{\small      {\bf \@author}}}
    39   \put (3.75, 4.53){\makebox(0,0)[bc]{\small      {\bf \thegroup}}}
    40   \put (3.75, 4.36){\makebox(0,0)[bc]{\small      {\bf \theorganization}}}
    41   \put (3.75, 4.19){\makebox(0,0)[bc]{\small      {\bf \today}}}
     38%  \put (3.75, 4.70){\makebox(0,0)[bc]{\small      {\bf \@author}}}
     39%  \put (3.75, 4.53){\makebox(0,0)[bc]{\small      {\bf \thegroup}}}
     40%  \put (3.75, 4.36){\makebox(0,0)[bc]{\small      {\bf \theorganization}}}
     41%  \put (3.75, 4.19){\makebox(0,0)[bc]{\small      {\bf \today}}}
     42  \put (3.75, 4.70){\makebox(0,0)[bc]{\normalsize      {\bf \@author}}}
     43  \put (3.75, 4.53){\makebox(0,0)[bc]{\normalsize      {\bf \thegroup}}}
     44  \put (3.75, 4.36){\makebox(0,0)[bc]{\normalsize      {\bf \theorganization}}}
     45  \put (3.75, 4.19){\makebox(0,0)[bc]{\normalsize      {\bf \today}}}
     46
    4247
    4348  \put (3.75, 1.26){\makebox(0,0)[bc]{\scriptsize {\bf \copyright Institute for Astronomy}}}
  • branches/eam_branches/20091113/hardware

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/ippMonitor/def/chipProcessedImfile.d

    r24867 r26236  
    3939FIELD rawExp.exp_time,                    5, %.2f,   exp_time   
    4040FIELD rawExp.airmass,                     5, %.4f,   airmass     
     41FIELD chipProcessedImfile.quality,        5, %d,     quality     
    4142FIELD chipProcessedImfile.bg,             5, %.2f,   backgnd
    4243FIELD chipProcessedImfile.bg_stdev,       5, %.2f,   stdev   
  • branches/eam_branches/20091113/ippScripts/scripts/dist_bundle.pl

    r26044 r26236  
    6060# Parse the command-line arguments
    6161my ($camera, $stage, $stage_id, $component, $path_base, $chip_path_base, $clean);
    62 my ($outdir, $run_state, $data_state, $magicked, $no_magic, $poor_quality, $results_file);
     62my ($outdir, $run_state, $data_state, $magicked, $no_magic, $poor_quality, $results_file, $prefix);
    6363my ($dbname, $save_temps, $verbose, $no_update, $logfile);
    6464
    6565GetOptions(
    66            'results_file=s' => \$results_file,     # camera for evaluating file rules
     66           'results_file=s' => \$results_file,     # ouptput file name for results
    6767           'camera=s'       => \$camera,     # camera for evaluating file rules
    6868           'stage=s'        => \$stage,      # raw, chip, warp, or diff
     
    7777           'magicked'       => \$magicked,   # magicked state for this component
    7878           'outdir=s'       => \$outdir,     # "directory" for outputs
     79           'prefix=s'       => \$prefix,     # "prefix" to apply to filenames
    7980           'clean'          => \$clean,      # create clean distribution
    8081           'save-temps'     => \$save_temps, # Save temporary files?
     
    276277    my $tbase = basename($path_base);
    277278    $tbase .= ".$component" if $component;
    278     $file_name = "$tbase.tgz";
     279    $file_name = ($prefix ? $prefix : "") . "$tbase.tgz";
    279280    my $tarfile = "$outdir/$file_name";
    280281
  • branches/eam_branches/20091113/ippScripts/scripts/dist_make_fileset.pl

    r26015 r26236  
    4040# Parse the command-line arguments
    4141my ($dist_id, $dist_dir, $target_id, $stage, $stage_id, $dest_id, $product_name, $ds_dbhost, $ds_dbname);
    42 my ($label, $dist_group, $filter);
     42my ($label, $data_group, $filter);
    4343my ($dbname, $save_temps, $verbose, $no_update, $logfile);
    4444
     
    5252           'product_name=s' => \$product_name,  # location of the data store directory for this product
    5353           'label=s'        => \$label,
    54            'dist_group=s'   => \$dist_group,
     54           'data_group=s'   => \$data_group,
    5555           'filter=s'       => \$filter,
    5656           'ds_dbhost=s'    => \$ds_dbhost,  # database host for the datastore database
     
    6464
    6565pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    66 pod2usage( -msg => "Required options: --dist_id --dist_dir --target_id --stage --stage_id --dist_group --filter --dest_id --ds_dbhost --ds_dbname",
     66pod2usage( -msg => "Required options: --dist_id --dist_dir --target_id --stage --stage_id --data_group --filter --dest_id --ds_dbhost --ds_dbname",
    6767           -exitval => 3) unless
    6868    defined $dist_id and
     
    7171    defined $stage and
    7272    defined $stage_id and
    73     defined $dist_group and
     73    defined $data_group and
    7474    defined $filter and
    7575    defined $dest_id and
     
    164164
    165165    $command .= " --ps0 $target_id --ps1 $stage --ps2 $stage_id --ps3 $prod_col_3";
    166     $command .= " --ps4 $dist_group --ps5 $filter";
     166    $command .= " --ps4 $data_group --ps5 $filter";
    167167
    168168    $command .= " --dbname $ds_dbname --dbhost $ds_dbhost";
  • branches/eam_branches/20091113/ippScripts/scripts/magic_destreak_revert.pl

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/ippScripts/scripts/magic_tree.pl

    r24174 r26236  
    158158
    159159    # Relative coordinates of centre of the field
    160     my $x = $naxis1 - $crpix1;
    161     my $y = $naxis2 - $crpix2;
     160    my $x = $naxis1/2 - $crpix1;
     161    my $y = $naxis2/2 - $crpix2;
    162162
    163163    # Coordinates on tangent plane
     
    168168
    169169    # Coordinates on rotated celestial sphere
    170     my $phi = atan2($eta,$xi) + pi/2;
    171     my $theta = atan(180 / pi / sqrt($xi**2 + $eta**2));
     170    my ($phi, $theta);
     171    if ($xi == 0 and $eta == 0) {
     172        $phi = 0;
     173        $eta = 0;
     174    } else {
     175        $phi = atan2($eta,$xi) + pi/2;
     176        my $denominator = sqrt($xi**2 + $eta**2);
     177        &my_die("denominator is zero!!", $magic_id, $PS_EXIT_PROG_ERROR) if $denominator == 0;
     178        $theta = atan(180 / pi / $denominator);
     179    }
    172180
    173181    # Coordinates on celestial sphere
  • branches/eam_branches/20091113/ippTasks/ipphosts.mhpcc.config

    r26015 r26236  
    1515  sky08 STR  ipp047
    1616  sky09 STR  ipp015
    17   sky10 STR  ipp016
     17#  sky10 STR  ipp016
     18  sky10 STR  ipp042
    1819  sky11 STR  ipp017
    1920  sky12 STR  ipp018
  • branches/eam_branches/20091113/ippTasks/rcserver.pro

    r26015 r26236  
    8080    end
    8181    add_poll_args run
     82    add_poll_labels run
    8283    command $run
    8384  end
     
    129130    book getword rcPendingFS $pageName stage -var STAGE
    130131    book getword rcPendingFS $pageName stage_id -var STAGE_ID
    131     book getword rcPendingFS $pageName dist_group -var DIST_GROUP
     132    book getword rcPendingFS $pageName data_group -var DATA_GROUP
    132133    book getword rcPendingFS $pageName filter -var FILTER
    133134    book getword rcPendingFS $pageName dist_dir -var DIST_DIR
    134 #    book getword rcPendingFS $pageName clean -var CLEAN
    135135    book getword rcPendingFS $pageName dest_id -var DEST_ID
    136136    book getword rcPendingFS $pageName product_name -var PRODUCT_NAME
     
    147147    book setword rcPendingFS $pageName pantaskState RUN
    148148
    149     $run = dist_make_fileset.pl --dist_id $DIST_ID --target_id $TARGET_ID --stage $STAGE --stage_id $STAGE_ID --dist_group $DIST_GROUP --filter $FILTER --dest_id $DEST_ID --product_name $PRODUCT_NAME  --ds_dbhost $DS_DBHOST --ds_dbname $DS_DBNAME --dist_dir $DIST_DIR
     149    $run = dist_make_fileset.pl --dist_id $DIST_ID --target_id $TARGET_ID --stage $STAGE --stage_id $STAGE_ID --data_group $DATA_GROUP --filter $FILTER --dest_id $DEST_ID --product_name $PRODUCT_NAME  --ds_dbhost $DS_DBHOST --ds_dbname $DS_DBNAME --dist_dir $DIST_DIR
    150150
    151151    add_standard_args run
     
    198198    end
    199199    add_poll_args run
     200    add_poll_labels run
    200201    command $run
    201202  end
  • branches/eam_branches/20091113/ippTasks/site.mhpcc.pro

    r25456 r26236  
    1010  controller exit true
    1111
    12   controller host add ipp014
     12#  controller host add ipp014
     13  controller host add ipp021
    1314  controller host add ipp015
    1415  controller host add ipp023
  • branches/eam_branches/20091113/ippTests/tap

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20091113/ippTools/configure.ac

    r25851 r26236  
    11AC_PREREQ(2.61)
    22
    3 AC_INIT([ipptools], [1.1.56], [ipp-support@ifa.hawaii.edu])
     3AC_INIT([ipptools], [1.1.57], [ipp-support@ifa.hawaii.edu])
    44AC_CONFIG_SRCDIR([autogen.sh])
    55
     
    1818PKG_CHECK_MODULES([PSLIB], [pslib >= 1.1.0])
    1919PKG_CHECK_MODULES([PSMODULES], [psmodules >= 1.1.0])
    20 PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.56])
     20PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.57])
    2121
    2222PXTOOLS_CFLAGS="${PSLIB_CFLAGS=} ${PSMODULES_CFLAGS=} ${IPPDB_CFLAGS=}"
     
    5959
    6060IPPDB_VERSION=`$PKG_CONFIG --modversion ippdb`
    61 AC_DEFINE_UNQUOTED(IPPDB_VERSION, $IPPDB_VERSION, [Version of ippdb])
     61AC_DEFINE_UNQUOTED(IPPDB_VERSION, ["$IPPDB_VERSION"], [Version of ippdb])
    6262
    6363AC_CONFIG_FILES([
  • branches/eam_branches/20091113/ippTools/share/Makefile.am

    r26089 r26236  
    138138     disttool_revertfileset.sql \
    139139     disttool_toadvance.sql \
     140     disttool_updateinterest.sql \
    140141     disttool_updatercrun.sql \
    141142     faketool_change_exp_state.sql \
     
    247248     stacktool_definebyquery_insert_random_part1.sql \
    248249     stacktool_definebyquery_insert_random_part2.sql \
    249      stacktool_definebyquery_part1.sql \
    250      stacktool_definebyquery_part2.sql \
     250     stacktool_definebyquery_select.sql \
    251251     stacktool_definebyquery_test.sql \
    252252     stacktool_donecleanup.sql \
  • branches/eam_branches/20091113/ippTools/share/chiptool_processedimfile.sql

    r25791 r26236  
    1010    chipProcessedImfile.magicked,
    1111    chipProcessedImfile.data_state,
     12    chipProcessedImfile.fault,
     13    chipProcessedImfile.quality,
    1214    chipRun.state,
    1315    chipRun.workdir,
  • branches/eam_branches/20091113/ippTools/share/difftool_definewarpstack_part1.sql

    r25516 r26236  
    2525    JOIN chipRun USING(chip_id)
    2626    WHERE warp1 IS NOT NULL
     27        AND warpRun.state = 'full'
     28    -- warp where hook %s
    2729) AS diffExp USING(exp_id, warp_id)
    2830WHERE
  • branches/eam_branches/20091113/ippTools/share/difftool_inputskyfile.sql

    r24677 r26236  
    2727    JOIN chipRun
    2828        USING(chip_id)
    29     JOIN chipProcessedImfile
    30         USING(chip_id)
    3129    JOIN rawExp
    32         ON chipRun.exp_id = rawExp.exp_id
    33     WHERE
    34         -- diffRun.state = 'new' AND
    35         warpRun.state = 'full'
    36         AND warpRun.state = 'full'
    37         AND fakeRun.state = 'full'
    38         AND camRun.state = 'full'
    39         AND chipRun.state = 'full'
     30        USING(exp_id)
    4031        -- where hook %s
    4132    UNION
     
    6758    JOIN chipRun
    6859        USING(chip_id)
    69     JOIN chipProcessedImfile
    70         USING(chip_id)
    7160    JOIN rawExp
    72         ON chipRun.exp_id = rawExp.exp_id
    73     WHERE
    74         -- diffRun.state = 'new' AND
    75         warpRun.state = 'full'
    76         AND fakeRun.state = 'full'
    77         AND camRun.state = 'full'
    78         AND chipRun.state = 'full'
     61        USING(exp_id)
    7962        -- where hook %s
    8063    UNION
     
    10790        USING(chip_id)
    10891    JOIN rawExp
    109         ON chipRun.exp_id = rawExp.exp_id
    110     WHERE
    111         (diffRun.state = 'new' or diffRun.state = 'full')
     92        USING(exp_id)
    11293        -- where hook %s
    11394    UNION
     
    140121        USING(chip_id)
    141122    JOIN rawExp
    142         ON chipRun.exp_id = rawExp.exp_id
    143     WHERE
    144         (diffRun.state = 'new' or diffRun.state = 'full')
     123        USING(exp_id)
    145124        -- where hook %s
    146125    ) as Foo
     126-- template where hook %s
  • branches/eam_branches/20091113/ippTools/share/disttool_definebyquery_camera.sql

    r25835 r26236  
    1515    AND camRun.dist_group  = distTarget.dist_group
    1616JOIN rcInterest USING(target_id)
    17 LEFT JOIN distRun ON distRun.stage = 'camera'
    18     AND camRun.cam_id = distRun.stage_id
    19     AND distRun.clean = distTarget.clean
     17LEFT JOIN distRun ON camRun.cam_id = distRun.stage_id
     18    AND distRun.target_id = distTarget.target_id
    2019    -- JOIN hook %s
    2120WHERE distTarget.state = 'enabled'
  • branches/eam_branches/20091113/ippTools/share/disttool_definebyquery_chip.sql

    r25835 r26236  
    1414    AND rawExp.filter = distTarget.filter
    1515JOIN rcInterest USING(target_id)
    16 LEFT JOIN distRun ON distRun.stage = 'chip'
    17     AND distRun.stage_id = chipRun.chip_id
    18     AND distRun.clean = distTarget.clean
     16LEFT JOIN distRun ON distRun.stage_id = chipRun.chip_id
     17    AND distRun.target_id = distTarget.target_id
    1918    -- JOIN hook %s
    2019WHERE distTarget.state = 'enabled'
  • branches/eam_branches/20091113/ippTools/share/disttool_definebyquery_diff.sql

    r25835 r26236  
    1616JOIN rawExp USING(exp_id)
    1717JOIN distTarget ON distTarget.stage = 'diff'
    18     AND diffRun.dist_group = distTarget.dist_group
    1918    AND distTarget.filter = rawExp.filter
     19    AND distTarget.dist_group = diffRun.dist_group
    2020JOIN rcInterest USING(target_id)
    21 LEFT JOIN distRun ON distRun.stage = 'diff' AND (distRun.stage_id = diff_id)
    22     AND distRun.clean = distTarget.clean
     21LEFT JOIN distRun ON (distRun.stage_id = diff_id)
     22                  AND distTarget.target_id = distRun.target_id
    2323    -- JOIN hook %s
    2424WHERE  distTarget.state = 'enabled'
  • branches/eam_branches/20091113/ippTools/share/disttool_definebyquery_fake.sql

    r25835 r26236  
    1515    AND rawExp.filter = distTarget.filter
    1616JOIN rcInterest USING(target_id)
    17 LEFT JOIN distRun ON distRun.stage = 'fake' AND (distRun.stage_id = fake_id)
    18     AND distRun.clean = distTarget.clean
     17LEFT JOIN distRun ON (distRun.stage_id = fake_id)
     18    AND distRun.target_id = distTarget.target_id
    1919WHERE  distTarget.state = 'enabled'
    2020    AND rcInterest.state = 'enabled'
  • branches/eam_branches/20091113/ippTools/share/disttool_definebyquery_raw.sql

    r25835 r26236  
    1313    AND rawExp.filter = distTarget.filter
    1414JOIN rcInterest USING(target_id)
    15 LEFT JOIN distRun ON distRun.stage = 'raw' AND distRun.stage_id = exp_id
    16     AND distRun.clean = distTarget.clean
     15LEFT JOIN distRun ON distRun.stage_id = exp_id
     16    AND distRun.target_id = distTarget.target_id
    1717    -- JOIN hook for magicked stuff %s
    1818WHERE distTarget.state = 'enabled'
  • branches/eam_branches/20091113/ippTools/share/disttool_definebyquery_stack.sql

    r25835 r26236  
    1515    AND stackRun.filter = distTarget.filter
    1616JOIN rcInterest USING(target_id)
    17 LEFT JOIN distRun ON distRun.stage = 'stack' AND (distRun.stage_id = stack_id)
    18     AND distRun.clean = distTarget.clean
     17LEFT JOIN distRun ON (distRun.stage_id = stack_id)
     18    AND distRun.target_id = distTarget.target_id
    1919    -- JOIN hook %s
    2020WHERE  distTarget.state = 'enabled'
  • branches/eam_branches/20091113/ippTools/share/disttool_definebyquery_warp.sql

    r25835 r26236  
    1717    AND rawExp.filter = distTarget.filter
    1818JOIN rcInterest USING(target_id)
    19 LEFT JOIN distRun ON distRun.stage = 'warp' AND (distRun.stage_id = warp_id)
    20     AND distRun.clean = distTarget.clean
     19LEFT JOIN distRun ON (distRun.stage_id = warp_id)
     20    AND distRun.target_id = distTarget.target_id
    2121WHERE  distTarget.state = 'enabled'
    2222    AND rcInterest.state = 'enabled'
  • branches/eam_branches/20091113/ippTools/share/disttool_pendingfileset.sql

    r26092 r26236  
    55    distRun.outdir as dist_dir,
    66    stage_id,
    7     distTarget.dist_group,
     7    -- we need to get data_group here but we don't have
     8    -- the right tables joined. Perhaps we need to add that column to distRun
     9    distRun.label as data_group,
    810    distTarget.filter,
    911    rcDestination.name AS product_name,
  • branches/eam_branches/20091113/ippTools/share/pstamptool_revertjob.sql

    r25547 r26236  
    44WHERE  pstampRequest.state = 'run'
    55    AND pstampJob.state = 'run'
    6     # do not revert faults >= 10 those are faults due to requestor errors
    7     AND pstampJob.fault < 10
     6    -- fault clause goes here %s
  • branches/eam_branches/20091113/ippTools/src/difftool.c

    r25851 r26236  
    9595        MODECASE(DIFFTOOL_MODE_IMPORTRUN,             importrunMode);
    9696        MODECASE(DIFFTOOL_MODE_TOCLEANEDSKYFILE,   tocleanedskyfileMode);
    97         MODECASE(DIFFTOOL_MODE_TOPURGEDSKYFILE,    topurgedskyfileMode);
    98         MODECASE(DIFFTOOL_MODE_TOSCRUBBEDSKYFILE,  toscrubbedskyfileMode);
     97        MODECASE(DIFFTOOL_MODE_TOPURGEDSKYFILE,    topurgedskyfileMode);
     98        MODECASE(DIFFTOOL_MODE_TOSCRUBBEDSKYFILE,  toscrubbedskyfileMode);
    9999
    100100        default:
     
    210210    PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);
    211211    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
    212    
     212
    213213    // Copy of my hacky work around from stacktool.c
    214214    if ((state)&&(diff_id)) {
     
    383383    }
    384384
    385     psString whereClause = NULL;
     385    psString whereClause = psStringCopy("");
    386386    if (psListLength(where->list)) {
    387387        whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    388         psStringPrepend(&whereClause, "\n AND ");
     388        psStringPrepend(&whereClause, "\n WHERE ");
    389389    }
    390390    psFree(where);
    391391
    392392    // Add condition to get only templates or only inputs
     393    psString templateClause = psStringCopy("");
    393394    {
    394         psString templateClause = NULL;
    395395        if (template) {
    396             psStringAppend(&templateClause, " %s", " template != 0");
     396            psStringAppend(&templateClause, "\n WHERE %s", " template != 0");
    397397        } else if (input) {
    398             psStringAppend(&templateClause, " %s", " template = 0");
    399         }
    400         if (templateClause) {
    401             psStringAppend(&whereClause, "\n AND %s", templateClause);
    402         }
    403         psFree(templateClause);
     398            psStringAppend(&templateClause, "\n WHERE %s", " template = 0");
     399        }
    404400    }
    405401
     
    412408    }
    413409
    414     if (!p_psDBRunQueryF(config->dbh, query, whereClause, whereClause, whereClause, whereClause)) {
    415         psError(PS_ERR_UNKNOWN, false, "database error");
     410    if (!p_psDBRunQueryF(config->dbh, query, whereClause, whereClause, whereClause, whereClause, templateClause)) {
     411        psError(PS_ERR_UNKNOWN, false, "database error");
     412        psFree(templateClause);
    416413        psFree(whereClause);
    417414        psFree(query);
    418415        return false;
    419416    }
     417    psFree(templateClause);
    420418    psFree(whereClause);
    421419    psFree(query);
     
    816814    psMetadata *where = psMetadataAlloc();
    817815    PXOPT_COPY_S64(config->args, where,  "-diff_id", "diffSkyfile.diff_id", "==");
     816    PXOPT_COPY_STR(config->args, where,  "-skycell_id", "diffSkyfile.skycell_id", "==");
    818817    PXOPT_COPY_STR(config->args, where,  "-label", "diffRun.label", "==");
    819818    PXOPT_COPY_S16(config->args, where, "-fault",     "fault", "==");
     
    914913    if (magicked) {
    915914      char *query = "UPDATE diffRun SET state = '%s', magicked = %" PRId64 " WHERE diff_id = %"PRId64;
    916      
     915
    917916      if (!p_psDBRunQueryF(config->dbh, query, state, magicked, diff_id)) {
    918917        psError(PS_ERR_UNKNOWN, false,
     
    923922    else {
    924923      char *query = "UPDATE diffRun SET state = '%s' WHERE diff_id = %"PRId64;
    925      
     924
    926925      if (!p_psDBRunQueryF(config->dbh, query, state, diff_id)) {
    927926        psError(PS_ERR_UNKNOWN, false,
     
    930929      }
    931930    }
    932    
     931
    933932    return true;
    934933}
     
    948947  if (!p_psDBRunQueryF(config->dbh,query,state,label)) {
    949948    psError(PS_ERR_UNKNOWN, false,
    950             "failed to change state for label %s", label);
     949            "failed to change state for label %s", label);
    951950    return(false);
    952951  }
     
    11381137
    11391138    psMetadata *expWhere = psMetadataAlloc();
    1140     psMetadata *warpWhere = psMetadataAlloc();
     1139    psMetadata *warp1Where = psMetadataAlloc(); // First set of restrictions on warp
     1140    psMetadata *warp2Where = psMetadataAlloc(); // Second set of restriction on warp
    11411141    psMetadata *stackWhere = psMetadataAlloc();
    11421142
    11431143    PXOPT_COPY_S64(config->args, expWhere, "-exp_id", "exp_id", "==");
    11441144    PXOPT_COPY_STR(config->args, expWhere, "-filter", "filter", "==");
    1145     PXOPT_COPY_S64(config->args, warpWhere, "-warp_id", "warpRun.warp_id", "==");
    1146     PXOPT_COPY_STR(config->args, warpWhere, "-skycell_id", "warpSkyfile.skycell_id", "==");
    1147     PXOPT_COPY_STR(config->args, warpWhere, "-tess_id", "warpRun.tess_id", "==");
    1148     PXOPT_COPY_STR(config->args, warpWhere, "-warp_label", "warpRun.label", "==");
    1149     PXOPT_COPY_F32(config->args, warpWhere,  "-good_frac", "warpSkyfile.good_frac", ">=");
     1145    PXOPT_COPY_S64(config->args, warp1Where, "-warp_id", "warpRun.warp_id", "==");
     1146    PXOPT_COPY_STR(config->args, warp1Where, "-warp_label", "warpRun.label", "==");
     1147    PXOPT_COPY_STR(config->args, warp1Where, "-tess_id", "warpRun.tess_id", "==");
     1148    PXOPT_COPY_S64(config->args, warp2Where, "-warp_id", "warpRun.warp_id", "==");
     1149    PXOPT_COPY_STR(config->args, warp2Where, "-tess_id", "warpRun.tess_id", "==");
     1150    PXOPT_COPY_STR(config->args, warp2Where, "-skycell_id", "warpSkyfile.skycell_id", "==");
     1151    PXOPT_COPY_STR(config->args, warp2Where, "-warp_label", "warpRun.label", "==");
     1152    PXOPT_COPY_F32(config->args, warp2Where,  "-good_frac", "warpSkyfile.good_frac", ">=");
    11501153    PXOPT_COPY_STR(config->args, stackWhere, "-stack_label", "stackRun.label", "==");
    11511154
     
    11711174    }
    11721175
    1173     psString warpQuery = NULL;
     1176    psString warp1Query = NULL;
     1177    psString warp2Query = NULL;
    11741178    psString stackQuery = NULL;
    11751179    psString expQuery = NULL;
     
    11831187    }
    11841188    psFree(expWhere);
    1185     if (psListLength(warpWhere->list)) {
    1186         psString whereClause = psDBGenerateWhereConditionSQL(warpWhere, NULL);
    1187         psStringAppend(&warpQuery, "\n AND %s", whereClause);
     1189    if (psListLength(warp1Where->list)) {
     1190        psString whereClause = psDBGenerateWhereConditionSQL(warp1Where, NULL);
     1191        psStringAppend(&warp1Query, "\n AND %s", whereClause);
    11881192        psFree(whereClause);
    11891193    } else {
    1190         warpQuery = psStringCopy("\n");
    1191     }
    1192     psFree(warpWhere);
    1193 
    1194     if (!available) {
    1195         // diff what's available, even if warp run has some faults and is incomplete
    1196         psStringAppend(&warpQuery, " AND warpRun.state = 'full'");
    1197     }
     1194        warp1Query = psStringCopy("\n");
     1195    }
     1196    psFree(warp1Where);
     1197    if (psListLength(warp2Where->list)) {
     1198        psString whereClause = psDBGenerateWhereConditionSQL(warp2Where, NULL);
     1199        psStringAppend(&warp2Query, "\n AND %s", whereClause);
     1200        psFree(whereClause);
     1201    } else {
     1202        warp2Query = psStringCopy("\n");
     1203    }
     1204    psFree(warp2Where);
    11981205
    11991206    // don't queue for exposures that have already been diff'd unless requested
     
    12141221    psFree(stackWhere);
    12151222
    1216     psTrace("difftool", 1, query, warpQuery, diffQuery, expQuery, stackQuery);
     1223    psTrace("difftool", 1, query, warp1Query, warp2Query, diffQuery, expQuery, stackQuery);
    12171224
    12181225    if (!psDBTransaction(config->dbh)) {
     
    12211228    }
    12221229
    1223     if (!p_psDBRunQueryF(config->dbh, query, warpQuery, expQuery, diffQuery)) {
     1230    if (!p_psDBRunQueryF(config->dbh, query, warp1Query, warp2Query, expQuery, diffQuery)) {
    12241231        psError(PS_ERR_UNKNOWN, false, "database error");
    12251232        psFree(query);
     
    12811288        return false;
    12821289    }
     1290    psFree(warp1Query);
    12831291    psFree(query);
    12841292    query = NULL;
     
    13121320        if (!p_psDBRunQuery(config->dbh, "DELETE FROM skycellsToDiff")) {
    13131321            psError(PS_ERR_UNKNOWN, false, "database error");
    1314             psFree(warpQuery);
     1322            psFree(warp2Query);
    13151323            psFree(stackQuery);
    13161324            psFree(skycell_query);
     
    13231331        if (!mdok) {
    13241332            psError(PXTOOLS_ERR_PROG, false, "warp_id not found --- ignoring row %ld", i);
    1325             psFree(warpQuery);
     1333            psFree(warp2Query);
    13261334            psFree(stackQuery);
    13271335            psFree(skycell_query);
     
    13341342        if (!mdok) {
    13351343            psError(PXTOOLS_ERR_PROG, false, "skycell_count not found");
    1336             psFree(warpQuery);
     1344            psFree(warp2Query);
    13371345            psFree(stackQuery);
    13381346            psFree(skycell_query);
     
    13451353        if (!mdok) {
    13461354            psError(PXTOOLS_ERR_PROG, false, "tess_id not found");
    1347             psFree(warpQuery);
     1355            psFree(warp2Query);
    13481356            psFree(stackQuery);
    13491357            psFree(skycell_query);
     
    13561364        if (!mdok) {
    13571365            psError(PXTOOLS_ERR_PROG, false, "filter not found");
    1358             psFree(warpQuery);
     1366            psFree(warp2Query);
    13591367            psFree(stackQuery);
    13601368            psFree(skycell_query);
     
    13641372            return false;
    13651373        }
    1366         if (!p_psDBRunQueryF(config->dbh, skycell_query, stackQuery, warp_id, filter, warpQuery)) {
    1367             psError(PS_ERR_UNKNOWN, false, "database error");
    1368             psFree(warpQuery);
     1374        if (!p_psDBRunQueryF(config->dbh, skycell_query, stackQuery, warp_id, filter, warp2Query)) {
     1375            psError(PS_ERR_UNKNOWN, false, "database error");
     1376            psFree(warp2Query);
    13691377            psFree(stackQuery);
    13701378            psFree(skycell_query);
     
    13771385
    13781386        if (num == 0) {
    1379             psTrace("difftool", PS_LOG_INFO, "no skycells with stack found for %" PRId64, warp_id);
     1387            psTrace("difftool", PS_LOG_INFO, "no skycells with stack found for warp_id %" PRId64, warp_id);
    13801388            continue;
    13811389        }
     
    13831391        if (!available && (num != skycell_count)) {
    13841392            psTrace("difftool", PS_LOG_INFO, "%" PRId64 " skyfiles with stack found for warp_id %" PRId64
    1385                     " need %" PRId64, num, warp_id, skycell_count);
     1393                    " but need %" PRId64, num, warp_id, skycell_count);
    13861394            continue;
    13871395        }
     
    14181426        if (!p_psDBRunQuery(config->dbh, query)) {
    14191427            psError(PS_ERR_UNKNOWN, false, "database error");
    1420             psFree(warpQuery);
     1428            psFree(warp2Query);
    14211429            psFree(stackQuery);
    14221430            psFree(skycell_query);
     
    14321440        if (!p_psDBRunQuery(config->dbh, query)) {
    14331441            psError(PS_ERR_UNKNOWN, false, "database error");
    1434             psFree(warpQuery);
     1442            psFree(warp2Query);
    14351443            psFree(stackQuery);
    14361444            psFree(skycell_query);
     
    14471455            psError(PS_ERR_UNKNOWN, false, "failed to change diffRun.state for diff_id: %" PRId64,
    14481456                run->diff_id);
    1449             psFree(warpQuery);
     1457            psFree(warp2Query);
    14501458            psFree(stackQuery);
    14511459            psFree(skycell_query);
     
    14611469    }
    14621470    psFree(output);
    1463     psFree(warpQuery);
     1471    psFree(warp2Query);
    14641472    psFree(stackQuery);
    14651473    psFree(skycell_query);
     
    20622070    return(false);
    20632071  }
    2064  
     2072
    20652073  return(true);
    20662074}
  • branches/eam_branches/20091113/ippTools/src/difftoolConfig.c

    r25840 r26236  
    155155    psMetadata *revertdiffskyfileArgs = psMetadataAlloc();
    156156    psMetadataAddS64(revertdiffskyfileArgs, PS_LIST_TAIL, "-diff_id", 0,            "search by diff ID", 0);
     157    psMetadataAddStr(revertdiffskyfileArgs, PS_LIST_TAIL, "-skycell_id", 0, "search by skycell_id", NULL);
    157158    psMetadataAddStr(revertdiffskyfileArgs, PS_LIST_TAIL, "-label", 0, "search by label", NULL);
    158159    psMetadataAddS16(revertdiffskyfileArgs, PS_LIST_TAIL, "-fault",  0,            "search by fault code", 0);
     
    192193    psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-new-templates", 0, "also search for diffs with new template", false);
    193194    psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-rerun", 0, "define new run even if one exists", false);
    194     psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-available", 0, "define new run even if warpRun has some faults", false);
     195    psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-available", 0, "define new run even if no stacks available for some skycells", false);
    195196    psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
    196197    psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-pretend", 0, "list results but to not queue", false);
     
    328329    PXOPT_ADD_MODE("-topurgedskyfile", "set skyfile as purged", DIFFTOOL_MODE_TOPURGEDSKYFILE, topurgedskyfileArgs);
    329330    PXOPT_ADD_MODE("-toscrubbedskyfile", "set skyfile as scrubbed", DIFFTOOL_MODE_TOSCRUBBEDSKYFILE, toscrubbedskyfileArgs);
    330    
     331
    331332    if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
    332333        psError(PS_ERR_UNKNOWN, true, "option parsing failed");
  • branches/eam_branches/20091113/ippTools/src/disttool.c

    r26095 r26236  
    5252static bool definetargetMode(pxConfig *config);
    5353static bool updatetargetMode(pxConfig *config);
    54 static bool listtargetMode(pxConfig *config);
     54static bool listtargetsMode(pxConfig *config);
    5555
    5656static bool definedestinationMode(pxConfig *config);
     
    100100        MODECASE(DISTTOOL_MODE_DEFINETARGET, definetargetMode);
    101101        MODECASE(DISTTOOL_MODE_UPDATETARGET, updatetargetMode);
    102         MODECASE(DISTTOOL_MODE_LISTTARGET, listtargetMode);
     102        MODECASE(DISTTOOL_MODE_LISTTARGETS, listtargetsMode);
    103103        MODECASE(DISTTOOL_MODE_DEFINEDESTINATION, definedestinationMode);
    104104        MODECASE(DISTTOOL_MODE_UPDATEDESTINATION, updatedestinationMode);
     
    13111311}
    13121312
    1313 static bool listtargetMode(pxConfig *config)
     1313static bool listtargetsMode(pxConfig *config)
    13141314{
    13151315    PS_ASSERT_PTR_NON_NULL(config, false);
     
    15511551    PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "LIKE");
    15521552    PXOPT_COPY_STR(config->args, where, "-filter", "filter", "LIKE");
    1553     PXOPT_COPY_STR(config->args, where, "-stage", "stage", "==");
     1553    // if stage is all don't add it to the query (match all stages)
     1554    if (stage && strcmp(stage, "all")) {
     1555        PXOPT_COPY_STR(config->args, where, "-stage", "stage", "==");
     1556    }
    15541557
    15551558    psString query = pxDataGet("disttool_defineinterest.sql");
     
    16111614    PXOPT_COPY_S64(config->args, where, "-dest_id",   "dest_id", "==");
    16121615    PXOPT_COPY_S64(config->args, where, "-target_id", "target_id", "==");
     1616    PXOPT_COPY_STR(config->args, where, "-dest_name", "rcDestination.name", "LIKE");
     1617    PXOPT_COPY_STR(config->args, where, "-filter", "filter", "LIKE");
     1618    PXOPT_COPY_STR(config->args, where, "-dist_group", "dist_group", "LIKE");
    16131619
    16141620    PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
     
    16181624        return false;
    16191625    }
    1620     psString query = NULL;
    1621     psStringAppend(&query, "UPDATE rcInterest SET state = '%s'", state);
     1626    psString query = pxDataGet("disttool_updateinterest.sql");
    16221627
    16231628    if (psListLength(where->list)) {
     
    16331638    psFree(where);
    16341639
    1635     if (!p_psDBRunQuery(config->dbh, query)) {
     1640    if (!p_psDBRunQueryF(config->dbh, query, state)) {
    16361641        psError(PS_ERR_UNKNOWN, false, "database error");
    16371642        psFree(query);
     
    16391644    }
    16401645    psFree(query);
     1646
     1647    psS64 numUpdated = psDBAffectedRows(config->dbh);
     1648    printf("updated %" PRId64 " interests\n", numUpdated);
    16411649
    16421650    return true;
  • branches/eam_branches/20091113/ippTools/src/disttool.h

    r26088 r26236  
    4747    DISTTOOL_MODE_DEFINETARGET,
    4848    DISTTOOL_MODE_UPDATETARGET,
    49     DISTTOOL_MODE_LISTTARGET,
     49    DISTTOOL_MODE_LISTTARGETS,
    5050    DISTTOOL_MODE_DEFINEINTEREST,
    5151    DISTTOOL_MODE_UPDATEINTEREST,
  • branches/eam_branches/20091113/ippTools/src/disttoolConfig.c

    r26095 r26236  
    263263    psMetadataAddStr(updatetargetArgs, PS_LIST_TAIL, "-set_state", 0, "define new state", NULL);
    264264
    265     // -listtarget
    266     psMetadata *listtargetArgs = psMetadataAlloc();
    267     psMetadataAddS64(listtargetArgs, PS_LIST_TAIL, "-target_id", 0, "list target with target_id", 0);
    268     psMetadataAddStr(listtargetArgs, PS_LIST_TAIL, "-dist_group",  0, "list targets for dist_group", NULL);
    269     psMetadataAddStr(listtargetArgs, PS_LIST_TAIL, "-filter",    0, "define filter", NULL);
    270     psMetadataAddStr(listtargetArgs, PS_LIST_TAIL, "-stage",     0, "list targets for stage", NULL);
    271     psMetadataAddBool(listtargetArgs, PS_LIST_TAIL,"-clean",     0, "list clean targets", false);
    272     psMetadataAddBool(listtargetArgs, PS_LIST_TAIL,"-full",      0, "list full targets", false);
    273     psMetadataAddStr(listtargetArgs, PS_LIST_TAIL, "-state",     0, "list targets in state", NULL);
    274     psMetadataAddU64(listtargetArgs, PS_LIST_TAIL, "-limit",     0, "limit number of targets listed to N", 0);
    275     psMetadataAddBool(listtargetArgs, PS_LIST_TAIL, "-simple",  0, "use the simple output format", false);
     265    // -listtargets
     266    psMetadata *listtargetsArgs = psMetadataAlloc();
     267    psMetadataAddS64(listtargetsArgs, PS_LIST_TAIL, "-target_id", 0, "list target with target_id", 0);
     268    psMetadataAddStr(listtargetsArgs, PS_LIST_TAIL, "-dist_group",  0, "list targets for dist_group", NULL);
     269    psMetadataAddStr(listtargetsArgs, PS_LIST_TAIL, "-filter",    0, "define filter", NULL);
     270    psMetadataAddStr(listtargetsArgs, PS_LIST_TAIL, "-stage",     0, "list targets for stage", NULL);
     271    psMetadataAddBool(listtargetsArgs, PS_LIST_TAIL,"-clean",     0, "list clean targets", false);
     272    psMetadataAddBool(listtargetsArgs, PS_LIST_TAIL,"-full",      0, "list full targets", false);
     273    psMetadataAddStr(listtargetsArgs, PS_LIST_TAIL, "-state",     0, "list targets in state", NULL);
     274    psMetadataAddU64(listtargetsArgs, PS_LIST_TAIL, "-limit",     0, "limit number of targets listed to N", 0);
     275    psMetadataAddBool(listtargetsArgs, PS_LIST_TAIL, "-simple",  0, "use the simple output format", false);
    276276
    277277    // -defineinterest
     
    293293    psMetadataAddS64(updateinterestArgs, PS_LIST_TAIL, "-target_id", 0, "define target_id", 0);
    294294    psMetadataAddStr(updateinterestArgs, PS_LIST_TAIL, "-set_state", 0, "define state (required)", NULL);
     295    psMetadataAddStr(updateinterestArgs, PS_LIST_TAIL, "-filter",    0, "define filter (LIKE comparison)", NULL);
     296    psMetadataAddStr(updateinterestArgs, PS_LIST_TAIL, "-dest_name",    0, "define destination name", NULL);
     297    psMetadataAddStr(updateinterestArgs, PS_LIST_TAIL, "-dist_group",    0, "define distribution group", NULL);
    295298
    296299    // -listinterests
     
    337340    PXOPT_ADD_MODE("-definetarget",       "", DISTTOOL_MODE_DEFINETARGET, definetargetArgs);
    338341    PXOPT_ADD_MODE("-updatetarget",       "", DISTTOOL_MODE_UPDATETARGET, updatetargetArgs);
    339     PXOPT_ADD_MODE("-listtarget",         "", DISTTOOL_MODE_LISTTARGET, listtargetArgs);
     342    PXOPT_ADD_MODE("-listtargets",         "", DISTTOOL_MODE_LISTTARGETS, listtargetsArgs);
    340343
    341344    PXOPT_ADD_MODE("-defineinterest",     "", DISTTOOL_MODE_DEFINEINTEREST, defineinterestArgs);
  • branches/eam_branches/20091113/ippTools/src/faketool.c

    r25935 r26236  
    9292        MODECASE(FAKETOOL_MODE_TOFULLIMFILE,            tofullimfileMode);
    9393        MODECASE(FAKETOOL_MODE_TOPURGEDIMFILE,          topurgedimfileMode);
    94         MODECASE(FAKETOOL_MODE_TOSCRUBBEDIMFILE,        toscrubbedimfileMode);
     94        MODECASE(FAKETOOL_MODE_TOSCRUBBEDIMFILE,        toscrubbedimfileMode);
    9595        MODECASE(FAKETOOL_MODE_EXPORTRUN,               exportrunMode);
    9696        MODECASE(FAKETOOL_MODE_IMPORTRUN,               importrunMode);
     
    123123
    124124    psMetadata *where = psMetadataAlloc();
     125    PXOPT_COPY_S64(config->args, where, "-cam_id", "cam_id", "==");
     126    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
    125127    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    126128    PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
  • branches/eam_branches/20091113/ippTools/src/faketoolConfig.c

    r25840 r26236  
    4747    psMetadata *queueArgs = psMetadataAlloc();
    4848    // XXX need to allow multiple exp_ids
     49    psMetadataAddS64(queueArgs, PS_LIST_TAIL, "-cam_id",             0, "search by cam_id", 0);
     50    psMetadataAddS64(queueArgs, PS_LIST_TAIL, "-chip_id",            0, "search by chip_id", 0);
    4951    psMetadataAddS64(queueArgs, PS_LIST_TAIL, "-exp_id",  0,            "search by exp_id", 0);
    5052    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_name",  0,            "search by exp_name", NULL);
  • branches/eam_branches/20091113/ippTools/src/magictool.c

    r26039 r26236  
    580580
    581581    if (fault > 0) {
    582         char *query = "UPDATE magicRun SET fault = %d, state = 'full' WHERE magic_id = %" PRId64;
     582        char *query = "UPDATE magicRun SET fault = %d WHERE magic_id = %" PRId64;
    583583        if (!p_psDBRunQueryF(config->dbh, query, fault, magic_id)) {
    584584            psError(PS_ERR_UNKNOWN, false,
     
    930930            psAbort("failed to lookup value for magic_id column");
    931931        }
    932        
     932
    933933        whereString = NULL;
    934934        psStringAppend(&whereString, "\nAND (magic_id = %" PRId64 ")", magic_id);
  • branches/eam_branches/20091113/ippTools/src/pstamptool.c

    r25793 r26236  
    774774    PXOPT_COPY_S64(config->args, where, "-fault",  "fault", "==");
    775775    PXOPT_COPY_S64(config->args, where, "-req_id_min",  "req_id", ">=");
     776
    776777    PXOPT_LOOKUP_BOOL(all, config->args, "-all", false);
    777778    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     779    PXOPT_LOOKUP_S16(fault, config->args, "-fault",  false, false);
     780
     781    // By default only revert faults < 10 which are our "ipp exit codes"
     782    // codes larger than that are the pstamp request interface.
     783    // Don't fault those unless -fault waa provided
     784    psString faultClause = "";
     785    if (!fault) {
     786        faultClause = " \nAND (pstampJob.fault < 10)";
     787    }
    778788
    779789    psString query = pxDataGet("pstamptool_revertjob.sql");
     
    790800    psFree(where);
    791801   
    792     if (!p_psDBRunQuery(config->dbh, query)) {
     802    if (!p_psDBRunQueryF(config->dbh, query, faultClause)) {
    793803        psError(PS_ERR_UNKNOWN, false, "database error");
    794804        return false;
  • branches/eam_branches/20091113/ippTools/src/pxadmin.c

    r25851 r26236  
    114114    psFree(query);
    115115
    116     if (!insert_dbversion(config, PACKAGE_VERSION)) {
     116    if (!insert_dbversion(config, IPPDB_VERSION)) {
    117117        psError(PS_ERR_UNKNOWN, false, "failed to set database version");
    118118        return false;
     
    155155    psFree(query);
    156156
    157     if (!insert_dbversion(config, PACKAGE_VERSION)) {
     157    if (!insert_dbversion(config, IPPDB_VERSION)) {
    158158        psError(PS_ERR_UNKNOWN, false, "failed to set database version");
    159159        return false;
  • branches/eam_branches/20091113/ippTools/src/stacktool.c

    r25935 r26236  
    150150    PXOPT_COPY_F32(config->args,  where, "-select_iq_m4_min",          "camProcessedExp.iq_m4", ">=");
    151151    PXOPT_COPY_F32(config->args,  where, "-select_iq_m4_max",          "camProcessedExp.iq_m4", "<=");
    152    
     152
    153153    PXOPT_COPY_STR(config->args,  where, "-select_exp_type",           "rawExp.exp_type", "==");
    154154    PXOPT_COPY_F32(config->args,  where, "-select_good_frac_min",      "warpSkyfile.good_frac", ">=");
     
    173173    }
    174174
    175     psString select = pxDataGet("stacktool_definebyquery_part1.sql");
     175    psString select = pxDataGet("stacktool_definebyquery_select.sql");
    176176    if (!select) {
    177177        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     
    179179    }
    180180
     181    psString where1 = psStringCopy("");
    181182    if (psListLength(where->list)) {
    182183        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    183         psStringAppend(&select, " AND %s", whereClause);
     184        psStringAppend(&where1, "\nAND %s", whereClause);
    184185        psFree(whereClause);
    185186    }
    186187
    187     psString groupby = pxDataGet("stacktool_definebyquery_part2.sql");
    188     if (!groupby) {
    189         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    190         psFree(where);
    191         return false;
    192     }
    193     psStringAppend(&select, " %s", groupby);
    194     psFree(groupby);
     188    psString where2 = psStringCopy("");
     189    if (label) {
     190        psStringAppend(&where2, "\nWHERE stackRun.label = '%s'", label);
     191    }
    195192
    196193    // Restriction on aggregated quantities using HAVING
     
    224221    psFree(having);
    225222
    226     if (!p_psDBRunQuery(config->dbh, select)) {
     223    if (!p_psDBRunQueryF(config->dbh, select, where1, where2)) {
    227224        psError(PS_ERR_UNKNOWN, false, "database error");
    228225        psFree(select);
    229         psFree(where);
     226        psFree(where1);
     227        psFree(where2);
    230228        return false;
    231229    }
    232230    psFree(select);
     231    psFree(where1);
     232    psFree(where2);
    233233
    234234    psArray *output = p_psDBFetchResult(config->dbh);
  • branches/eam_branches/20091113/psconfig/tagsets/ipp-2.9.dist

    r25923 r26236  
    6969  YNYYN  ippMonitor             ipp-2-9          -0
    7070  YYYYY  DataStore              ipp-2-9          -0
     71  YYYYY  DataStoreServer        ipp-2-9          -0
    7172
    7273  YYYYY  ppTranslate            ipp-2-9          -0
  • branches/eam_branches/20091113/psconfig/tagsets/ipp-2.9.perl

    r25894 r26236  
    3131  26    HTML::Parser                   HTML-Parser-3.56.tar.gz                  0
    3232  27    Digest::MD5                    Digest-MD5-2.36.tar.gz                   0
    33   28    Net::FTP                       libnet-1.19.tar.gz                       0
     33  28    Net::FTP                       libnet-1.19.tar.gz                       0               n
    3434  29    Compress::Zlib                 Compress-Zlib-2.003.tar.gz               0
    3535  30    Locale::Maketext::Simple       Locale-Maketext-Simple-0.18.tar.gz       0
  • branches/eam_branches/20091113/pstamp/scripts/pstamp_get_image_job.pl

    r20220 r26236  
    1616use File::Basename;
    1717use Digest::MD5::File qw( file_md5_hex );
     18use IPC::Cmd 0.36 qw( can_run run );
    1819
    19 use PS::IPP::Config qw($PS_EXIT_SUCCESS
    20                        $PS_EXIT_UNKNOWN_ERROR
    21                        $PS_EXIT_SYS_ERROR
    22                        $PS_EXIT_CONFIG_ERROR
    23                        $PS_EXIT_PROG_ERROR
    24                        $PS_EXIT_DATA_ERROR
    25                        $PS_EXIT_TIMEOUT_ERROR
    26                        metadataLookupStr
    27                        metadataLookupBool
    28                        caturi
    29                        );
     20
     21use PS::IPP::Config qw( :standard );
     22
    3023my $product;
    3124my $fileset;
    3225
    33 my $uri;
    34 my $out_dir;
     26my $output_base;
    3527
    36 my $verbose = 1;
     28my $verbose;
    3729my $ipprc;
    3830my $dbname;
     31my $dbserver;
    3932my $job_id;
    4033my $rownum;
     
    4740        'job_id=s'        =>      \$job_id,
    4841        'rownum=s'        =>      \$rownum,
    49         'uri=s'           =>      \$uri,
    50         'out_dir=s'       =>      \$out_dir,
     42        'output_base=s'   =>      \$output_base,
    5143        'dbname=s'        =>      \$dbname,
     44        'dbserver=s'      =>      \$dbserver,
     45        'verbose'         =>      \$verbose,
    5246) or pod2usage(2);
    5347
     
    5549$err .= "--job_id is required\n" if (!$job_id);
    5650$err .= "--rownum is required\n" if (!$rownum);
    57 $err .= "--uri is required to specify the file list\n" if (!$uri);
    58 $err .= "--out_dir is required to specify the output fileset\n" if (!$out_dir);
     51$err .= "--output_base is required to specify the output fileset\n" if (!$output_base);
    5952
    60 die $err if $err;
     53my_die( $err, $PS_EXIT_PROG_ERROR) if $err;
    6154
    62 # collapse any multiple slashes in output_dir
    63 $out_dir = File::Spec->canonpath($out_dir);
     55my $params_file = $output_base . ".mdc";
     56if (! open(INPUT, "<$params_file") ) {
     57    my_die("failed to open params file: $params_file", $PS_EXIT_UNKNOWN_ERROR);
     58}
    6459
    65 my @path = split(/\//, $out_dir);
     60my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    6661
    67 my $nelem = @path;
    68 if ($nelem < 2) {
    69     die("$out_dir is not a valid output fileset directory");
     62my $data = $mdcParser->parse(join "", (<INPUT>)) or my_die("failed to parse metadata config doc", $PS_EXIT_UNKNOWN_ERROR);
     63my $components = parse_md_list($data);
     64my $n = scalar @$components;
     65if ($n != 1) {
     66    my_die("params file $params_file contains unexpected number of components: $n", $PS_EXIT_PROG_ERROR);
    7067}
    71 $fileset = $path[$nelem-1];
    72 $product = $path[$nelem-2];
    73 
    74 $_ = $out_dir;
    75 my ($ds_dir) = m%(.*)/$product/$fileset%;
     68my $comp = $components->[0];
     69my $stage = $comp->{stage};
     70my $stage_id = $comp->{stage_id};
     71my $component = $comp->{component};
     72my $path_base = $comp->{path_base};
     73my $camera = $comp->{camera};
     74my $magicked = $comp->{magicked};
    7675
    7776if ($verbose) {
    78     print STDERR "DS root:  $ds_dir\n";
    79     print STDERR "Product:  $product\n";
    80     print STDERR "Fileset:  $fileset\n";
    81     print STDERR "Filelist: $uri\n";
     77    print STDERR "\nstage is $stage\n";
     78    print STDERR "stage_id is $stage_id\n";
     79    print STDERR "path_base is $path_base\n";
     80    print STDERR "path_base is $path_base\n";
     81    print STDERR "CAMERA is $camera\n";
     82    print STDERR "magicked is " . (defined $magicked ? $magicked : "undefined") . "\n";
    8283}
    8384
    84 
    85 if (!stat("$ds_dir/index.txt")) {
    86     $err .= "Data Store not found at '$ds_dir'.\n"
     85if (!$camera or !$path_base or !$component or !$stage_id or !$stage) {
     86       my_die("failed to parse params from: $params_file", $PS_EXIT_UNKNOWN_ERROR);
    8787}
    8888
    89 show_usage("Invalid product '$product'.")
    90     unless defined stat("$ds_dir/$product/index.txt");
     89my $out_dir = dirname($output_base);
     90my $prefix = basename($output_base) . "_";
     91my $results_file = $output_base . ".bundle_results";
    9192
    92 if (! open(INPUT, "<$uri") ) {
    93     die("failed to open file list: $uri");
     93# Look for programs we need
     94my $missing_tools;
     95my $dist_bundle   = can_run('dist_bundle.pl') or (warn "Can't find dist_bundle.pl" and $missing_tools = 1);
     96if ($missing_tools) {
     97    warn("Can't find required tools.");
     98    exit($PS_EXIT_CONFIG_ERROR);
    9499}
    95100
    96 my $reglist = "$out_dir/reglist";
    97 if (! open(REGLIST, ">$reglist$job_id") ) {
    98     die("failed to open registration list: $reglist");
     101{
     102    my $command = "$dist_bundle --camera $camera --stage $stage --stage_id $stage_id";
     103    $command .= " --component $component";
     104    $command .= " --path_base $path_base --outdir $out_dir --results_file $results_file";
     105    $command .= " --prefix $prefix";
     106    $command .= " --magicked" if $magicked;
     107    $command .= " --dbname $dbname" if $dbname;
     108    $command .= " --verbose" if $verbose;
     109    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     110        run(command => $command, verbose => $verbose);
     111    unless ($success) {
     112        my_die("Unable to perform $command: $error_code", $error_code >> 8);
     113    }
    99114}
    100115
    101 my @files;
    102 my $num = 0;
    103 while (<INPUT>) {
    104     chomp;
    105     my @fields = split /\|/;
    106     my $pathname = shift @fields;
    107     my $filetype = shift @fields;
    108     my $class_id = shift @fields;
     116if (! open(RESULTS, "<$results_file")) {
     117    my_die("failed to open bundle results file: $results_file", $PS_EXIT_UNKNOWN_ERROR);
     118}
    109119
    110     ($pathname , my $filename) = resolvepath($pathname);
     120my $file_name;
     121my $bytes;
     122my $md5sum;
     123foreach my $line (<RESULTS>) {
     124    chomp $line;
     125    next if !$line;
     126    next if $line =~ /bundleResults/;
     127    last if $line =~ /END/;
    111128
    112     if ($verbose) {
    113         print STDERR "$pathname @fields\n";
     129    my ($tag, $type, $val) = split " ", $line;
     130    if ($tag eq "name") {
     131        $file_name = $val;
     132    } elsif ($tag eq "bytes") {
     133        $bytes = $val;
     134    } elsif ($tag eq "md5sum") {
     135        $md5sum = $val;
     136    } else {
     137        my_die("unexpected tag: $tag  found in results file: $results_file", $PS_EXIT_PROG_ERROR);
    114138    }
     139}
    115140
    116     $num++;
    117     $filename = "${rownum}_${num}_$filename";
    118     my $dest_path = "$out_dir/$filename";
    119     if (! copy $pathname, "$dest_path" ) {
    120         die("failed trying to copy $pathname to $out_dir");
    121     }
     141my $reglist = "$out_dir/reglist$job_id";
     142if (! open(REGLIST, ">$reglist") ) {
     143    my_die("failed to open registration list: $reglist", $PS_EXIT_UNKNOWN_ERROR);
     144}
    122145
    123     # XXX is pstamp always the right file type, if not where can we get the right one?
    124     print REGLIST file_registration_line($filename, $dest_path, $filetype, $class_id);
    125 
    126     foreach my $f (@fields) {
    127         print REGLIST "$f|";
    128     }
    129     print REGLIST "\n";
    130 }
     146print REGLIST "$file_name|$bytes|$md5sum|tgz|\n";
    131147
    132148close(REGLIST);
     
    134150exit 0;
    135151
    136 sub resolvepath {
    137     my $pathname = $_[0];
     152sub my_die {
     153    my $msg = shift;
     154    my $rc = shift;
    138155
    139     # use the basename of the unresolved file as the name of the file
    140     # in order to avoid nebulous name mangled paths in the datastore
    141     my $file = basename($pathname);
    142 
    143     my $slash = index($pathname, "/");
    144     if ($slash != 0) {
    145         if (!$ipprc) {
    146             $ipprc = PS::IPP::Config->new();
    147         }
    148         $pathname = $ipprc->file_resolve($pathname);
    149     }
    150 
    151 
    152     return ($pathname, $file);
     156    print STDERR $msg;
     157    exit $rc ? $rc : $PS_EXIT_UNKNOWN_ERROR;
    153158}
    154 
    155 # XXX move this to a module so the code can be shared
    156 sub file_registration_line {
    157     my $filename = shift;
    158     my $path     = shift;
    159     my $filetype = shift;
    160     my $chipname = shift;
    161     $chipname = $chipname ? "$chipname|" : "";
    162 
    163     if (-e $path) {
    164         my @finfo = stat($path);
    165         die "failed to stat $path" unless (@finfo);    # XXX clean up
    166         my $bytes = $finfo[7];
    167         my $md5sum = file_md5_hex($path);
    168 
    169         return "$filename|$bytes|$md5sum|$filetype|$chipname";
    170     } else {
    171         die "$filename not found at $path";
    172     }
    173 }
  • branches/eam_branches/20091113/pstamp/scripts/pstamp_job_run.pl

    r25712 r26236  
    148148    }
    149149} elsif ($jobType eq "get_image") {
    150     my_die( "get_image jobs not working right now", $job_id, $PS_EXIT_PROG_ERROR);
    151150
    152151    my $uri = "";
    153     my $command = "$pstamp_get_image_job --job_id $job_id --uri $uri --out_dir $outputBase --rownum $rownum";
     152    my $command = "$pstamp_get_image_job --job_id $job_id --output_base $outputBase --rownum $rownum";
    154153    $command .= " --dbname $dbname" if $dbname;
    155154    $command .= " --dbserver $dbserver" if $dbserver;
     155    $command .= " --verbose" if $verbose;
    156156    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    157157        run(command => $command, verbose => $verbose);
  • branches/eam_branches/20091113/pstamp/scripts/pstamp_parser_run.pl

    r25319 r26236  
    1313use Getopt::Long qw( GetOptions );
    1414use File::Basename qw( basename dirname);
     15use File::Copy;
    1516use POSIX qw( strftime );
    1617use Carp;
     
    119120        unlink $new_uri or my_die("failed to unlink $new_uri", $req_id, $PS_EXIT_UNKNOWN_ERROR);
    120121    }
    121     if (! symlink $uri, $new_uri) {
    122         my_die ("failed to link request file $uri to workdir $workdir", $req_id, $PS_EXIT_UNKNOWN_ERROR);
     122    if (! copy $uri, $new_uri) {
     123        my_die ("failed to copy request file $uri to workdir $workdir", $req_id, $PS_EXIT_UNKNOWN_ERROR);
    123124    }
    124125}
  • branches/eam_branches/20091113/pstamp/scripts/pstampparse.pl

    r26083 r26236  
    9898
    9999# make sure the file contains what we are expecting
    100 
    101 # we shouldn't get here if this is the case so just die. No need to notify the client
     100# This program shouldn't have been run if the request file is bogus.
     101# No need to notify the client
    102102my_die("$request_file_name is not a PS1_PS_REQEST", $PS_EXIT_PROG_ERROR) if $extname ne "PS1_PS_REQUEST";
    103103my_die("REQ_NAME not found in $request_file_name", $PS_EXIT_PROG_ERROR)  if (!$req_name);
     
    165165    # XXX: TODO: sanity check all parameters
    166166
    167     # XXX: TODO: We shouldn't really just die in this loop.
    168     # If we encounter an error for a particular row
    169     # add a job with the proper fault code. If there is a db or config error we should probably just
    170     # trash the request.
     167    # If we encounter an error for a particular row add a job with the proper fault code.
     168    # If we encounter an error in this loop we shouldn't really just die.
     169    # We only do that now in the case of I/O or DB errors or the like.
    171170
    172171    my $rownum   = $row->{ROWNUM};
     
    236235    }
    237236
    238     # collect rows with the same images of interest in a list so that they
    239     # can be looked up together
     237    # For "stamp" and "list_uri" jobs collect rows with the same images of interest in a list so that they
     238    # can be looked up together.
    240239    if (@rowList) {
    241240        my $firstRow = $rowList[0];
    242         # note order of these parameters matters
    243         if (same_images_of_interest($firstRow, $row)) {
     241        if (($firstRow->{JOB_TYPE} ne "get_image") and same_images_of_interest($firstRow, $row)) {
    244242
    245243            # add this row to the list and move on
     
    305303    my $have_skycells = shift;
    306304    my $need_magic = shift;
     305    my $mode = shift;
    307306
    308307    my $num_jobs = 0;
     
    395394        print ARGSLIST "$args\n";
    396395        close ARGSLIST or my_die("failed to close $argslist", $PS_EXIT_UNKNOWN_ERROR);
     396
     397        write_params($output_base, $image);
    397398
    398399        my $newState = "run";
     
    476477        }
    477478    } elsif ($job_type eq "get_image") {
    478         print STDERR "get_image jobs not implemented yet" if $verbose;
    479         foreach my $row (@$rowList) {
    480             insertFakeJobForRow($row, 1, $PSTAMP_NOT_IMPLEMENTED);
    481             $num_jobs++;
    482         }
     479        my $n = scalar @$rowList;
     480
     481        my_die( "error: unexpected number of rows for get_image request: $n", $PS_EXIT_PROG_ERROR) if $n != 1;
     482
     483        $num_jobs = queueGetImageJobs($firstRow, $imageList, $stage, $need_magic, $mode);
     484
    483485    } else {
    484486        if (!$imageList or (scalar @$imageList eq 0)) {
     
    582584           
    583585            foreach my $row (@$rowList) {
    584                 $num_jobs += queueJobsForRow($row, $stage, $thisRun, $have_skycells, $need_magic);
     586                $num_jobs += queueJobsForRow($row, $stage, $thisRun, $have_skycells, $need_magic, $mode);
    585587            }
    586588        }
     589    }
     590    return $num_jobs;
     591}
     592
     593#        $num_jobs = queueGetImageJobs($firstRow, $imageList, $stage, $need_magic, $mode);
     594sub queueGetImageJobs
     595{
     596    my $row = shift;
     597    my $imageList = shift;
     598    my $stage = shift;
     599    my $need_magic = shift;
     600    my $mode = shift;
     601
     602    my $num_jobs = 0;
     603    my $rownum = $row->{ROWNUM};
     604    my $option_mask = $row->{OPTION_MASK};
     605
     606    # For dist_bundle we need
     607    #  --camera from $image
     608    #  --stage
     609    #  --stage_id from $image
     610    #  --component from $image
     611    #  --path_base
     612    #  --outdir global to this script
     613
     614    # loop over images
     615    my $job_num = 0;
     616    foreach my $image (@$imageList) {
     617        my $stage_id = $image->{stage_id};
     618        my $component = $image->{component};
     619
     620        # skip faulted components for now. Should we even be here?
     621        if ($image->{fault} > 0) {
     622            printf STDERR "skipping faulted component for $stage $stage_id $component\n" if $verbose;
     623            next;
     624        }
     625
     626        $job_num++;
     627
     628        my $imagefile = $image->{image};
     629        if (($stage ne "stack") and ($need_magic and !$image->{magicked})) {
     630            # we only get here if req_type is (byid or byexp). For other types the test for magicked is performed
     631            # in locate_images because it's much more efficient to do the test in the database.
     632            # For these two modes we fall through to here in order to give feedback to the requestor as
     633            # to why the request failed to queue jobs.
     634            print STDERR "skipping non-magicked image $imagefile\n" if $verbose;
     635            insertFakeJobForRow($row, $job_num, $PSTAMP_NOT_DESTREAKED);
     636            $num_jobs++;
     637
     638            next;
     639        }
     640        my $exp_id = $image->{exp_id};
     641           
     642        my $output_base = "$out_dir/${rownum}_${job_num}";
     643
     644        write_params($output_base, $image);
     645
     646        my $newState = "run";
     647        my $fault = 0;
     648        my $dep_id;
     649
     650        if ($stage ne 'raw') {
     651            my $run_state = $image->{state};
     652            my $data_state = $image->{data_state};
     653            $data_state = $run_state if $stage eq "stack";
     654            if (($run_state eq 'goto_purged') or ($data_state eq 'purged') or
     655                ($run_state eq 'goto_scrubbed') or ($data_state eq 'scrubbed')) {
     656                # image is gone and it's not coming back
     657                $newState = 'stop';
     658                $fault = $PSTAMP_GONE;
     659            } elsif (($data_state ne 'full') or ($run_state ne 'full' )) {
     660                # don't wait for update unless the caller asks us to
     661                if (!($option_mask & $PSTAMP_WAIT_FOR_UPDATE)) {
     662                    $newState = 'stop';
     663                    $fault = $PSTAMP_NOT_AVAILABLE;
     664                } else {
     665                    # cause the image to be re-made
     666                    # set up to queue an update run
     667                    queue_update_run(\$newState, \$fault, \$dep_id, $image->{image_db},
     668                        $run_state, $stage, $image->{stage_id}, $need_magic, $image->{label});
     669                }
     670            }
     671        }
     672
     673        $num_jobs++;
     674        my $command = "$pstamptool -addjob  -req_id $req_id -job_type $row->{JOB_TYPE}"
     675                        . " -outputBase $output_base -rownum $rownum -state $newState -options $option_mask";
     676        $command .= " -fault $fault" if $fault;
     677        $command .= " -exp_id $exp_id" if $exp_id;
     678        $command .= " -dep_id $dep_id" if $dep_id;
     679
     680        if ($mode eq "list_job") {
     681            # this is a debugging mode, just print the pstamptool that would have run
     682            # this is sort of like the mode -noupdate that some other tools support
     683            print "$command\n";
     684        } elsif (!$no_update) {
     685            # mode eq "queue_job"
     686            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     687                run(command => $command, verbose => $verbose);
     688            unless ($success) {
     689                print STDERR @$stderr_buf;
     690                # XXX TODO: now what? Should we mark the error state for the request?
     691                # should we keep going for other uris? If so how do we report that some
     692                # of the work that the request wanted isn't going to get done
     693                my_die("failed to queue job for request $req_id", $PS_EXIT_UNKNOWN_ERROR);
     694            }
     695        } else {
     696            print "skipping command: $command\n";
     697        }
     698    }
     699    if ( $num_jobs == 0 ) {
     700        print STDERR "no jobs for row $rownum\n" if $verbose;
     701        insertFakeJobForRow($row, 1, $PSTAMP_NO_JOBS_QUEUED);
     702        $num_jobs = 1;
    587703    }
    588704    return $num_jobs;
     
    677793    return 0 if ($r1->{REQ_TYPE} ne $r2->{REQ_TYPE});
    678794    return 0 if ($r1->{IMG_TYPE} ne $r2->{IMG_TYPE});
    679     return 0 if ($r1->{ID} ne $r2->{ID});
    680     return 0 if ($r1->{TESS_ID} ne $r2->{TESS_ID});
    681     return 0 if ($r1->{REQFILT} ne $r2->{REQFILT});
    682     return 0 if ($r1->{LABEL} ne $r2->{LABEL});
    683     return 0 if ($r1->{MJD_MIN} ne $r2->{MJD_MAX});
    684     return 0 if ($r1->{MJD_MAX} ne $r2->{MJD_MAX});
    685     return 0 if ($r1->{inverse} ne $r2->{inverse});
     795    return 0 if ($r1->{ID}       ne $r2->{ID});
     796    return 0 if ($r1->{TESS_ID}  ne $r2->{TESS_ID});
     797    return 0 if ($r1->{REQFILT}  ne $r2->{REQFILT});
     798    return 0 if ($r1->{LABEL}    ne $r2->{LABEL});
     799    return 0 if ($r1->{MJD_MIN}  ne $r2->{MJD_MAX});
     800    return 0 if ($r1->{MJD_MAX}  ne $r2->{MJD_MAX});
     801    return 0 if ($r1->{inverse}  ne $r2->{inverse});
    686802
    687803    if (defined($r1->{COMPONENT})) {
     
    759875}
    760876
     877sub write_params {
     878    my $output_base = shift;
     879    my $image = shift;
     880
     881    # write the contents of this "image" as a metadata config doc
     882    # Simply treat all values as strings. This is ok since we are only going to
     883    # read it from another perl script
     884    my $mdc_file = "${output_base}.mdc";
     885    open P, ">$mdc_file" or my_die("failed to open $mdc_file", $PS_EXIT_UNKNOWN_ERROR);
     886
     887    print P "params METADATA\n";
     888
     889    foreach my $key (keys %$image) {
     890        my $value = $image->{$key};
     891        if (defined $value) {
     892            printf P "  %-20s STR     %s\n", $key, $value;
     893        } else {
     894            printf P "  %-20s STR     NULL\n", $key;
     895        }
     896    }
     897
     898    print P "END\n";
     899    close P or my_die("failed to close $mdc_file", $PS_EXIT_UNKNOWN_ERROR);
     900}
     901
    761902sub my_die
    762903{
  • branches/eam_branches/20091113/pstamp/src/pstampdump.c

    r25321 r26236  
    131131        }
    132132        if (!simple) {
    133             printf("ROW_%d METADATA\n", i);
     133            printf("ROW_%d METADATA\n", i+1);
    134134            printf("%s", str);
    135135            printf("END\n");
  • branches/eam_branches/20091113/pstamp/test/byskycell.txt

    r25767 r26236  
    11# Sample Postage stamp request description file
    2 # This can be parsed by the program pstamp_req_create to build a
    3 # PS1_PSTAMP_REQUEST binary table
     2# This can be parsed by the program pstamp_request_file to build a PS1_PSTAMP_REQUEST binary table
    43
    54# First line of data is for the extension header
     
    76#
    87# Note that value for REQ_NAME may be overriden by a command line
    9 # argument to pstamp_req_create.
     8# argument to pstamp_request_create.
    109# Blank and comment lines are ignored
    1110
Note: See TracChangeset for help on using the changeset viewer.