Changeset 27517 for branches/eam_branches/20100225/ippTools/src/disttool.c
- Timestamp:
- Mar 29, 2010, 3:55:49 PM (16 years ago)
- Location:
- branches/eam_branches/20100225
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippTools/src/disttool.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20100225
- Property svn:mergeinfo changed
-
branches/eam_branches/20100225/ippTools/src/disttool.c
r26997 r27517 137 137 138 138 // optional 139 PXOPT_LOOKUP_ S64(magic_ds_id, config->args, "-magic_ds_id", false, false);139 PXOPT_LOOKUP_BOOL(use_alternate, config->args, "-use_alternate", false); 140 140 PXOPT_LOOKUP_BOOL(no_magic, config->args, "-no_magic", false); 141 141 PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false); 142 PXOPT_LOOKUP_STR(set_data_group, config->args, "-set_data_group", false, false); 142 143 PXOPT_LOOKUP_STR(set_note, config->args, "-set_note", false, false); 143 144 … … 145 146 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 146 147 147 PXOPT_LOOKUP_BOOL(dry_run, config->args, "-dry_run", false); 148 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 149 150 if (use_alternate) { 151 if (strcmp(stage, "raw")) { 152 psError(PXTOOLS_ERR_SYS, true, "alternate inputs only supported for raw stage"); 153 return false; 154 } 155 if (no_magic) { 156 psError(PXTOOLS_ERR_SYS, true, "no_magic forbidden with alternate inputs"); 157 return false; 158 } 159 } 148 160 149 161 // select arguments … … 161 173 psString runJoinStr = NULL; 162 174 if (!strcmp(stage, "raw")) { 163 magicRunType = "rawExp"; 164 runJoinStr = "rawExp.exp_id"; 175 if (! use_alternate ) { 176 magicRunType = "rawExp"; 177 runJoinStr = "rawExp.exp_id"; 178 } else { 179 magicRunType = "camRun"; 180 runJoinStr = "camRun.exp_id"; 181 } 165 182 query = pxDataGet("disttool_definebyquery_raw.sql"); 166 183 if (!query) { … … 170 187 } 171 188 172 // for raw stage we select by c hipRun.label because raw labels typically aren't set189 // for raw stage we select by camRun.label and dist_group because rawExp doesn't have those columns 173 190 if (label) { 174 psStringAppend(&query, " AND ( chipRun.label = '%s')", label);191 psStringAppend(&query, " AND (magicDSRun.label = '%s')", label); 175 192 } 176 193 if (dist_group) { 177 psStringAppend(&query, " AND (c hipRun.dist_group = '%s')", dist_group);194 psStringAppend(&query, " AND (camRun.dist_group = '%s')", dist_group); 178 195 } 179 196 } else if (!strcmp(stage, "chip")) { … … 301 318 } 302 319 320 if (!strcmp(stage, "raw")) { 321 if (!no_magic) { 322 psStringAppend(&query, " AND (magicDSRun.re_place = %d)", !use_alternate); 323 psStringAppend(&query, " AND (camRun.state = 'full')"); 324 } 325 } 326 303 327 if (psListLength(where->list)) { 304 328 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); … … 311 335 312 336 if (!no_magic) { 313 psStringAppend(&query, " AND (%s.magicked)", magicRunType); 314 315 // is selecting by magic_ds_id really interesting? 316 if (magic_ds_id) { 317 if (!runJoinStr) { 318 psError(PS_ERR_PROGRAMMING, true, "cannot select by magic_ds_id for stage: %s", stage); 319 psFree(query); 320 return false; 321 } 322 psStringAppend(&joinHook, "\nJOIN magicDSRun ON magicDSRun.stage = distTarget.stage" 323 " AND magicDSRun.stage_id = %s", runJoinStr); 324 psStringAppend(&query, " AND (magicDSRun.state = 'full' AND magicDSRun.re_place AND (magicDSRun.magic_ds_id = %" PRId64 "))", magic_ds_id); 325 } 337 psStringAppend(&query, " AND (%s.magicked > 0)", magicRunType); 326 338 } 327 339 … … 352 364 353 365 354 if ( dry_run) {366 if (pretend) { 355 367 if (!ippdbPrintMetadatas(stdout, output, "newdistRuns", true)) { 356 368 psError(PS_ERR_UNKNOWN, false, "failed to print array"); … … 376 388 psS64 target_id = psMetadataLookupS64(NULL, md, "target_id"); 377 389 psString stage_label = psMetadataLookupStr(NULL, md, "label"); 378 psString data_group = psMetadataLookupStr(NULL, md, "data_group");390 psString stage_data_group = psMetadataLookupStr(NULL, md, "data_group"); 379 391 bool clean = psMetadataLookupBool(NULL, md, "clean"); 380 392 … … 388 400 new_label = stage_label; 389 401 } 402 psString new_data_group; 403 if (set_data_group != NULL) { 404 new_data_group = set_data_group; 405 } else { 406 new_data_group = stage_data_group; 407 } 408 390 409 distRunRow *row = distRunRowAlloc( 391 410 0, // dist_id … … 399 418 clean, 400 419 no_magic, 420 use_alternate, 401 421 "new", 402 422 NULL, // time_stamp 403 423 0, // fault 404 data_group,424 new_data_group, 405 425 set_note // note does not propagate 406 426 ); … … 448 468 PXOPT_COPY_STR(config->args, where, "-state", "distRun.state", "=="); 449 469 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 450 PXOPT_COPY_STR(config->args, where, "-data_group", "distRun.data_group", " ==");470 PXOPT_COPY_STR(config->args, where, "-data_group", "distRun.data_group", "LIKE"); 451 471 PXOPT_COPY_STR(config->args, where, "-dist_group", "distTarget.dist_group", "=="); 452 472 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); … … 460 480 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); 461 481 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 482 PXOPT_LOOKUP_STR(data_group, config->args, "-set_data_group", false, false); 462 483 PXOPT_LOOKUP_STR(outdir, config->args, "-set_outdir", false, false); 463 484 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 464 465 if ((!state) && (!label) && (!fault)) { 466 psError(PXTOOLS_ERR_CONFIG, false, "parameters (-fault or -set_state or -set_label) are required"); 485 PXOPT_LOOKUP_STR(set_note, config->args, "-set_note", false, false); 486 487 if ((!state) && (!label) && (!fault) &&(!data_group)) { 488 psError(PXTOOLS_ERR_CONFIG, false, "parameters (-fault or -set_state or -set_label -set_data_group) are required"); 467 489 psFree(where); 468 490 return false; … … 485 507 psStringAppend(&query, " , distRun.fault = %d", fault); 486 508 } 509 510 if (data_group) { 511 psStringAppend(&query, " , distRun.data_group = '%s'", data_group); 512 } 513 514 if (set_note) { 515 psStringAppend(&query, " , distRun.note = '%s'", set_note); 516 } 517 487 518 488 519 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
