Changeset 27795
- Timestamp:
- Apr 28, 2010, 2:18:01 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (1 diff)
-
ippTasks/pstamp.pro (modified) (1 diff)
-
ippTools/share/Makefile.am (modified) (2 diffs)
-
ippTools/share/pstamptool_getdependent.sql (added)
-
ippTools/share/pstamptool_pendingdependent.sql (modified) (1 diff)
-
ippTools/share/pstamptool_revertdependent.sql (modified) (1 diff)
-
ippTools/src/pstamptool.c (modified) (5 diffs)
-
ippTools/src/pstamptoolConfig.c (modified) (1 diff)
-
pstamp/scripts/pstamp_checkdependent.pl (modified) (6 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r27783 r27795 455 455 my $inverse = $option_mask & $PSTAMP_SELECT_INVERSE; 456 456 457 my $command = "$difftool -d iffskyfile -dbname $imagedb";457 my $command = "$difftool -dbname $imagedb"; 458 458 459 459 if ($byid) { 460 $command .= " - diff_id $id";460 $command .= " -listrun -diff_id $id"; 461 461 } else { 462 $command .= " -diff _skyfile_id $id";462 $command .= " -diffskyfile -diff_skyfile_id $id"; 463 463 } 464 464 $command .= " -skycell_id $skycell_id" if $skycell_id; 465 465 466 my $ images= runToolAndParse($command, $verbose);467 468 my $n = @$ images;466 my $output = runToolAndParse($command, $verbose); 467 468 my $n = @$output; 469 469 if (!$byid && ($n > 1)) { 470 470 die ("difftool returned an unexpected number of diffskyfiles: $n"); 471 471 } elsif ($n == 0) { 472 472 return undef; 473 } 474 475 my $images; 476 if ($byid) { 477 $images = selectComponents($ipprc, $imagedb, 'byid', 'diff', $rowList, $output, $verbose); 478 } else { 479 $images = $output; 473 480 } 474 481 -
trunk/ippTasks/pstamp.pro
r27751 r27795 524 524 525 525 periods -poll $LOADPOLL 526 # XXX: create a macro for this 527 periods -exec 30526 # XXX: create a macro for this time 527 periods -exec 10 528 528 # periods -exec $LOADEXEC 529 periods -timeout 30 529 periods -timeout 300 530 530 npending 1 531 531 -
trunk/ippTools/share/Makefile.am
r27777 r27795 114 114 difftool_pendingcleanupskyfile.sql \ 115 115 difftool_revertdiffskyfile_delete.sql \ 116 difftool_revertdiffskyfile_update.sql \ 116 difftool_revertdiffskyfile_updated.sql \ 117 difftool_setskyfiletoupdate.sql \ 117 118 difftool_skyfile.sql \ 118 119 difftool_todiffskyfile.sql \ … … 223 224 pstamptool_completedreq.sql \ 224 225 pstamptool_datastore.sql \ 226 pstamptool_getdependent.sql \ 225 227 pstamptool_listjob.sql \ 226 228 pstamptool_pendingdependent.sql \ -
trunk/ippTools/share/pstamptool_pendingdependent.sql
r27740 r27795 4 4 JOIN pstampRequest USING(req_id) 5 5 WHERE pstampDependent.state = 'new' 6 AND pstampDependent.fault = 0 6 7 AND pstampJob.state = 'run' 8 AND pstampRequest.state = 'run' -
trunk/ippTools/share/pstamptool_revertdependent.sql
r27740 r27795 3 3 JOIN pstampRequest USING(req_id) 4 4 SET pstampDependent.fault = 0 5 WHERE pstampDependent.state = 'new' -
trunk/ippTools/src/pstamptool.c
r27740 r27795 530 530 531 531 PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "=="); 532 PXOPT_COPY_S64(config->args, where, "-fault", " req_id", "==");532 PXOPT_COPY_S64(config->args, where, "-fault", "fault", "=="); 533 533 PXOPT_COPY_STR(config->args, where, "-state", "pstampRequest.state", "=="); 534 534 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "LIKE"); … … 967 967 PXOPT_LOOKUP_STR(component, config->args, "-component", true, false); 968 968 PXOPT_LOOKUP_STR(imagedb, config->args, "-imagedb", true, false); 969 PXOPT_LOOKUP_STR(rlabel, config->args, "-rlabel", false, false);969 PXOPT_LOOKUP_STR(rlabel, config->args, "-rlabel", true, false); 970 970 PXOPT_LOOKUP_BOOL(need_magic, config->args, "-need_magic", false); 971 971 PXOPT_LOOKUP_BOOL(no_create, config->args, "-no_create", false); … … 983 983 } 984 984 985 psString query = pxDataGet("pstamptool_ pendingdependent.sql");985 psString query = pxDataGet("pstamptool_getdependent.sql"); 986 986 if (!query) { 987 987 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 1186 1186 1187 1187 psMetadata *where = psMetadataAlloc(); 1188 PXOPT_COPY_S64(config->args, where, "-fault", " req_id", "==");1188 PXOPT_COPY_S64(config->args, where, "-fault", "pstampDependent.fault", "=="); 1189 1189 PXOPT_COPY_S64(config->args, where, "-dep_id", "dep_id", "=="); 1190 1190 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "=="); … … 1201 1201 } 1202 1202 1203 psString whereClause = psDBGenerateWhere SQL(where, NULL);1204 psStringAppend(&query, " %s", whereClause);1203 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1204 psStringAppend(&query, " AND %s", whereClause); 1205 1205 psFree(whereClause); 1206 1206 psFree(where); -
trunk/ippTools/src/pstamptoolConfig.c
r27740 r27795 177 177 psMetadata *revertdependentArgs = psMetadataAlloc(); 178 178 psMetadataAddS64(revertdependentArgs, PS_LIST_TAIL, "-dep_id", 0, "define id for dependent", 0); 179 psMetadataAddS16(revertdependentArgs, PS_LIST_TAIL, "-fault", 0, "new value for fault", 0); 179 psMetadataAddStr(revertdependentArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "define label for dependent ", NULL); 180 psMetadataAddS16(revertdependentArgs, PS_LIST_TAIL, "-fault", 0, "define fault", 0); 180 181 181 182 // -pendingdependent -
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.
