Changeset 33126
- Timestamp:
- Jan 20, 2012, 5:42:08 PM (14 years ago)
- Location:
- trunk/pstamp/scripts
- Files:
-
- 4 edited
-
detectability_respond.pl (modified) (1 diff)
-
dqueryparse.pl (modified) (2 diffs)
-
pstamp_job_run.pl (modified) (3 diffs)
-
pstamp_parser_run.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/detectability_respond.pl
r29616 r33126 332 332 } 333 333 print WISDOM "\n"; 334 my $data_state = $query{$fpa_id}{DATA_STATE}[$i]; 334 335 if ($query{$fpa_id}{BAD_COMPONENT}[$i] == 0) { 335 @{ $update_request{$query{$fpa_id}{IMAGE}[$i]}{$query{$fpa_id}{FAULT}[$i]} } = 336 ($query{$fpa_id}{STATE}[$i],$query{$fpa_id}{STAGE}[$i],$query{$fpa_id}{STAGE_ID}[$i], 337 $query{$fpa_id}{COMPONENT_ID}[$i],$query{$fpa_id}{NEED_MAGIC}[$i],$query{$fpa_id}{IMAGE_DB}[$i]); 336 if ($data_state ne 'full') { 337 338 @{ $update_request{$query{$fpa_id}{IMAGE}[$i]}{$query{$fpa_id}{FAULT}[$i]} } = 339 ($query{$fpa_id}{STATE}[$i],$query{$fpa_id}{STAGE}[$i],$query{$fpa_id}{STAGE_ID}[$i], 340 $query{$fpa_id}{COMPONENT_ID}[$i],$query{$fpa_id}{NEED_MAGIC}[$i],$query{$fpa_id}{IMAGE_DB}[$i]); 341 } 338 342 push @{ $processing_request{$fpa_id}{$query{$fpa_id}{IMAGE}[$i]} }, $i; 339 343 } -
trunk/pstamp/scripts/dqueryparse.pl
r28818 r33126 115 115 my $response_file = "$outdir/${req_name}.dresponse.${req_id}.fits"; 116 116 my $fault; 117 my $data_to_update = '';117 # my $data_to_update = ''; 118 118 { 119 119 my $command = "$detectresponse --input $req_file --output $response_file --workdir $outdir"; 120 120 $command .= " --save-temps" if $save_temps; 121 121 $command .= " --verbose" if $verbose; 122 $command .= " --ignore-wisdom" if !$job_id; 122 123 123 124 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 137 138 138 139 my $result; 139 # If we returned correctly with a valid response file, get a job ID 140 # for the completed work, and move the response to a standardized name. 141 if ($fault == 0) { 142 my $command = "$pstamptool -addjob -req_id $req_id -outputBase $outdir"; 143 $command .= " -job_type detect_query -state stop -fault 0"; 144 $command .= " -rownum 1"; 145 146 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 147 run(command => $command, verbose => $verbose); 148 if ($success) { 149 $job_id = join "", @$stdout_buf; 150 chomp $job_id; 151 if ($job_id && -e $response_file) { 152 rename $response_file, "$outdir/response${job_id}.fits"; 140 unless ($job_id) { 141 # If we returned correctly with a valid response file, get a job ID 142 # for the completed work, and move the response to a standardized name. 143 if ($fault == 0) { 144 my $command = "$pstamptool -addjob -req_id $req_id -outputBase $outdir"; 145 $command .= " -job_type detect_query -state stop -fault 0"; 146 $command .= " -rownum 1"; 147 148 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 149 run(command => $command, verbose => $verbose); 150 if ($success) { 151 $job_id = join "", @$stdout_buf; 152 chomp $job_id; 153 if ($job_id && -e $response_file) { 154 rename $response_file, "$outdir/response${job_id}.fits"; 155 } 156 $result = 0; 157 } else { 158 warn("Unable to perform $command error code: $error_code"); 159 $result = $error_code >> 8; 153 160 } 154 $result = 0; 155 } else { 156 warn("Unable to perform $command error code: $error_code"); 157 $result = $error_code >> 8; 158 } 159 } 160 elsif ($fault == $PSTAMP_NOT_AVAILABLE) { 161 # Failed to run correctly, which means that we need to queue a job and flag data for updating. 162 # Get the dependency id for the data we're requesting be updated. 163 open(UPDATE_REQUEST,"$outdir/update_request.dat") || my_die ("Update request indicated, but unable to find actual request!", $PS_EXIT_PROG_ERROR); 164 while (<UPDATE_REQUEST>) { 165 my $data_to_update = $_; 166 chomp($data_to_update); 167 my $dep_id = queue_update_run($req_id,$job_id,$outdir,$label,$data_to_update); 168 169 # Link this request to a job and link that job to any dependency 170 my $command = "$pstamptool -addjob -req_id $req_id -outputBase $outdir"; 171 $command .= " -job_type detect_query -state run -fault 0"; 172 $command .= " -rownum 1"; 173 $command .= " -dep_id $dep_id" if $dep_id; 174 175 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 176 run(command => $command, verbose => $verbose); 177 178 if ($success) { 179 $job_id = join "", @$stdout_buf; 180 chomp $job_id; 181 if ($job_id && -e $response_file) { 182 # We shouldn't have a response file at this stage. 183 rename $response_file, "$outdir/response${job_id}.fits"; 184 } 185 $result = 0; 186 } else { 187 warn("Unable to perform $command error code: $error_code"); 188 $result = $error_code >> 8; 189 } 190 } 191 close(UPDATE_REQUEST); 192 } 193 else { 194 my_die ("Parse fault!!", $PS_EXIT_UNKNOWN_ERROR); 161 } 162 elsif ($fault == $PSTAMP_NOT_AVAILABLE) { 163 # Failed to run correctly, which means that we need to queue a job and flag data for updating. 164 # first create a parent job for the actual detectabilty query 165 my $command = "$pstamptool -addjob -req_id $req_id -outputBase $outdir/1_"; 166 $command .= " -job_type detect_query -state run -fault 0 -is_parent"; 167 $command .= " -rownum 1"; 168 169 my $parent_job_id; 170 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 171 run(command => $command, verbose => $verbose); 172 if ($success) { 173 # pstamptool returns the job_id of the new job 174 $parent_job_id = join "", @$stdout_buf; 175 chomp $parent_job_id; 176 if ($parent_job_id) { 177 $result = 0; 178 } else { 179 print STDERR "pstamptool did not return a valid job_id for parent job\n"; 180 $result = $PS_EXIT_UNKNOWN_ERROR; 181 } 182 } else { 183 warn("Unable to perform $command error code: $error_code"); 184 $result = $error_code >> 8; 185 } 186 # now create child jobs for each dependent. All these jobs do is finish once the dependency 187 # is satisfied 188 if (!$result) { 189 # Get the dependency id for the data we need to have updated. 190 my $job_num = 2; 191 open(UPDATE_REQUEST,"$outdir/update_request.dat") || my_die ("Update request indicated, but unable to find actual request!", $PS_EXIT_PROG_ERROR); 192 while (<UPDATE_REQUEST>) { 193 my $data_to_update = $_; 194 chomp($data_to_update); 195 my $dep_id = queue_update_run($req_id,$job_id,$outdir,$label,$data_to_update); 196 197 # Link this request to a job and link that job to the dependent 198 my $command = "$pstamptool -addjob -req_id $req_id -outputBase $outdir/${job_num}_"; 199 $command .= " -job_type child -state run -fault 0 -parent_id $parent_job_id"; 200 $command .= " -rownum 1"; # XXX: we should choose a correct rownum 201 $command .= " -dep_id $dep_id" if $dep_id; 202 203 $job_num++; 204 205 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 206 run(command => $command, verbose => $verbose); 207 208 if ($success) { 209 $job_id = join "", @$stdout_buf; 210 chomp $job_id; 211 $result = 0; 212 } else { 213 warn("Unable to perform $command error code: $error_code"); 214 $result = $error_code >> 8; 215 last; 216 } 217 } 218 close(UPDATE_REQUEST); 219 } 220 } 221 else { 222 my_die ("Parse fault!!", $fault); 223 } 224 } else { 225 # in some cases we will need to finish off the request 226 my_die ("Run fault!!", $fault); 195 227 } 196 228 -
trunk/pstamp/scripts/pstamp_job_run.pl
r33055 r33126 90 90 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 91 91 92 my $params = read_params_file($outputBase);93 92 94 93 my $jobStatus; 95 94 if ($jobType eq "stamp") { 95 my $params = read_params_file($outputBase); 96 96 97 97 my $argString; … … 283 283 284 284 my $pstamp_bundle_root = metadataLookupStr($ipprc->{_siteConfig}, "PSTAMP_BUNDLE_ROOT"); 285 286 my $params = read_params_file($outputBase); 285 287 my $imagedb = $params->{imagedb}; 286 288 … … 327 329 my_die("dqueryparse.pl failed with error code: $jobStatus", $job_id, $jobStatus); 328 330 } 331 } elsif ($jobType eq "child") { 332 # the only thing jobs of jobType child is to finish 333 $jobStatus = 0; 329 334 } else { 330 335 my_die("unknown jobType $jobType found", $job_id, $PS_EXIT_PROG_ERROR); -
trunk/pstamp/scripts/pstamp_parser_run.pl
r33014 r33126 294 294 carp($msg); 295 295 296 if (!$req_id) { 297 exit $PS_EXIT_CONFIG_ERROR; 298 } 299 296 300 my $command = "$pstamptool -updatereq -req_id $req_id -set_fault $fault"; 297 301 $command .= " -dbname $dbname" if $dbname;
Note:
See TracChangeset
for help on using the changeset viewer.
