IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35485


Ignore:
Timestamp:
May 2, 2013, 11:49:21 AM (13 years ago)
Author:
bills
Message:

put webrequst in workdir YYYY/MM/DD add options for setting label, username, and request name prefix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20130307/pstamp/scripts/pstamp_webrequest.pl

    r29383 r35485  
    55#
    66# The arguments are the command line parameters for the program psmkreq
    7 #
    8 # Unless the argument -list is provided the output is the request id for the resulting request
    9 #
    10 # If -list is the first argument, the request file is built and parsed and the
    11 # the selected "input" uris are listed on stdout.
    127#
    138# Note: Despite the name there nothing particularly web specific about this program.
     
    2318
    2419my $host = hostname();
    25 my $verbose = 1;
     20my $verbose = 0;
    2621my $dbname;
    2722my $dbserver;
     23my $pretend;
     24my $label = 'WEB';
     25my $req_name_prefix = 'web';
     26my $username;
    2827
    2928GetOptions(
    3029    'dbname=s'      =>  \$dbname,
    3130    'dbserver=s'    =>  \$dbserver,
    32     'verbose'       => \$verbose,
     31    'label=s'       =>  \$label,
     32    'username=s'    =>  \$username,
     33    'prefix=s'      =>  \$req_name_prefix,
     34    'pretend'       =>  \$pretend,
     35    'verbose'       =>  \$verbose,
    3336);
    3437
     
    3639
    3740if ($verbose) {
    38     print "\n\n";
    39     print "Starting script $0 on $host\n\n";
     41    print STDERR "\n\n";
     42    print STDERR "Starting script $0 on $host\n\n";
    4043}
    4144
     
    7073# make a request file
    7174my $cur_dir = getcwd();
     75
    7276#print STDERR "cur_dir is $cur_dir\n";
    7377
    74 my $datestr = strftime "%Y%m%d", gmtime;
     78my $datestr = strftime "%Y/%m/%d", gmtime;
    7579my $datedir = "$cur_dir/webreq/$datestr";
    7680if (! -e $datedir ) {
    77     if (!  mkdir $datedir ) {
    78         print STDERR  "failed to create working directory $datedir";
     81    my $rc = system "mkdir -p $datedir";
     82    if ($rc) {
     83        my $status = $rc >> 8;
     84        print STDERR  "failed to create working directory $datedir: $rc $status";
    7985        exit $PS_EXIT_CONFIG_ERROR;
    8086    }
    8187}
    8288
    83 my $request_name = "web_" . get_webreq_num();
     89my $request_name = $req_name_prefix . '_' . get_webreq_num();
    8490my $request_file = "$datedir/$request_name.fits";
    8591{
     
    96102# Queue the request
    97103my $req_id = 0;
    98 {
     104unless ($pretend) {
    99105
    100106    my $command = "$pstamptool -addreq -uri $request_file -ds_id 0";
    101     $command .= " -label WEB";
     107    $command .= " -label $label";
     108    $command .= " -username $username" if $username;
    102109    $command .= " -dbname $dbname" if $dbname;
    103110    $command .= " -dbserver $dbserver" if $dbserver;
     
    109116    }
    110117    $req_id = ${$stdout_buf}[0];
     118    chomp $req_id;
    111119}
    112120
Note: See TracChangeset for help on using the changeset viewer.