Changeset 27795 for trunk/pstamp/scripts
- Timestamp:
- Apr 28, 2010, 2:18:01 PM (16 years ago)
- Location:
- trunk/pstamp/scripts
- Files:
-
- 2 edited
-
pstamp_checkdependent.pl (modified) (6 diffs)
-
pstampparse.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_checkdependent.pl
r27751 r27795 270 270 271 271 if ($good_to_go) { 272 # the reason we defer setting the warp to update is so that we can handle error conditions at previous 273 # stages more easily. 272 274 my $command = "$warptool -setskyfiletoupdate -warp_id $warp_id -skycell_id $skycell->{skycell_id}"; 273 275 $command .= " -set_label $rlabel" if $rlabel; … … 341 343 my $skycell_id = $skycell->{skycell_id}; 342 344 343 # put this in a module somewhere345 # XXX: put this in a module somewhere 344 346 my $IPP_DIFF_MODE_WARP_WARP = 1; 345 347 my $IPP_DIFF_MODE_WARP_STACK = 2; … … 347 349 my $IPP_DIFF_MODE_STACK_STACK = 4; 348 350 if ($diff_mode == $IPP_DIFF_MODE_WARP_STACK ) { 349 # check the state of the stack351 # check the state of the template stack 350 352 my $command = "$stacktool -sumkskyfile -stack_id $skycell->{stack2}"; 351 353 my $stack = runToolAndParseExpectOne($command, $verbose); … … 361 363 # now check the warp 362 364 $command = "$warptool -warped -warp_id $skycell->{warp1} -skycell_id $skycell_id"; 363 my $warp = runToolAndExpectOne($command, $verbose); 364 my_die("failed to find warpSkyfile for warpRun $skycell->{warp_id} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) 365 if !$warp; 366 } 367 368 my $good_to_go = 1; 369 my @chipsToUpdate; 370 my $chip_id; 371 my $warp_id; 372 my $data ; #XXXX 373 foreach my $chip (@$data) { 374 $chip_id = $chip->{chip_id}; 375 if (($chip->{data_state} ne 'full') or ($need_magic and ($chip->{magicked} <= 0))) { 376 $good_to_go = 0; 377 push @chipsToUpdate, $chip; 378 } else { 379 # this chip is good to go 380 } 381 } 382 383 if ($good_to_go) { 384 my $command = "$warptool -setskyfiletoupdate -warp_id $warp_id -skycell_id $skycell->{skycell_id}"; 385 $command .= " -set_label $rlabel" if $rlabel; 386 387 if (!$no_update) { 388 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 389 run(command => $command, verbose => $verbose); 390 unless ($success) { 391 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); 365 my $warp = runToolAndParseExpectOne($command, $verbose); 366 my_die("failed to find warpSkyfile for warpRun $skycell->{warp_id} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp; 367 368 if ($warp->{data_state} ne 'full') { 369 return queue_update_warp($warp, 0, $rlabel, $need_magic); 370 } 371 # warps are ready fall through and queue the diff update 372 } elsif ($diff_mode eq $IPP_DIFF_MODE_WARP_WARP) { 373 my $command = "$warptool -warped -warp_id $skycell->{warp1} -skycell_id $skycell_id"; 374 my $warp1 = runToolAndParseExpectOne($command, $verbose); 375 my_die("failed to find warpSkyfile for warpRun $skycell->{warp_id} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp1; 376 377 if ($warp1->{data_state} ne 'full') { 378 my $status = queue_update_warp($warp1, 0, $rlabel, $need_magic); 379 if ($status) { 380 return $status; 392 381 } 393 } else { 394 print "skipping $command\n"; 395 } 396 } elsif (scalar @chipsToUpdate > 0) { 397 return queue_update_chip($chip_id, 0, \@chipsToUpdate, $rlabel, $need_magic); 398 } 399 } else { 400 my $warpRun = $metadata; 401 my $warp_id = $warpRun->{warp_id}; 402 my $command = "$chiptool -listrun -chip_id $warpRun->{chip_id}"; 403 my $data = runToolAndParse($command, $verbose); 404 my_die("failed to find chipRun $warpRun->{chip_id} for warpRun $warp_id", $PS_EXIT_UNKNOWN_ERROR) 405 if !$data or scalar @$data != 1; 406 407 my $chipRun = $data->[0]; 408 409 my $chipRunState = $chipRun->{state}; 410 if (($chipRunState =~ /purge/) or ($chipRunState =~ /scrub/)) { 411 print STDERR "warpRun $warp_id depends on chipRun $chipRun->{chip_id} which is in state $chipRunState\n"; 412 faultJobs('stop', 'warp', $warp_id, $PSTAMP_GONE); 413 return 0; 414 } 415 my $warpRunState = $warpRun->{state}; 416 if (($chipRunState eq 'full') and (! $need_magic or ($chipRun->{magicked} > 0)) and ($warpRunState eq 'cleaned')) { 417 # The inputs and outputs are ready. Queue the warpRun for update. 418 419 # providing no -skycell_id arguments changes all skyfiles with data_state = 'cleaned' to 'update' 420 my $command = "$warptool -setskyfiletoupdate -warp_id $warp_id"; 421 $command .= " -set_label $rlabel" if $rlabel; 422 423 if (!$no_update) { 424 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 425 run(command => $command, verbose => $verbose); 426 unless ($success) { 427 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); 428 } 429 } else { 430 print "skipping $command\n"; 431 } 432 } elsif ($chipRunState eq 'cleaned' or 433 (($chipRun->{state} eq 'full') and ($need_magic and ($chipRun->{magicked} < 0) and ($chipRun->{dsRun_state} ne 'new')))) { 434 my $data = [$chipRun]; 435 return queue_update_chip($chipRun->{chip_id}, 1, $data, $rlabel, $need_magic); 436 } 437 } 438 382 } 383 $command = "$warptool -warped -warp_id $skycell->{warp2} -skycell_id $skycell_id"; 384 my $warp2 = runToolAndParseExpectOne($command, $verbose); 385 my_die("failed to find warpSkyfile for warpRun $skycell->{warp_id} skycell_id $skycell_id", $PS_EXIT_UNKNOWN_ERROR) if !$warp2; 386 387 if ($warp2->{data_state} ne 'full') { 388 return queue_update_warp($warp2, 0, $rlabel, $need_magic); 389 } 390 # fall through to queue the diff update 391 } else { 392 # XXX: check stack stack 393 print STDERR "unexpected diff_mode found: $diff_mode\n"; 394 return $PS_EXIT_PROG_ERROR; 395 } 396 397 my $command = "$difftool -setskyfiletoupdate -diff_id $diff_id -skycell_id $skycell_id"; 398 $command .= " -set_label $rlabel" if $rlabel; 399 400 if (!$no_update) { 401 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 402 run(command => $command, verbose => $verbose); 403 unless ($success) { 404 my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR); 405 } 406 } else { 407 print "skipping $command\n"; 408 } 409 } else { 410 # XXX todo whole_run 411 return $PS_EXIT_PROG_ERROR; 412 } 439 413 # return value may be the return status of script so zero is good 440 414 return 0; … … 593 567 carp $msg; 594 568 595 my $command = "$pstamptool -updatedepe dent -fault $fault -dep_id $dep_id";569 my $command = "$pstamptool -updatedependent -fault $fault -dep_id $dep_id"; 596 570 $command .= " -dbname $dbname" if $dbname; 597 571 $command .= " -dbserver $dbserver" if $dbserver; … … 600 574 run(command => $command, verbose => $verbose); 601 575 unless ($success) { 602 my_die("failed to set pstampDependent.fault for dep_id: $dep_id", 603 $PS_EXIT_UNKNOWN_ERROR); 576 carp "$cmd failed"; 604 577 } 605 578 } else { -
trunk/pstamp/scripts/pstampparse.pl
r27783 r27795 536 536 # XXX: this code is repeated in queueGetImageJobs we should encapsulate it in a subroutine and share it 537 537 if ($stage ne 'raw') { 538 # not ready to handle diff update yet. May never support stack539 my $allow_wait_for_update = ( ($stage ne 'stack') and ($stage ne 'diff'));538 # updates for stack stage not supported yet 539 my $allow_wait_for_update = ($stage ne 'stack'); 540 540 my $run_state = $image->{state}; 541 541 my $data_state = $image->{data_state}; … … 548 548 $newState = 'stop'; 549 549 $fault = $PSTAMP_GONE; 550 } elsif ($allow_wait_for_update and 551 (($data_state ne 'full') or ($need_magic and ($image->{magicked} < 0)))) { 550 } elsif (($data_state ne 'full') or ($need_magic and ($image->{magicked} < 0))) { 552 551 if ($stage eq 'chip') { 553 552 my $burntool_state = $image->{burntool_state}; … … 556 555 $fault = $PSTAMP_NOT_AVAILABLE; 557 556 } 557 } 558 if (!$allow_wait_for_update) { 559 print STDERR "wait for update not supported for stage $stage yet\n"; 560 $newState = 'stop'; 561 $fault = $PSTAMP_NOT_AVAILABLE; 558 562 } 559 563 if (!$fault) {
Note:
See TracChangeset
for help on using the changeset viewer.
