Index: trunk/pstamp/scripts/pstamp_parser_run.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_parser_run.pl	(revision 17893)
+++ trunk/pstamp/scripts/pstamp_parser_run.pl	(revision 18232)
@@ -5,5 +5,4 @@
 ###
 
-#XXX TODO: accept dbname save-temps and verbose as command line parameters
 #XXX see notes about error handling
 
@@ -12,6 +11,16 @@
 
 use Sys::Hostname;
-
-my $verbose = 1;
+use Getopt::Long qw( GetOptions );
+
+my $verbose;
+my $dbname;
+my $request_id;
+
+GetOptions(
+    'verbose'   =>  \$verbose,
+    'dbname=s'    =>  \$dbname,
+    'req_id=s'  =>  \$request_id,
+);
+
 if ($verbose) {
     my $host = hostname();
@@ -20,9 +29,5 @@
 }
 
-if (@ARGV != 1) {
-    die "usage: $0 request_id\n";
-}
-
-my $request_id = $ARGV[0];
+die "req_id is required" if !defined($request_id);
 
 use IPC::Cmd 0.36 qw( can_run run );
@@ -77,4 +82,5 @@
 {
     my $command = "$pstamptool -pendingreq -req_id $request_id";
+    $command .= " -dbname $dbname" if $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
@@ -135,4 +141,5 @@
 if ($ds_id) {
     my $command = "$pstamptool -datastore -ds_id $ds_id";
+    $command .= " -dbname $dbname" if $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
@@ -173,4 +180,5 @@
 if ($request_type eq "PS1_PS_REQUEST") {
     $parse_cmd = $pstampparse . " -mode queue_job -req_id $request_id -out_dir $outdir $uri";
+    $parse_cmd .= " -dbname $dbname" if $dbname;
 } elsif ($request_type eq "MOPS_DETECTABILITY_QUERY") {
     $parse_cmd = $dqueryparse  . " --mode queue_job --req_id $request_id --out_dir $outdir --uri $uri";
@@ -195,5 +203,7 @@
     }
 }
-# XXX make sure that a job got actually got queued. If not set the request result and set state to
+
+# XXX make sure that a job got actually got queued.
+# If not set the request result and set state to
 # run so that the "request finisher" can build the results file.
 
@@ -203,4 +213,5 @@
 {
     my $command = "$pstamptool -processedreq -req_id $request_id -state run";
+    $command .= " -dbname $dbname" if $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
