Changeset 11789
- Timestamp:
- Feb 14, 2007, 2:16:55 PM (19 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
difftool.c (modified) (24 diffs)
-
difftoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/difftool.c
r11787 r11789 40 40 41 41 static bool setp5RunState(pxConfig *config, const char *p4_id, const char *state); 42 static bool isValidMode(pxConfig *config, const char *mode);43 42 44 43 # define MODECASE(caseName, func) \ … … 90 89 // required options 91 90 bool status = false; 92 psString mode = psMetadataLookupStr(&status, config->args, "-mode");93 if (!status) {94 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -survey_mode");95 return false;96 }97 if (!mode) {98 psError(PS_ERR_UNKNOWN, true, "-mode is required");99 return false;100 }101 // check mode102 if (mode && !isValidMode(config, mode)) {103 psError(PS_ERR_UNKNOWN, false, "invalud mode");104 return false;105 }106 107 91 psString workdir = psMetadataLookupStr(&status, config->args, "-workdir"); 108 92 if (!status) { … … 130 114 } 131 115 132 p 4RunRow *p4Run = p4RunRowAlloc(116 p5RunRow *run = p5RunRowAlloc( 133 117 0, // ID 134 mode,135 118 "reg", // state 136 119 workdir, … … 138 121 ); 139 122 psFree(registered); 140 if (! p4Run) {141 psError(PS_ERR_UNKNOWN, false, "failed to alloc p 4Run object");123 if (!run) { 124 psError(PS_ERR_UNKNOWN, false, "failed to alloc p5Run object"); 142 125 return true; 143 126 } 144 if (!p 4RunInsertObject(config->dbh, p4Run)) {127 if (!p5RunInsertObject(config->dbh, run)) { 145 128 psError(PS_ERR_UNKNOWN, false, "database error"); 146 psFree( p4Run);129 psFree(run); 147 130 return true; 148 131 } … … 154 137 if (!status) { 155 138 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 156 psFree( p4Run);157 return false; 158 } 159 } 160 161 if (!p 4RunPrintObject(stdout, p4Run, !simple)) {139 psFree(run); 140 return false; 141 } 142 } 143 144 if (!p5RunPrintObject(stdout, run, !simple)) { 162 145 psError(PS_ERR_UNKNOWN, false, "failed to print object"); 163 psFree( p4Run);164 return false; 165 } 166 167 psFree( p4Run);146 psFree(run); 147 return false; 148 } 149 150 psFree(run); 168 151 169 152 return true; … … 176 159 177 160 bool status = false; 178 psString p 4_id = psMetadataLookupStr(&status, config->args, "-p4_id");179 if (!status) { 180 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p 4t_id");181 return false; 182 } 183 if (!p 4_id) {184 psError(PS_ERR_UNKNOWN, true, "-p 4_id is required");161 psString p5_id = psMetadataLookupStr(&status, config->args, "-p5_id"); 162 if (!status) { 163 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p5_id"); 164 return false; 165 } 166 if (!p5_id) { 167 psError(PS_ERR_UNKNOWN, true, "-p5_id is required"); 185 168 return false; 186 169 } … … 198 181 if (state) { 199 182 // set detRun.state to state 200 return setp5RunState(config, p 4_id, state);183 return setp5RunState(config, p5_id, state); 201 184 } 202 185 … … 210 193 211 194 bool status = false; 195 psString p5_id = psMetadataLookupStr(&status, config->args, "-p5_id"); 196 if (!status) { 197 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p5_id"); 198 return false; 199 } 200 if (!p5_id) { 201 psError(PS_ERR_UNKNOWN, true, "-p5_id is required"); 202 return false; 203 } 204 212 205 psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id"); 213 206 if (!status) { … … 215 208 return false; 216 209 } 217 if (!p4_id) { 218 psError(PS_ERR_UNKNOWN, true, "-p4_id is required"); 219 return false; 220 } 221 210 if (!p5_id) { 211 psError(PS_ERR_UNKNOWN, true, "-p5_id is required"); 212 return false; 213 } 214 215 psString skycell_id = psMetadataLookupStr(&status, config->args, "-skycell_id"); 216 if (!status) { 217 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -skycell_id"); 218 return false; 219 } 220 if (!skycell_id) { 221 psError(PS_ERR_UNKNOWN, true, "-skycell_id is required"); 222 return false; 223 } 224 225 psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id"); 226 if (!status) { 227 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id"); 228 return false; 229 } 230 if (!tess_id) { 231 psError(PS_ERR_UNKNOWN, true, "-tess_id is required"); 232 return false; 233 } 222 234 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 223 235 if (!status) { … … 237 249 } 238 250 251 psString kind = psMetadataLookupStr(&status, config->args, "-kind"); 252 if (!status) { 253 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -kind"); 254 return false; 255 } 256 239 257 // defaults to false 240 bool magiced = psMetadataLookupBool(&status, config->args, "-p3_version");241 if (!status) { 242 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for - p3_version");258 bool template = psMetadataLookupBool(&status, config->args, "-template"); 259 if (!status) { 260 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -template"); 243 261 return false; 244 262 } … … 247 265 // XXX instead of validiting it here we should just use forgein key 248 266 // constrants 249 if (!p4InputExpInsert(config->dbh, 267 if (!p5InputScfileInsert(config->dbh, 268 (psS32)atoi(p5_id), 250 269 (psS32)atoi(p4_id), 270 skycell_id, 271 tess_id, 251 272 exp_tag, 252 273 p3_version, 253 magiced 274 kind, 275 template 254 276 )) { 255 277 psError(PS_ERR_UNKNOWN, false, "database error"); … … 275 297 psString query = psStringCopy( 276 298 "SELECT\n" 277 " p3ProcessedExp.*\n" 278 " FROM p4Run\n" 279 " JOIN p4InputExp\n" 280 " USING(p4_id)\n" 281 " JOIN p3ProcessedExp\n" 282 " ON p4InputExp.exp_tag = p3ProcessedExp.exp_tag\n" 283 " AND p4InputExp.p3_version = p3ProcessedExp.p3_version\n" 299 " p4Scfile.*\n" 300 " FROM p5Run\n" 301 " JOIN p5InputScfile\n" 302 " USING(p5_id)\n" 303 " JOIN p4Scfile\n" 304 " ON p5InputScile.p4_id = p4Scfile.p4_id\n" 305 " ON p5InputScile.skycell_id = p4Scfile.skycell_id\n" 306 " ON p5InputScile.tess_id = p4Scfile.tess_id\n" 307 " ON p5InputScile.exp_tag = p4Scfile.exp_tag\n" 308 " ON p5InputScile.p3_version = p4Scfile.p3_versiong\n" 284 309 " WHERE\n" 285 " p4Run.state = 'run'\n" 286 " AND p3ProcessedExp.fault = 0\n" 310 " p5Run.state = 'run'\n" 287 311 ); 288 312 289 313 if (config->where) { 290 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p 4InputExp");314 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p5InputScfile"); 291 315 psStringAppend(&query, " AND %s", whereClause); 292 316 psFree(whereClause); … … 322 346 } 323 347 if (!psArrayLength(output)) { 324 psError(PS_ERR_UNKNOWN, false, "no p ending rawImfile rows found");348 psError(PS_ERR_UNKNOWN, false, "no p5InputScfile rows found"); 325 349 psFree(output); 326 350 return true; … … 339 363 if (psArrayLength(output)) { 340 364 // negative simple so the default is true 341 if (!ippdbPrintMetadatas(stdout, output, "p 4InputExp", !simple)) {365 if (!ippdbPrintMetadatas(stdout, output, "p5InputScfile", !simple)) { 342 366 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 343 367 psFree(output); … … 366 390 psString query = psStringCopy( 367 391 "SELECT\n" 368 " p3ProcessedExp.*\n" 369 " FROM p4Run\n" 370 " JOIN p4InputExp\n" 371 " USING(p4_id)\n" 372 " JOIN p3ProcessedExp\n" 373 " ON p4InputExp.exp_tag = p3ProcessedExp.exp_tag\n" 374 " AND p4InputExp.p3_version = p3ProcessedExp.p3_version\n" 375 " LEFT JOIN p4SkyCellMap\n" 376 " ON p4InputExp.p4_id = p4SkyCellMap.p4_id\n" 377 " AND p4InputExp.exp_tag = p4SkyCellMap.exp_tag\n" 378 " AND p4InputExp.p3_version = p4SkyCellMap.p3_version\n" 392 " p4Scfile.*\n" 393 " FROM p5Run\n" 394 " JOIN p5InputScfile\n" 395 " USING(p5_id)\n" 396 " JOIN p4Scfile\n" 397 " ON p5InputScile.p4_id = p4Scfile.p4_id\n" 398 " ON p5InputScile.skycell_id = p4Scfile.skycell_id\n" 399 " ON p5InputScile.tess_id = p4Scfile.tess_id\n" 400 " ON p5InputScile.exp_tag = p4Scfile.exp_tag\n" 401 " ON p5InputScile.p3_version = p4Scfile.p3_versiong\n" 402 " LEFT JOIN p5DiffScfile\n" 403 " USING(p5_id, skycell_id, tess_id, exp_tag, p3_version)\n" 379 404 " WHERE\n" 380 " p4Run.state = 'run'\n" 381 " AND p3ProcessedExp.fault = 0\n" 382 " AND p4SkyCellMap.p4_id IS NULL\n" 383 " AND p4SkyCellMap.exp_tag IS NULL\n" 384 " AND p4SkyCellMap.p3_version IS NULL\n" 405 " p5Run.state = 'run'\n" 406 " AND p4DiffScfile.p5_id IS NULL\n" 407 " AND p4DiffScfile.skycell_id IS NULL\n" 408 " AND p4DiffScfile.tess_id IS NULL\n" 409 " AND p4DiffScfile.exp_tag IS NULL\n" 410 " AND p4DiffScfile.p3_version IS NULL\n" 385 411 ); 386 412 387 413 if (config->where) { 388 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p 4InputExp");414 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p5Scfile"); 389 415 psStringAppend(&query, " AND %s", whereClause); 390 416 psFree(whereClause); … … 420 446 } 421 447 if (!psArrayLength(output)) { 422 psError(PS_ERR_UNKNOWN, false, "no p ending rawImfile rows found");448 psError(PS_ERR_UNKNOWN, false, "no p5Scfile rows found"); 423 449 psFree(output); 424 450 return true; … … 437 463 if (psArrayLength(output)) { 438 464 // negative simple so the default is true 439 if (!ippdbPrintMetadatas(stdout, output, "p 4InputExp", !simple)) {465 if (!ippdbPrintMetadatas(stdout, output, "p5Scfile", !simple)) { 440 466 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 441 467 psFree(output); … … 455 481 456 482 bool status = false; 457 psString p 4_id = psMetadataLookupStr(&status, config->args, "-p4_id");458 if (!status) { 459 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p 4_id");460 return false; 461 } 462 if (!p 4_id) {463 psError(PS_ERR_UNKNOWN, true, "-p 4_id is required");483 psString p5_id = psMetadataLookupStr(&status, config->args, "-p5_id"); 484 if (!status) { 485 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p5_id"); 486 return false; 487 } 488 if (!p5_id) { 489 psError(PS_ERR_UNKNOWN, true, "-p5_id is required"); 464 490 return false; 465 491 } … … 527 553 528 554 // XXX need to validate that this coresponds to an p4InputImfile 529 if (!p 4ScfileInsert(config->dbh,530 (psS32)atoi(p 4_id),555 if (!p5DiffScfileInsert(config->dbh, 556 (psS32)atoi(p5_id), 531 557 skycell_id, 532 558 tess_id, … … 544 570 } 545 571 572 546 573 static bool diffscfileMode(pxConfig *config) 547 574 { … … 558 585 psString query = psStringCopy( 559 586 "SELECT\n" 560 " p 4Scfile.*\n"561 " FROM p 4Run\n"562 " JOIN p 4Scfile\n"563 " USING(p 4_id)\n"587 " p5DiffScfile.*\n" 588 " FROM p5Run\n" 589 " JOIN p5Scfile\n" 590 " USING(p5_id)\n" 564 591 " WHERE\n" 565 " p 4Run.state = 'run'\n"592 " p5Run.state = 'run'\n" 566 593 ); 567 594 568 595 if (config->where) { 569 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p 4Scfile");596 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p5DiffScfile"); 570 597 psStringAppend(&query, " AND %s", whereClause); 571 598 psFree(whereClause); … … 601 628 } 602 629 if (!psArrayLength(output)) { 603 psError(PS_ERR_UNKNOWN, false, "no p 4Scfile rows found");630 psError(PS_ERR_UNKNOWN, false, "no p5DiffScfile rows found"); 604 631 psFree(output); 605 632 return true; … … 618 645 if (psArrayLength(output)) { 619 646 // negative simple so the default is true 620 if (!ippdbPrintMetadatas(stdout, output, "p 4Scfile", !simple)) {647 if (!ippdbPrintMetadatas(stdout, output, "p5DiffScfile", !simple)) { 621 648 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 622 649 psFree(output); … … 656 683 return true; 657 684 } 658 659 static bool isValidMode(pxConfig *config, const char *mode)660 {661 PS_ASSERT_PTR_NON_NULL(config, false);662 PS_ASSERT_PTR_NON_NULL(mode, false);663 664 // check that state is a valid string value665 if (!(666 (strncmp(mode, "warp", 5) == 0)667 || (strncmp(mode, "diff", 5) == 0)668 || (strncmp(mode, "stack", 6) == 0)669 || (strncmp(mode, "magic", 6) == 0)670 )671 ) {672 psError(PS_ERR_UNKNOWN, false,673 "invalid detRun mode: %s", mode);674 return false;675 }676 677 return true;678 } -
trunk/ippTools/src/difftoolConfig.c
r11787 r11789 72 72 psMetadataAddStr(addinputscfileArgs, PS_LIST_TAIL, "-p5_id", 0, 73 73 "define p5 ID (required)", NULL); 74 psMetadataAddStr(addinputscfileArgs, PS_LIST_TAIL, "-p4_id", 0, 75 "define p4 ID (required)", NULL); 74 76 psMetadataAddStr(addinputscfileArgs, PS_LIST_TAIL, "-skycell_id", 0, 75 77 "define by skycell ID", NULL); … … 89 91 psMetadataAddStr(inputscfileArgs, PS_LIST_TAIL, "-p5_id", 0, 90 92 "search by p5 ID (required)", NULL); 93 psMetadataAddStr(inputscfileArgs, PS_LIST_TAIL, "-p4_id", 0, 94 "search by p4 ID (required)", NULL); 91 95 psMetadataAddStr(inputscfileArgs, PS_LIST_TAIL, "-skycell_id", 0, 92 96 "search by skycell ID", NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
