- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (2 props)
-
ippTools/src/disttool.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/ippTools/src
- Property svn:ignore
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20110710/ippTools/src (added) merged: 32337 /branches/eam_branches/ipp-20110906/ippTools/src (added) merged: 32630 /branches/eam_branches/ipp-20111110/ippTools/src (added) merged: 32694 /branches/haf_add201112/ippTools/src (added) merged: 32980,32986,33003,33023,33027
-
branches/meh_branches/ppstack_test/ippTools/src/disttool.c
r31564 r33415 34 34 static bool updaterunMode(pxConfig *config); 35 35 static bool revertrunMode(pxConfig *config); 36 static bool rerunMode(pxConfig *config);36 static bool startoverMode(pxConfig *config); 37 37 static bool pendingcomponentMode(pxConfig *config); 38 38 static bool addprocessedcomponentMode(pxConfig *config); 39 static bool updateprocessedcomponentMode(pxConfig *config); 40 static bool revertcomponentMode(pxConfig *config); 39 41 static bool revertcomponentMode(pxConfig *config); 40 42 static bool processedcomponentMode(pxConfig *config); … … 84 86 MODECASE(DISTTOOL_MODE_UPDATERUN, updaterunMode); 85 87 MODECASE(DISTTOOL_MODE_REVERTRUN, revertrunMode); 86 MODECASE(DISTTOOL_MODE_ RERUN, rerunMode);88 MODECASE(DISTTOOL_MODE_STARTOVER, startoverMode); 87 89 MODECASE(DISTTOOL_MODE_PENDINGCOMPONENT, pendingcomponentMode); 88 90 MODECASE(DISTTOOL_MODE_ADDPROCESSEDCOMPONENT, addprocessedcomponentMode); 91 MODECASE(DISTTOOL_MODE_UPDATEPROCESSEDCOMPONENT, updateprocessedcomponentMode); 89 92 MODECASE(DISTTOOL_MODE_PROCESSEDCOMPONENT, processedcomponentMode); 90 93 MODECASE(DISTTOOL_MODE_REVERTCOMPONENT, revertcomponentMode); … … 141 144 PXOPT_LOOKUP_BOOL(use_alternate, config->args, "-use_alternate", false); 142 145 PXOPT_LOOKUP_BOOL(no_magic, config->args, "-no_magic", false); 143 PXOPT_LOOKUP_BOOL(i_am_sure, config->args, "-i_am_sure", false);144 146 PXOPT_LOOKUP_STR(set_label, config->args, "-set_label", false, false); 145 147 PXOPT_LOOKUP_STR(set_data_group, config->args, "-set_data_group", false, false); … … 165 167 PXOPT_LOOKUP_STR(dist_group, config->args, "-dist_group", false, false); 166 168 167 // queuing no_magic runs can be quite dangerous. Require confirmation 168 if (no_magic && !pretend && !i_am_sure) { 169 psError(PXTOOLS_ERR_SYS, true, "-i_am_sure required to queue no_magic distribution runs"); 170 return false; 171 } 172 169 PXOPT_LOOKUP_BOOL(single, config->args, "-singlefilter", false); 170 PXOPT_LOOKUP_BOOL(rerun, config->args, "-rerun", false); 171 173 172 if (use_alternate) { 174 173 if (strcmp(stage, "raw")) { … … 361 360 } else if (!strcmp(stage, "sky")) { 362 361 magicRunType = "staticskyRun"; 363 query = pxDataGet("disttool_definebyquery_sky.sql"); 362 if (single) { 363 query = pxDataGet("disttool_definebyquery_sky_singlefilter.sql"); 364 } else { 365 query = pxDataGet("disttool_definebyquery_sky.sql"); 366 } 364 367 if (!query) { 365 368 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 406 409 } 407 410 } 411 if (!rerun) { 412 psStringAppend(&query, " AND (distRun.dist_id IS NULL)"); 413 } 408 414 409 415 if (psListLength(where->list)) { … … 418 424 if (!no_magic) { 419 425 psStringAppend(&query, " AND (%s.magicked > 0)", magicRunType); 426 } 427 428 if (!strcmp(stage, "sky")) { 429 if (single) { 430 psStringAppend(&query, "\nGROUP BY sky_id HAVING count(stack_id) = 1"); 431 } else { 432 psStringAppend(&query, "\nGROUP BY sky_id HAVING count(stack_id) > 1"); 433 } 420 434 } 421 435 … … 636 650 } 637 651 638 static bool rerunMode(pxConfig *config)652 static bool startoverMode(pxConfig *config) 639 653 { 640 654 psMetadata *where = psMetadataAlloc(); … … 646 660 647 661 // require data_group or dist_id to be supplied 648 PXOPT_LOOKUP_STR(data_group, config->args, "-data_group", true, false);662 PXOPT_LOOKUP_STR(data_group, config->args, "-data_group", false, false); 649 663 PXOPT_LOOKUP_S64(dist_id, config->args, "-dist_id", false, false); 650 664 if (!data_group && !dist_id) { … … 771 785 PXOPT_COPY_S64(config->args, where, "-stage_id", "stage_id", "=="); 772 786 PXOPT_COPY_STR(config->args, where, "-state", "state", "=="); 773 PXOPT_COPY_STR(config->args, where, "-label", "label", "==");787 pxAddLabelSearchArgs(config, where, "-label", "distRun.label", "=="); 774 788 775 789 PXOPT_COPY_S16(config->args, where, "-fault", "distRun.fault", "=="); … … 962 976 return true; 963 977 } 978 static bool updateprocessedcomponentMode(pxConfig *config) 979 { 980 981 // required values 982 PXOPT_LOOKUP_S64(dist_id, config->args, "-dist_id", true, false); 983 PXOPT_LOOKUP_STR(component, config->args, "-component", true, false); 984 985 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 986 PXOPT_LOOKUP_BOOL(clearfault, config->args, "-clearfault", false); 987 PXOPT_LOOKUP_S32(bytes, config->args, "-bytes", false, false); 988 PXOPT_LOOKUP_STR(md5sum, config->args, "-md5sum", false, false); 989 PXOPT_LOOKUP_STR(outdir, config->args, "-outdir", false, false); 990 PXOPT_LOOKUP_STR(name, config->args, "-name", false, false); 991 992 bool setfault = clearfault || fault; 993 994 if (!bytes && !md5sum && !outdir && !name && !setfault && !fault) { 995 psError(PS_ERR_UNKNOWN, true, "at least one of bytes md5sum outdir name fault or setfault is required"); 996 return false; 997 } 998 999 char *sep = ""; 1000 psString query = psStringCopy("UPDATE distComponent SET "); 1001 if (setfault) { 1002 psStringAppend(&query, "%s fault = %d", sep, fault ? 1 : 0); 1003 sep = ", "; 1004 } 1005 if (bytes) { 1006 psStringAppend(&query, "%s bytes = %d", sep, bytes); 1007 sep = ", "; 1008 } 1009 if (md5sum) { 1010 psStringAppend(&query, "%s md5sum = '%s'", sep, md5sum); 1011 sep = ", "; 1012 } 1013 if (outdir) { 1014 psStringAppend(&query, "%s outdir = '%s'", sep, outdir); 1015 sep = ", "; 1016 } 1017 if (name) { 1018 psStringAppend(&query, "%s name = '%s'", sep, name); 1019 sep = ", "; 1020 } 1021 1022 psStringAppend(&query, "\nWHERE dist_id = %"PRId64 " AND component = '%s'", 1023 dist_id, component); 1024 1025 if (!p_psDBRunQuery(config->dbh, query)) { 1026 psError(PS_ERR_UNKNOWN, false, "database error"); 1027 psFree(query); 1028 return false; 1029 } 1030 psFree(query); 1031 1032 return true; 1033 } 964 1034 965 1035 static bool toadvanceMode(pxConfig *config) … … 1041 1111 psMetadata *where = psMetadataAlloc(); 1042 1112 PXOPT_COPY_S64(config->args, where, "-dist_id", "dist_id", "=="); 1113 PXOPT_COPY_STR(config->args, where, "-component", "component", "=="); 1043 1114 1044 1115 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); … … 2178 2249 psMetadata *where = psMetadataAlloc(); 2179 2250 PXOPT_COPY_S64(config->args, where, "-fs_id", "fs_id", "=="); 2251 PXOPT_COPY_S64(config->args, where, "-dist_id", "dist_id", "=="); 2180 2252 2181 2253 if (!psListLength(where->list)) {
Note:
See TracChangeset
for help on using the changeset viewer.
