Changeset 29333
- Timestamp:
- Oct 5, 2010, 3:41:25 PM (16 years ago)
- Location:
- tags/ipp-20100823
- Files:
-
- 1 deleted
- 23 edited
- 2 copied
-
ippTasks/pstamp.pro (modified) (5 diffs, 1 prop)
-
ippTools (modified) (1 prop)
-
ippTools/share/pstamptool_revertdependent.sql (modified) (1 prop)
-
ippTools/share/pstamptool_revertjob.sql (modified) (1 prop)
-
ippTools/share/pstamptool_updatejob.sql (modified) (1 diff)
-
ippTools/share/pubtool_pending.sql (modified) (1 prop)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff, 1 prop)
-
ippTools/src/pstamptool.c (modified) (3 diffs, 1 prop)
-
ippTools/src/pstamptool.h (modified) (1 prop)
-
ippTools/src/pstamptoolConfig.c (modified) (3 diffs, 1 prop)
-
ippTools/src/pubtool.c (modified) (1 prop)
-
ippTools/src/stacktool.c (modified) (1 prop)
-
ippTools/src/stacktoolConfig.c (modified) (1 prop)
-
pstamp (modified) (1 prop)
-
pstamp/scripts/Makefile.am (modified) (1 diff)
-
pstamp/scripts/detectability_respond.pl (modified) (1 diff)
-
pstamp/scripts/psmkreq (copied) (copied from trunk/pstamp/scripts/psmkreq )
-
pstamp/scripts/pstamp_checkdependent.pl (modified) (1 prop)
-
pstamp/scripts/pstamp_finish.pl (modified) (2 diffs)
-
pstamp/scripts/pstamp_insert_request.pl (modified) (3 diffs)
-
pstamp/scripts/pstamp_server_status (modified) (5 diffs)
-
pstamp/scripts/pstamp_webrequest.pl (modified) (5 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (2 diffs)
-
pstamp/scripts/pstamprequest (deleted)
-
pstamp/scripts/pstampstopfaulted (copied) (copied from trunk/pstamp/scripts/pstampstopfaulted )
-
pstamp/web/request.php (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20100823/ippTasks/pstamp.pro
- Property svn:mergeinfo changed
/trunk/ippTasks/pstamp.pro merged: 29329
r29145 r29333 16 16 $pstampRevDep_DB = 0 17 17 $pstampCleanup_DB = 0 18 $pstampStopFaulted_DB = 0 18 19 19 20 # set PS_DBSERVER if postage stamp database host is not the same as the value for DBSERVER in site.config … … 90 91 active false 91 92 end 92 task pstamp.job.revert93 active false94 end95 93 task pstamp.dependent.load 96 94 active false … … 108 106 active true 109 107 end 108 task pstamp.stopfaulted 109 active true 110 end 110 111 end 111 112 macro pstamp.revert.off … … 114 115 end 115 116 task pstamp.dependent.revert 117 active false 118 end 119 task pstamp.stopfaulted 116 120 active false 117 121 end … … 845 849 end 846 850 end 851 852 task pstamp.stopfaulted 853 host local 854 855 periods -poll $LOADPOLL 856 periods -exec 30 857 periods -timeout 300 858 npending 1 859 860 task.exec 861 stderr $LOGSUBDIR/pstamp.stopfaulted.log 862 stderr $LOGSUBDIR/pstamp.stopfaulted.log 863 $run = pstampstopfaulted 864 if ($DB:n == 0) 865 option DEFAULT 866 else 867 $run = $run $PS_DBSERVER -dbname $DB:$pstampStopFaulted_DB 868 $pstampStopFaulted_DB ++ 869 if ($pstampStopFaulted_DB >= $DB:n) set pstampStopFaulted_DB = 0 870 end 871 add_poll_args run 872 add_poll_labels run 873 command $run 874 end 875 876 task.exit $EXIT_SUCCESS 877 # nothing to do 878 end 879 880 task.exit default 881 showcommand failure 882 end 883 884 task.exit crash 885 showcommand crash 886 end 887 888 task.exit timeout 889 showcommand timeout 890 end 891 end - Property svn:mergeinfo changed
-
tags/ipp-20100823/ippTools
- Property svn:mergeinfo changed
/trunk/ippTools merged: 29321,29328
- Property svn:mergeinfo changed
-
tags/ipp-20100823/ippTools/share/pstamptool_revertdependent.sql
- Property svn:mergeinfo deleted
-
tags/ipp-20100823/ippTools/share/pstamptool_revertjob.sql
- Property svn:mergeinfo deleted
-
tags/ipp-20100823/ippTools/share/pstamptool_updatejob.sql
r27874 r29333 1 UPDATE pstampJob LEFT JOIN pstampDependent USING(dep_id) 1 UPDATE pstampJob 2 JOIN pstampRequest USING(req_id) 3 LEFT JOIN pstampDependent USING(dep_id) 2 4 SET -
tags/ipp-20100823/ippTools/share/pubtool_pending.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
tags/ipp-20100823/ippTools/share/pxadmin_create_tables.sql
- Property svn:mergeinfo changed
/trunk/ippTools/share/pxadmin_create_tables.sql merged: 29328
r29322 r29333 1441 1441 imagedb VARCHAR(64), 1442 1442 rlabel VARCHAR(64), 1443 need_magic TINYINT, 1443 1444 outdir VARCHAR(255), 1444 need_magic TINYINT, 1445 fault SMALLINT, 1446 fault_count INT, 1445 1447 PRIMARY KEY(dep_id), 1446 1448 KEY(state), 1447 1449 KEY(stage), 1448 KEY(stage_id) 1450 KEY(stage_id), 1451 KEY(fault) 1449 1452 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1450 1453 - Property svn:mergeinfo changed
-
tags/ipp-20100823/ippTools/src/pstamptool.c
- Property svn:mergeinfo deleted
r29307 r29333 883 883 PXOPT_LOOKUP_S64(req_id, config->args, "-req_id", false, false); 884 884 PXOPT_LOOKUP_S64(dep_id, config->args, "-dep_id", false, false); 885 886 if (!job_id && !req_id && !dep_id) { 887 psError(PS_ERR_UNKNOWN, true, "at least one of -job_id -req_id or -dep_id is required"); 885 PXOPT_LOOKUP_S32(fault_count, config->args, "-fault_count", false, false); 886 887 if (!job_id && !req_id && !dep_id && !fault_count) { 888 psError(PS_ERR_UNKNOWN, true, "at least one of -job_id -req_id -dep_id or -fault_count is required"); 888 889 return false; 889 890 } … … 904 905 PXOPT_COPY_S32(config->args, where, "-fault", "pstampJob.fault", "=="); 905 906 PXOPT_COPY_STR(config->args, where, "-state", "pstampJob.state", "=="); 907 PXOPT_COPY_S32(config->args, where, "-fault_count", "pstampJob.fault_count", ">="); 908 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "LIKE"); 906 909 907 910 psString query = pxDataGet("pstamptool_updatejob.sql"); … … 948 951 PXOPT_COPY_S64(config->args, where, "-dep_id", "dep_id", "=="); 949 952 PXOPT_COPY_S32(config->args, where, "-fault", "pstampDependent.fault", "=="); 953 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "LIKE"); 954 // if (fault_count) { 955 PXOPT_COPY_S32(config->args, where, "-fault_count", "pstampDependent.fault_count", ">="); 956 // } 950 957 951 958 // XXX: How about selecting by pstampRequest.label? No. That is too dangerous by itself. -
tags/ipp-20100823/ippTools/src/pstamptool.h
- Property svn:mergeinfo deleted
-
tags/ipp-20100823/ippTools/src/pstamptoolConfig.c
- Property svn:mergeinfo deleted
r29307 r29333 167 167 psMetadataAddStr(updatejobArgs, PS_LIST_TAIL, "-state", 0, "current state of jobs to update", 0); 168 168 psMetadataAddS16(updatejobArgs, PS_LIST_TAIL, "-fault", 0, "current value for job fault", 0); 169 psMetadataAddStr(updatejobArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by pstampJob label (LIKE comparision)", NULL); 170 psMetadataAddS32(updatejobArgs, PS_LIST_TAIL, "-fault_count", 0, "select by fault_count (>=)", 0); 169 171 psMetadataAddStr(updatejobArgs, PS_LIST_TAIL, "-set_state", 0, "new state", NULL); 170 172 psMetadataAddS16(updatejobArgs, PS_LIST_TAIL, "-set_fault", 0, "new result", 0); 173 psMetadataAddU64(updatejobArgs, PS_LIST_TAIL, "-limit", 0, "not used", 0); 171 174 172 175 // -stopdependentjob … … 176 179 psMetadataAddS64(stopdependentjobArgs, PS_LIST_TAIL, "-dep_id", 0, "dep_id of jobs to update", 0); 177 180 psMetadataAddS16(stopdependentjobArgs, PS_LIST_TAIL, "-fault", 0, "current value for dependent fault", 0); 181 psMetadataAddS32(stopdependentjobArgs, PS_LIST_TAIL, "-fault_count", 0, "select by fault_count (>=)", 0); 178 182 psMetadataAddS16(stopdependentjobArgs, PS_LIST_TAIL, "-set_fault", 0, "new fault value for job and dependent (required)", 0); 183 psMetadataAddStr(stopdependentjobArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by pstampJob label (LIKE comparision)", NULL); 184 psMetadataAddU64(stopdependentjobArgs, PS_LIST_TAIL, "-limit", 0, "not used", 0); 179 185 180 186 // -revertjob … … 187 193 psMetadataAddBool(revertjobArgs, PS_LIST_TAIL, "-clear_fault_count", 0, "clear job fault count", false); 188 194 psMetadataAddBool(revertjobArgs, PS_LIST_TAIL, "-all", 0, "revert all faulted jobs", false); 189 psMetadataAddU64(revertjobArgs, PS_LIST_TAIL, "-limit", 0, " limit result set to N items", 0);195 psMetadataAddU64(revertjobArgs, PS_LIST_TAIL, "-limit", 0, "not used", 0); 190 196 191 197 // -getdependent -
tags/ipp-20100823/ippTools/src/pubtool.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
tags/ipp-20100823/ippTools/src/stacktool.c
- Property svn:mergeinfo deleted
-
tags/ipp-20100823/ippTools/src/stacktoolConfig.c
- Property svn:mergeinfo deleted
-
tags/ipp-20100823/pstamp
- Property svn:mergeinfo set to
-
tags/ipp-20100823/pstamp/scripts/Makefile.am
r28038 r29333 19 19 pstamp_webrequest.pl \ 20 20 pstamp_get_image_job.pl \ 21 psmkreq \ 22 pstampstopfaulted \ 21 23 pstamp_checkdependent.pl \ 22 24 request_finish.pl \ -
tags/ipp-20100823/pstamp/scripts/detectability_respond.pl
r29131 r29333 644 644 $columns = [ 645 645 # matching rownum from detectability original request 646 { name => 'ROWNUM', type => ' V', writetype => TULONG },646 { name => 'ROWNUM', type => '20A', writetype => TULONG }, 647 647 # any errors that occurred during processing 648 648 { name => 'ERROR_CODE', type => 'V', writetype => TULONG }, -
tags/ipp-20100823/pstamp/scripts/pstamp_checkdependent.pl
- Property svn:mergeinfo deleted
-
tags/ipp-20100823/pstamp/scripts/pstamp_finish.pl
r28229 r29333 191 191 my $filter = $job_params->{filter}; 192 192 $filter = "0" if !$filter; 193 $exp_info = "0|0|0|$filter|0|0"; 193 my $mjd_obs = $job_params->{mjd_obs}; 194 $mjd_obs = "0" if !$mjd_obs; 195 $exp_info = "$mjd_obs|0|0|$filter|0|0"; 194 196 } 195 197 … … 477 479 my $ticks = timegm($sec, $min, $hr, $day, $mon-1, $year-1900); 478 480 481 # dateobs is UTC convert to TAI 482 # XXX: Do this properly 483 if ($year >= 2009) { 484 $ticks += 34; 485 } else { 486 $ticks += 33; 487 } 488 479 489 return 40587.0 + ($ticks/86400.); 480 490 } -
tags/ipp-20100823/pstamp/scripts/pstamp_insert_request.pl
r28106 r29333 44 44 45 45 my $pstamptool = can_run('pstamptool') or (warn "Can't find pstamptool" and $missing_tools = 1); 46 my $ pstampdump = can_run('pstampdump') or (warn "Can't find pstampdump" and $missing_tools = 1);46 my $fields = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1); 47 47 48 48 if ($missing_tools) { … … 53 53 my ($extname, $extver, $req_name); 54 54 { 55 my $command = "$pstampdump -headeronly $tmp_req_file"; 55 # get the header keywords of interest. 56 # Note that if it's a pstamp request then REQ_NAME should be defined. 57 # if it's a detectability query it will not have a REQ_NAME but will have a QUERY_ID 58 my $command = "echo $tmp_req_file | $fields -x 0 EXTNAME EXTVER REQ_NAME QUERY_ID"; 56 59 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 57 60 run(command => $command, verbose => $verbose); 61 if (0) { 62 # stoopid fields doesn't set exit status to zero when it works 58 63 unless ($success) { 59 64 print STDERR @$stderr_buf; 60 65 exit $error_code >> 8; 61 66 } 67 } 62 68 my $output = join "", @$stdout_buf; 63 ( $extname, $extver, $req_name) = split " ", $output;64 if ( $extname and ($extname ne "PS1_PS_REQUEST")) {69 (undef, $extname, $extver, $req_name) = split " ", $output; 70 if (!$extname or ! (($extname eq "PS1_PS_REQUEST") or ($extname eq "MOPS_DETECTABILITY_QUERY"))) { 65 71 print STDERR "invalid request file\n"; 66 72 exit $PS_EXIT_DATA_ERROR; 67 73 } 68 74 if (!defined $req_name) { 69 print STDERR "invalid request file no REQ_NAME \n";75 print STDERR "invalid request file no REQ_NAME or QUERY_ID\n"; 70 76 exit $PS_EXIT_DATA_ERROR; 71 77 } … … 91 97 my $req_id = 0; 92 98 { 93 94 my $command = "$pstamptool -addreq -name $req_name -uri $req_file -ds_id 0"; 99 my $command = "$pstamptool -addreq -uri $req_file -ds_id 0 -name $req_name"; 95 100 $command .= " -dbname $dbname" if $dbname; 96 101 $command .= " -dbserver $dbserver" if $dbserver; -
tags/ipp-20100823/pstamp/scripts/pstamp_server_status
r27211 r29333 16 16 17 17 my ($rundir, $verbose, $save_temps); 18 my $br = '<br />'; 18 19 19 20 GetOptions( … … 99 100 print "Pantasks Scheduler $scheduler_state.\n"; 100 101 if ($controller_state) { 101 print "Pantasks Controller $controller_state.\n";102 print $br . "Pantasks Controller $controller_state.\n"; 102 103 } else { 103 104 print STDERR "Controller state not found"; 104 105 exit 1; 105 106 } 106 print " \n";107 print "$br$br\n"; 107 108 } else { 108 109 print STDERR "Scheduler state not found"; … … 116 117 117 118 if ($request_run) { 118 print "<b >Parser Status:</b> $request_run->{nrun} running. $request_run->{ngood} parsed successfully. $request_run->{nfail} failed to parse.";119 print "<br /><b>Parser Status:</b> $request_run->{nrun} running. $request_run->{ngood} parsed successfully. $request_run->{nfail} failed to parse."; 119 120 if ($request_fin) { 120 121 print " $request_fin->{ngood} Requests finished."; … … 125 126 print "\n"; 126 127 if ($job_run) { 127 print "<b >Job Status:</b> $job_run->{nrun} running. $job_run->{ngood} completed successfully. $job_run->{nfail} failed";128 print " \n";128 print "<br /><b>Job Status:</b> $job_run->{nrun} running. $job_run->{ngood} completed successfully. $job_run->{nfail} failed"; 129 print "<br />\n"; 129 130 } else { 130 print "Task pstamp.job.run not found. \n";131 print "Task pstamp.job.run not found.<br />\n"; 131 132 } 133 print "<br /><b>Unfinished Requests</b><br />\n"; 134 print "<pre>\n"; 135 system "/home/panstarrs/bills/ipp/tools/psstatus -r "; 136 print "</pre>\n"; 137 print "<br /><b>Requests completed in last 24 hours (most recently completed first)</b><br />\n"; 138 print "<pre>\n"; 139 # finished requests 140 system "/home/panstarrs/bills/ipp/tools/psstatus -f"; 141 print "</pre>\n"; 132 142 } else { 133 143 print "Task pstamp.request.run not found.\n"; … … 135 145 136 146 147 148 137 149 exit 0; -
tags/ipp-20100823/pstamp/scripts/pstamp_webrequest.pl
r28106 r29333 4 4 # pstampwebrequest.pl: take a postage stamp request command line and process it 5 5 # 6 # The arguments are the command line parameters for the program ps tamprequest6 # The arguments are the command line parameters for the program psmkreq 7 7 # 8 8 # Unless the argument -list is provided the output is the request id for the resulting request … … 33 33 'dbname=s' => \$dbname, 34 34 'dbserver=s' => \$dbserver, 35 'project=s' => \$project,35 # 'project=s' => \$project, 36 36 'verbose' => \$verbose, 37 37 ); … … 70 70 my $missing_tools; 71 71 72 my $ps tamprequest = can_run('pstamprequest') or (warn "Can't find pstamprequest" and $missing_tools = 1);72 my $psmkreq = can_run('psmkreq') or (warn "Can't find psmkreq" and $missing_tools = 1); 73 73 my $pstamptool = can_run('pstamptool') or (warn "Can't find pstamptool" and $missing_tools = 1); 74 74 my $pstampparse = can_run('pstampparse.pl') or (warn "Can't find pstampparse.pl" and $missing_tools = 1); 75 my $pstampparser_run = can_run('pstamp_parser_run.pl') or (warn "Can't find pstamp_parser_run.pl" and $missing_tools = 1);76 75 77 76 if ($missing_tools) { … … 96 95 my $request_file = "$datedir/$request_name.fits"; 97 96 { 98 my $command = "$pstamprequest -req_name $request_name -project $project $request_file @ARGV"; 99 $command .= " -$job_type" if $job_type; # default job_type is pstamp 97 my $command = "$psmkreq --req_name $request_name --output $request_file @ARGV"; 100 98 101 99 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 103 101 unless ($success) { 104 102 print STDERR @$stderr_buf; 105 die("Unable to perform ps tamprequest: $error_code");103 die("Unable to perform psmkreq: $error_code"); 106 104 } 107 105 } -
tags/ipp-20100823/pstamp/scripts/pstampparse.pl
r28878 r29333 806 806 my ($r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $component, $need_magic) = @_; 807 807 808 # XXX: The update process for warp and subsequent stages requires # destreaking to be performed 809 # because the -pending queries require the inputs to have magicked >= 0 810 # The case of stack-stack diffs not needing to be destreaked is taken care of in pstamp_checkdependent 811 $need_magic = 1 if $imagedb eq 'gpc1'; 808 if (($stage ne 'chip') and ($stage ne 'raw')) { 809 # XXX: The update process for warp and subsequent stages requires that destreaking to be performed 810 # because the -pending queries require the inputs to have magicked >= 0 811 # This is too conservative. For example stage is warp and the warp has never been destreaked we don't 812 # need magic either 813 # The case of stack-stack diffs not needing to be destreaked is taken care of in pstamp_checkdependent 814 # maybe we should put all of the smarts there and interpret the need_magic flag in the dependent as 815 # "The client needs to have magic performed" and let 816 # XXX: note the very nasty hard coding of gpc1 817 $need_magic = 1 if $imagedb eq 'gpc1'; 818 } 812 819 813 820 # chipRun's can be in full state if destreaking is necessary … … 900 907 $$r_newState = 'stop'; 901 908 $$r_fault = $PSTAMP_NOT_AVAILABLE; 902 } elsif ( !$image->{magicked}) {909 } elsif ($need_magic and !$image->{magicked}) { 903 910 $$r_newState = 'stop'; 904 911 $$r_fault = $PSTAMP_NOT_DESTREAKED; -
tags/ipp-20100823/pstamp/web/request.php
r25322 r29333 16 16 // XXX This is just a prototype for testing purposes. 17 17 18 19 // XXX: change to include pstampconfig.php 20 21 // BEGIN Local configuration 22 23 $WORKDIR = "/data/ipp049.0/pstamp/work"; 24 $dsroot = "/data/ipp049.0/datastore/dsroot"; 25 $dbname = "ippRequestServer"; 26 $dbserver = "ipp049"; 27 28 $PSCONFDIR = "/data/ipp053.0/home/bills/psconfig"; 29 $PSCONFIG = "debug"; 30 $PSBINDIR = "$PSCONFDIR/$PSCONFIG.lin64/bin"; 31 32 // END Local configuration 18 require "pstamp.php"; 19 require "submitted.php"; 33 20 34 21 # this script sets up the environment to run IPP commands with current directory … … 55 42 $diff_checked = ""; 56 43 $list_checked = ""; 44 $getstatus_checked = ""; 57 45 $pstamp_checked = ""; 58 46 $get_checked = ""; … … 102 90 if ($rvar_project == "gpc1") { 103 91 $gpc1_selected = "selected"; 104 $require_class_id = 1;92 // $require_class_id = 1; 105 93 } else if ($rvar_project == "megacam-mops") { 106 94 $mops_selected = "selected"; … … 122 110 $diff_checked = "CHECKED"; 123 111 } else { 124 // nothing checked default to By Exposure125 $ exp_checked = "CHECKED";112 // nothing checked default to By ID 113 $file_checked = "CHECKED"; 126 114 } 127 115 … … 140 128 141 129 // is the center is specified in Pixels or sky coordinates 142 if ($rvar_center_type == "Sky") { 130 if ($rvar_center_type == "Pixels") { 131 $sky_checked=""; 132 $pix_checked="checked"; 133 } else { 143 134 $sky_checked="checked"; 144 135 $pix_checked=""; 145 } else {146 $sky_checked="";147 $pix_checked="checked";148 136 } 149 137 … … 168 156 } 169 157 158 $getstatus_checked = ""; 159 $pstamp_checked = ""; 160 $list_checked = ""; 161 $get_checked = ""; 170 162 if ($rvar_cmd_mode == "Make Stamps") { 171 163 $pstamp_checked = "checked"; 172 $list_checked = "";173 $get_checked = "";174 164 } else if ($rvar_cmd_mode == "Get Images") { 175 165 $get_checked = "checked"; 176 $list_checked = ""; 177 $ pstamp_checked = "";166 } else if ($rvar_cmd_mode == "Get Status") { 167 $getstatus_checked = "checked"; 178 168 } else { 179 $list_checked = "checked"; 180 $get_checked = ""; 181 $pstamp_checked = ""; 169 // default 170 $pstamp_checked = "checked"; 182 171 } 183 172 … … 188 177 189 178 // How do we know whether or not this is the intial page load or not? 190 // Well, in that case rvar_img_type is not set so key off of that179 // Well, the first time rvar_img_type is not set. So we key off of that. 191 180 // TODO: find a better way to decide whether or not to run commands 192 181 193 182 if ($rvar_img_type) { 194 195 183 $jobFinished = 0; 196 if ( $request_id == 0) {184 if (! $getstatus_checked) { 197 185 try { 198 186 $command_line = build_request_cmd(); … … 201 189 if (! $list_checked) { 202 190 // The only output from a successful run is the request_id 191 $request_name = trim(Array_pop($output_array)); 203 192 $request_id = Array_pop($output_array); 204 193 $last_request_id = $request_id; 205 setcookie("our_request_id", $request_id); 206 // echo "The request id is $request_id\n"; 207 if (count($output_array) != 0) { 208 throw new Exception("unexpected output returned by pstampwebrequest."); 194 if ($request_id && $request_name) { 195 addRequest($request_id, $request_name); 196 // setcookie("our_request_id", $request_id); 197 // echo "The request id is $request_id\n"; 198 $getstatus_checked = "checked"; 199 $pstamp_checked = ""; 200 } else { 201 // XXX: TODO print out the error 202 if (count($output_array) != 0) { 203 throw new Exception("unexpected output returned by pstampwebrequest."); 204 } 209 205 } 210 211 $jobRunning = getRequestStatus();212 if (!$jobRunning) {213 // echo "1 getRequestStatus reuturned 0\n";214 $jobFinished = 1;215 $request_id = 0;216 }217 218 206 } else { 219 207 $last_request_id = 0; … … 222 210 $error_line = $e->getMessage(); 223 211 } 224 } else { 225 try { 226 // get the list of jobs for the request 227 // echo "calling getRequestStatus\n"; 228 $jobRunning = getRequestStatus(); 229 230 if (!$jobRunning) { 231 // echo "2 getRequestStatus reuturned 0\n"; 232 $jobFinished = 1; 233 $request_id = 0; 234 } 235 236 } catch (Exception $e) { 237 echo "Got Exception $request_id $e\n"; 238 $error_line = $e->getMessage(); 239 } 240 } 241 if ($last_request_id) { 242 // This doesn't work for get_image 243 listJobs($last_request_id, $jobFinished); 244 } 245 } 212 } 213 } 214 215 // This is the end of the Logic 246 216 247 217 function build_request_cmd() … … 296 266 throw new Exception('RA and DEC must be specified.'); 297 267 } 298 $cmd .= " - skycenter $rvar_RA$rvar_DEC";268 $cmd .= " --ra $rvar_RA --dec $rvar_DEC"; 299 269 } else { 300 270 if (! $rvar_X || ! $rvar_Y) { 301 271 throw new Exception('X and Y must be specified.'); 302 272 } 303 $cmd .= " -pixcenter $rvar_X$rvar_Y";273 $cmd .= " -pixcenter --x $rvar_X --y $rvar_Y"; 304 274 } 305 275 … … 308 278 throw new Exception('dRA and dDEC must be specified.'); 309 279 } 310 $cmd .= " - arcrange $rvar_dRA$rvar_dDEC";280 $cmd .= " --arcseconds --width $rvar_dRA --height $rvar_dDEC"; 311 281 } else { 312 282 if (! $rvar_W || ! $rvar_H) { 313 283 throw new Exception('width and height must be specified.'); 314 284 } 315 $cmd .= " - pixrange $rvar_W$rvar_H";285 $cmd .= " --width $rvar_W --height $rvar_H"; 316 286 } 317 287 } … … 324 294 325 295 if ($exp_checked) { 296 if ($rvar_img_type == "stack") { 297 throw new Exception('Lookup by exposure name not supported for stack images.'); 298 } 326 299 if (! $rvar_id ) { 327 300 throw new Exception('Must set ID to the Exposure ID.'); 328 301 } 329 $cmd .= " - byexp $rvar_img_type$rvar_id";302 $cmd .= " --req_type byexp --stage $rvar_img_type --id $rvar_id"; 330 303 } else if ($file_checked) { 331 304 if (! $rvar_id ) { 332 305 throw new Exception('Must set ID to the exposure name.'); 333 306 } 334 $cmd .= " - byid $rvar_img_type$rvar_id";307 $cmd .= " --req_type byid --stage $rvar_img_type --id $rvar_id"; 335 308 } else if ($coord_checked) { 336 // $cmd .= " -bycoord $rvar_img_type"; 337 $coord_checked = ""; 338 $exp_checked = "checked"; 339 throw new Exception("Image selection by coordinate not implemented yet."); 309 $cmd .= " --req_type bycoord --stage $rvar_img_type"; 310 $coord_checked = "checked"; 311 // throw new Exception("Image selection by coordinate not implemented yet."); 340 312 } else if ($diff_checked) { 341 313 if (! $rvar_id ) { 342 314 throw new Exception('Must set ID to Diff Image ID.'); 343 315 } 344 $cmd .= " - bydiff $rvar_img_type$rvar_id";345 } 346 347 if (($rvar_img_type == "raw") || ($rvar_img_type == "chip")) { 348 if ($require_class_id && ! $rvar_class_id) {349 throw new Exception("must specify Class ID with Image Type $rvar_img_type."); 350 } 351 if ((!$rvar_class_id) || ($rvar_class_id == "all")) { 352 $cmd .= " null";353 } else{354 $cmd .= " $rvar_class_id";355 } 356 }316 $cmd .= " --req_type bydiff --stage $rvar_img_type --id $rvar_id"; 317 } 318 319 // XXX: don't need to require class_id anymore 320 // if (($rvar_img_type == "raw") || ($rvar_img_type == "chip")) { 321 // if (!$sky_checked && ($require_class_id && ! $rvar_class_id )) { 322 // throw new Exception("must specify Class ID with Image Type $rvar_img_type."); 323 // } 324 // leave off compoennt if we're looking up by coordinates. It breaks it 325 if (!$coord_checked && (($rvar_class_id) && ($rvar_class_id != "all"))) { 326 $cmd .= " --component $rvar_class_id"; 327 } 328 // } 357 329 358 330 return escapeshellcmd($cmd); … … 390 362 } 391 363 364 // This is no longer used 392 365 function printURL($line) 393 366 { … … 442 415 echo "</td></tr>"; 443 416 } 444 445 function countRunningJobs()446 {447 global $output_array;448 449 $runningJobs = 0;450 $size = sizeof($output_array);451 for ($i = 0; $i < $size; $i++) {452 $elements = explode(" ", $output_array[$i]);453 if (count($elements) == 3) {454 $state = $elements[1];455 if ($state != "stop") {456 $runningJobs++;457 }458 } else {459 throw new Exception ("incorrect data in job status: $output_array[$i]");460 }461 }462 return $runningJobs;463 }464 465 function listJobs($request_id, $jobFinished)466 {467 global $WORKDIR;468 global $SCRIPT;469 470 $command_line = "$SCRIPT pstamp_listjobs.pl $request_id";471 global $dbname;472 global $dbserver;473 if ($dbname) {474 $command_line .= " --dbname $dbname --dbserver $dbserver";475 }476 477 run_command($command_line);478 if ($jobFinished) {479 global $outFileset;480 global $dsroot;481 $parse_error = "$WORKDIR/$request_id/parse_error.txt";482 #echo "reading $parse_error\n";483 // readfile( $parse_error );484 if (file_exists($parse_error)) {485 $fhandle = fopen($parse_error, "r");486 if ($fhandle) {487 $contents = fread($fhandle, 1024);488 if ($contents) {489 global $last_request_id;490 global $error_line;491 $error_line = "Request $last_request_id: $contents\n";492 }493 }494 }495 }496 }497 498 function getRequestStatus()499 {500 global $request_id;501 global $command_status;502 global $output_array;503 global $outFileset;504 global $dbname;505 global $dbserver;506 global $SCRIPT;507 508 $command_line = "$SCRIPT pstamptool -listreq -req_id $request_id -simple";509 if ($dbname) {510 $command_line .= " -dbname $dbname -dbserver $dbserver";511 }512 // echo "Running $command_line\n";513 514 run_command($command_line);515 if ($command_status == 0) {516 $size = sizeof($output_array);517 $runningReq = 0;518 for ($i = 0; $i < $size; $i++) {519 $elements = explode(" ", $output_array[$i]);520 if (count($elements) >= 4) {521 $state = $elements[2];522 $outFileset = $elements[4];523 if ($state != "stop") {524 $runningReq++;525 }526 } else {527 throw new Exception ("incorrect data in job status: $output_array[$i]");528 }529 }530 return $runningReq;531 } else {532 return 0;533 }534 }535 536 417 ?> 537 418 538 <!-- Beginning of the HTML --------------------------------------------- --> 419 <!----------------------Beginning of the HTML --------------------------------------------- --> 420 539 421 <html> 540 <head> 541 <title>Postage Stamp Request Form</title> 542 <?php 543 if ($request_id != 0) { 544 // This doesn't do what I want. It does a get not a post 545 546 // echo '<META HTTP-EQUIV="refresh" CONTENT="5">'; 547 548 } 549 ?> 550 </head> 422 <head> 423 <title> 424 Postage Stamp Request Form (prototype) 425 </title> 426 </head> 427 <body> 428 429 <H1 align=center> 430 Postage Stamp Request Form 431 </h1> 432 433 <?php 434 welcomeHeader($auth_user, "pstamp_links.php", "Postage Stamp Home"); 435 ?> 436 551 437 <form method="post"> 552 553 <body>554 555 <H1 align=center>556 Postage Stamp Request557 </h1>558 559 438 <!-- Whole page is a single column table --> 560 439 … … 586 465 <td> 587 466 <b>Select Images By:</b> 467 <input type=radio name="select_by" value="db_id" <?php echo $file_checked; ?> >Database ID 468 588 469 <input type=radio name="select_by" value="exposure_id" <?php echo $exp_checked; ?> >Exposure Name 589 470 590 <input type=radio name="select_by" value="db_id" <?php echo $file_checked; ?> >Database ID 591 471 592 472 <input type=radio name="select_by" value="coord" <?php echo $coord_checked; ?> >Coordinates 593 473 … … 625 505 echo "Chip ID:"; 626 506 } else { 627 echo "C lass ID:";507 echo "Component:"; 628 508 } 629 509 ?> … … 685 565 686 566 <input type="text" name="dRA" size=10 value= <?php echo $rvar_dRA; ?> > 567 " 687 568 </td> 688 569 <td> … … 691 572 692 573 <input type="text" name="dDEC" size=10 value="<?php echo $rvar_dDEC;?>" > 574 " 693 575 </td> 694 576 </tr> … … 742 624 <tr> 743 625 744 <?php745 if ($request_id == 0): ?>746 626 <td><input type=submit value="Submit"></td> 747 627 <td><b>Mode:</b> 628 <input type=radio name="cmd_mode" value="Get Status"<?php echo $getstatus_checked; ?> >Get Status 748 629 <input type=radio name="cmd_mode" value="Make Stamps"<?php echo $pstamp_checked; ?> >Make Stamps 749 <input type=radio name="cmd_mode" value="Get Images" <?php echo $get_checked; ?> >Get Images 630 <input type=radio name="cmd_mode" value="Get Images" <?php echo $get_checked; ?> >Get Bundles 631 <!-- 750 632 <input type=radio name="cmd_mode" value="List Images" <?php echo $list_checked; ?> >List Images 633 --> 751 634 </td> 752 <?php753 else: ?>754 <td><input type=submit value="Check Status"></td>755 <!--- <td><input type=submit value="Cancel"></td> --->756 635 <?php 757 echo "<td><b>Request Id: $request_id";758 endif;?>636 // echo "<td><b>Request Id: $request_id"; 637 ?> 759 638 760 639 </tr> … … 766 645 767 646 <tr> 647 <!--- Don't show the command 768 648 <td> 769 649 <b>Command:</b> <?php echo "$command_line\n";?> 650 </td> 651 ---> 652 653 </tr> 654 <tr> 655 <td> 656 <b>Last Command</b> 770 657 </td> 771 658 </tr> … … 794 681 <td> 795 682 <table align=center width=100% rules=none> 796 <caption height=10 valign=center><b>Results</b></caption> 797 683 <caption height=10 valign=center><b>Request Results</b></caption> 798 684 799 685 <?php 686 if (0) { 687 // This is the old way of listing the status of the current request. 688 // now we save the submitted requests in the session see listRequests() below 689 800 690 $size = sizeof($output_array); 801 691 // echo "<pre>size of output array is $size\n</pre>"; … … 818 708 } 819 709 } 710 } // end if if(0) 820 711 ?> 821 712 </table> … … 845 736 </table> 846 737 738 <?php 739 listRequests("http://datastore.ipp.ifa.hawaii.edu/pstampresults", "pstamp_results_fileset"); 740 ?> 741 847 742 <!-- The end --> 848 743 … … 861 756 ?> 862 757 758 </form> 863 759 </body> 864 </form>865 866 760 </html>
Note:
See TracChangeset
for help on using the changeset viewer.
