Changeset 31396
- Timestamp:
- Apr 27, 2011, 7:33:50 PM (15 years ago)
- Location:
- branches/czw_branch/20110406
- Files:
-
- 3 added
- 10 edited
-
dbconfig/changes.txt (modified) (1 diff)
-
dbconfig/lap.md (added)
-
ippScripts/scripts/lap_science.pl (modified) (2 diffs)
-
ippTools/share/Makefile.am (modified) (1 diff)
-
ippTools/share/laptool_definerun.sql (modified) (1 diff)
-
ippTools/share/laptool_inactiveexp.sql (added)
-
ippTools/share/laptool_pendingexp.sql (added)
-
ippTools/share/laptool_pendingrun.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff)
-
ippTools/src/Makefile.am (modified) (3 diffs)
-
ippTools/src/laptool.c (modified) (10 diffs)
-
ippTools/src/laptool.h (modified) (1 diff)
-
ippTools/src/laptoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20110406/dbconfig/changes.txt
r31038 r31396 2058 2058 UPDATE dbversion set schema_version = '1.1.69', updated= CURRENT_TIMESTAMP(); 2059 2059 2060 2061 2060 -- Version 1.1.70 2061 2062 CREATE TABLE lapSequence ( 2063 seq_id BIGINT AUTO_INCREMENT, -- Identifier for the processing sequence 2064 name VARCHAR(64) NOT NULL, -- short name of the sequence 2065 description VARCHAR(255) NOT NULL, -- longer description of the sequence 2066 PRIMARY KEY(seq_id), 2067 KEY(name) 2068 ) ENGINE=innodb DEFAULT CHARSET=latin1; 2069 2070 CREATE TABLE lapRun ( 2071 lap_id BIGINT AUTO_INCREMENT, -- Identifier for the processing run 2072 seq_id BIGINT NOT NULL, -- Identifier to match to the sequence 2073 tess_id VARCHAR(64) NOT NULL, -- tessellation id to use 2074 projection_cell VARCHAR(64) NOT NULL, -- projection cell from the tessellation to consider 2075 filter VARCHAR(64) NOT NULL, -- filter 2076 state VARCHAR(64) NOT NULL, -- state of run 2077 label VARCHAR(64) NOT NULL, -- processing label 2078 dist_group VARCHAR(64) NOT NULL, -- distribution group for products of this run 2079 registered TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- time run was registered 2080 fault SMALLINT NOT NULL, -- fault code 2081 quick_sass_id, -- stackAssociation id for quick stack 2082 final_sass_id, -- stackAssociation id for final stack 2083 PRIMARY KEY(lap_id), 2084 KEY(seq_id), 2085 KEY(projection_cell), 2086 KEY(filter), 2087 KEY(state), 2088 KEY(label), 2089 KEY(fault), 2090 FOREIGN KEY(seq_id) REFERENCES lapSequence(seq_id), 2091 FOREIGN KEY(quick_sass_id) REFERENCES stackAssociation(sass_id), 2092 FOREIGN KEY(final_sass_id) REFERENCES stackAssociation(sass_id) 2093 ) ENGINE=innodb DEFAULT CHARSET=latin1; 2094 2095 CREATE TABLE lapExp ( 2096 lap_id BIGINT NOT NULL, -- Link back to processing run 2097 exp_id BIGINT NOT NULL, -- exposure definition 2098 chip_id BIGINT, -- processing id from chipRun 2099 pair_id BIGINT, -- companion chip_id 2100 private TINYINT DEFAULT 0, -- denotes this exposure is private 2101 pairwise TINYINT DEFAULT 0, -- denotes if this exposure should be pairwise diffed 2102 active TINYINT DEFAULT 0, -- denotes if this exposure is currently in use 2103 data_state VARCHAR(64) NOT NULL, -- state of exposure 2104 PRIMARY KEY (lap_id), 2105 KEY (exp_id), 2106 KEY (chip_id), 2107 KEY (pair_id), 2108 KEY (data_state), 2109 FOREIGN KEY (lap_id) REFERENCES lapRun(lap_id), 2110 FOREIGN KEY (exp_id) REFERENCES rawExp(exp_id), 2111 FOREIGN KEY (chip_id,exp_id) REFERENCES chipRun(chip_id,exp_id), 2112 FOREIGN KEY (pair_id) REFERENCES chipRun(chip_id), 2113 ) ENGINE=innodb DEFAULT CHARSET=latin1; 2114 2115 UPDATE dbversion set schema_version = '1.1.70', updated= CURRENT_TIMESTAMP(); -
branches/czw_branch/20110406/ippScripts/scripts/lap_science.pl
r31385 r31396 19 19 my $regtool = can_run('regtool') or (warn "Can't find regtool" and $missing_tools = 1); 20 20 my $chiptool = can_run('chiptool') or (warn "Can't find chiptool" and $missing_tools = 1); 21 my $warptool = can_run('warptool') or (warn "Can't find warptool" and $missing_tools = 1); 21 22 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1); 22 23 my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1); 24 my $magicdstool = can_run('magicdstool') or (warn "Can't find magicdstool" and $missing_tools = 1); 23 25 my $laptool = can_run('laptool') or (warn "Can't find laptool" and $missing_tools = 1); 24 26 … … 108 110 my $lap_id = get_lap_id($proj_cell); 109 111 110 my $command = "$laptool -pending run-lap_id $lap_id";112 my $command = "$laptool -pendingexp -lap_id $lap_id"; 111 113 $command .= " -dbname $dbname" if defined $dbname; 112 114 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = -
branches/czw_branch/20110406/ippTools/share/Makefile.am
r31253 r31396 401 401 diffphottool_advance.sql \ 402 402 diffphottool_revert.sql \ 403 diffphottool_data.sql 403 diffphottool_data.sql \ 404 laptool_definerun.sql \ 405 laptool_exposures.sql \ 406 laptool_inactiveexp.sql \ 407 laptool_pendingchipexp.sql \ 408 laptool_pendingexp.sql \ 409 laptool_pendingrun.sql \ 410 laptool_stacks.sql 411 -
branches/czw_branch/20110406/ippTools/share/laptool_definerun.sql
r31385 r31396 3 3 LEFT JOIN 4 4 (SELECT exp_id, chip_id 5 FROM reprocExp5 FROM lapExp 6 6 where private IS FALSE 7 7 AND data_state = 'full') AS old USING(exp_id) -
branches/czw_branch/20110406/ippTools/share/laptool_pendingrun.sql
r31385 r31396 1 select lap_id, projection_cell, tess_id, registered, state, fault, 2 exp_id, chip_id, pair_id, private, pairwise, active, data_state, 3 dateobs, object, comment 4 FROM lapRun JOIN lapExp USING(lap_id) 5 JOIN rawExp USING(exp_id) 6 WHERE active IS TRUE AND fault = 0 7 -- lap_id restriction here. 8 -- This probably needs to be sorted by dateobs. 1 SELECT * from lapRun -
branches/czw_branch/20110406/ippTools/share/pxadmin_create_tables.sql
r31165 r31396 1891 1891 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1892 1892 1893 -- Tables for large area processing 1894 1895 CREATE TABLE lapSequence ( 1896 seq_id BIGINT AUTO_INCREMENT, -- Identifier for the processing sequence 1897 name VARCHAR(64) NOT NULL, -- short name of the sequence 1898 description VARCHAR(255) NOT NULL, -- longer description of the sequence 1899 PRIMARY KEY(seq_id), 1900 KEY(name) 1901 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1902 1903 CREATE TABLE lapRun ( 1904 lap_id BIGINT AUTO_INCREMENT, -- Identifier for the processing run 1905 seq_id BIGINT NOT NULL, -- Identifier to match to the sequence 1906 tess_id VARCHAR(64) NOT NULL, -- tessellation id to use 1907 projection_cell VARCHAR(64) NOT NULL, -- projection cell from the tessellation to consider 1908 filter VARCHAR(64) NOT NULL, -- filter 1909 state VARCHAR(64) NOT NULL, -- state of run 1910 label VARCHAR(64) NOT NULL, -- processing label 1911 dist_group VARCHAR(64) NOT NULL, -- distribution group for products of this run 1912 registered TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- time run was registered 1913 fault SMALLINT NOT NULL, -- fault code 1914 quick_sass_id, -- stackAssociation id for quick stack 1915 final_sass_id, -- stackAssociation id for final stack 1916 PRIMARY KEY(lap_id), 1917 KEY(seq_id), 1918 KEY(projection_cell), 1919 KEY(filter), 1920 KEY(state), 1921 KEY(label), 1922 KEY(fault), 1923 FOREIGN KEY(seq_id) REFERENCES lapSequence(seq_id), 1924 FOREIGN KEY(quick_sass_id) REFERENCES stackAssociation(sass_id), 1925 FOREIGN KEY(final_sass_id) REFERENCES stackAssociation(sass_id) 1926 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1927 1928 CREATE TABLE lapExp ( 1929 lap_id BIGINT NOT NULL, -- Link back to processing run 1930 exp_id BIGINT NOT NULL, -- exposure definition 1931 chip_id BIGINT, -- processing id from chipRun 1932 pair_id BIGINT, -- companion chip_id 1933 private TINYINT DEFAULT 0, -- denotes this exposure is private 1934 pairwise TINYINT DEFAULT 0, -- denotes if this exposure should be pairwise diffed 1935 active TINYINT DEFAULT 0, -- denotes if this exposure is currently in use 1936 data_state VARCHAR(64) NOT NULL, -- state of exposure 1937 PRIMARY KEY (lap_id), 1938 KEY (exp_id), 1939 KEY (chip_id), 1940 KEY (pair_id), 1941 KEY (data_state), 1942 FOREIGN KEY (lap_id) REFERENCES lapRun(lap_id), 1943 FOREIGN KEY (exp_id) REFERENCES rawExp(exp_id), 1944 FOREIGN KEY (chip_id,exp_id) REFERENCES chipRun(chip_id,exp_id), 1945 FOREIGN KEY (pair_id) REFERENCES chipRun(chip_id), 1946 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1947 1893 1948 -- This comment line is here to avoid empty query error. 1894 1949 -- Another way to avoid that problem is to omit the semicolon above but I think that is untidy. -
branches/czw_branch/20110406/ippTools/src/Makefile.am
r29528 r31396 28 28 pubtool \ 29 29 diffphottool \ 30 minidvodbtool 30 minidvodbtool \ 31 laptool 31 32 32 33 pkginclude_HEADERS = \ … … 76 77 pubtool.h \ 77 78 diffphottool.h \ 78 minidvodbtool.h 79 minidvodbtool.h \ 80 laptool.h 79 81 80 82 lib_LTLIBRARIES = libpxtools.la … … 290 292 minidvodbtoolConfig.c 291 293 294 laptool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS) 295 laptool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la 296 laptool_SOURCES = \ 297 laptool.c \ 298 laptoolConfig.c 299 292 300 clean-local: 293 301 -rm -f TAGS -
branches/czw_branch/20110406/ippTools/src/laptool.c
r31385 r31396 45 45 46 46 switch (config->mode) { 47 MODECASE(LAPTOOL_MODE_DEFINESEQUENCE, definesequenceMode); 48 MODECASE(LAPTOOL_MODE_LISTSEQUENCE, listsequenceMode); 49 47 50 MODECASE(LAPTOOL_MODE_DEFINERUN, definerunMode); 48 51 MODECASE(LAPTOOL_MODE_PENDINGRUN, pendingrunMode); 49 52 MODECASE(LAPTOOL_MODE_UPDATERUN, updaterunMode); 50 53 51 MODECASE(LAPTOOL_MODE_PENDINGCHIPEXP, pendingchipexpMode); 52 MODECASE(LAPTOOL_MODE_PENDINGQUICKSTACK,pendingquickstackMode); 53 MODECASE(LAPTOOL_MODE_PENDINGDIFF, pendingdiffMode); 54 MODECASE(LAPTOOL_MODE_PENDINGFINALSTACK,pendingfinalstackMode); 55 MODECASE(LAPTOOL_MODE_UPDATEEXP, updateexpMode); 54 MODECASE(LAPTOOL_MODE_PENDINGEXP, pendingexpMode); 55 MODECASE(LAPTOOL_MODE_EXPOSURES, exposuresMode); 56 MODECASE(LAPTOOL_MODE_STACKS, stacksMode); 57 MODECASE(LAPTOOL_MODE_UPDATEEXP, updateexpMode); 58 59 MODECASE(LAPTOOL_MODE_INACTIVEEXP, inactiveexpMode); 56 60 default: 57 61 psAbort("invalid option (this should not happen)"); … … 74 78 } 75 79 80 // Sequence level 81 82 static bool definesequenceMode(pxConfig *config) 83 { 84 PS_ASSERT_PTR_NON_NULL(config, false); 85 86 PXOPT_LOOKUP_STR(name, config->args, "-name", true, false); 87 PXOPT_LOOKUP_STR(description, config->args, "-description", true, false); 88 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 89 90 lapSequenceRow *run = lapSequenceRowAlloc(0, // seq_id 91 name, 92 description); 93 if (!run) { 94 psError(PS_ERR_UNKNOWN, false, "failed to alloc lapSequence object"); 95 return(true); 96 } 97 98 if (!psDBTransaction(config->dbh)) { 99 psError(PS_ERR_UNKNOWN, false, "database error"); 100 return false; 101 } 102 103 if (!lapSequenceInsertObject(config->dbh, run)) { 104 if (!psDBRollback(config->dbh)) { 105 psError(PS_ERR_UNKNOWN, false, "database error"); 106 } 107 psError(PS_ERR_UNKNOWN, false "database error"); 108 psFree(run); 109 return(true); 110 } 111 112 // point of no return 113 if (!psDBCommit(config->dbh)) { 114 psError(PS_ERR_UNKNOWN, false, "database error"); 115 return false; 116 } 117 118 if (lapSequencePrintObject(stdout, run, !simple)) { 119 psError(PS_ERR_UNKNOWN, false, "failed to print object"); 120 psFree(run); 121 return false; 122 } 123 124 psFree(run); 125 126 return true; 127 } 128 129 static bool listsequenceMode(pxConfig *config) 130 { 131 PS_ASSERT_PTR_NON_NULL(config, false); 132 133 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 134 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 135 136 psMetadata *where = psMetadataAlloc(); 137 PXOPT_COPY_S64(config->args, where, "-seq_id", "seq_id", "=="); 138 PXOPT_COPY_STR(config->args, where, "-name", "name", "LIKE"); 139 140 psString query = pxDataGet("laptool_listsequence.sql"); 141 if (!query) { 142 psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement"); 143 return false; 144 } 145 if (psListLength(where->list)) { 146 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 147 psStringAppend(&query, " WHERE %s", whereClause); 148 psFree(whereClause); 149 } 150 151 if (limit) { 152 psString limitString = psDBGenerateLimitSQL(limit); 153 psStringAppend(&query, " %s" limitString); 154 psFree(limitString); 155 } 156 if (!p_psDBRunQuery(config->dbh, query)) { 157 psError(PS_ERR_UNKNOWN, false, "database error"); 158 psFree(query); 159 return false; 160 } 161 psFree(query); 162 163 psArray *output = p_psDBFetchResult(config->dbh); 164 if (!output) { 165 psErrorCode err = psErrorCodeLast(); 166 switch (err) { 167 case PS_ERR_DB_CLIENT: 168 psError(PXTOOLS_ERR_SYS, false, "database error"); 169 case PS_ERR_DB_SERVER: 170 psError(PXTOOLS_ERR_PROG, false, "database error"); 171 default: 172 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 173 } 174 175 return false; 176 } 177 if (!psArrayLength(output)) { 178 psTrace("laptool", PS_LOG_INFO, "no rows found"); 179 psFree(output); 180 return true; 181 } 182 183 if (psArrayLength(output)) { 184 if (!ippdbPrintMetadatas(stdout, output, "lapSequence", !simple)) { 185 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 186 psFree(output); 187 return false; 188 } 189 } 190 191 psFree(output); 192 193 return true; 194 } 195 196 76 197 // Run level 77 198 static bool definerunMode(pxConfig *config) … … 79 200 PS_ASSERT_PTR_NON_NULL(config, false); 80 201 202 PXOPT_LOOKUP_S64(seq_id, config->args, "-seq_id", true, false); 81 203 PXOPT_LOOKUP_STR(projection_cell, config->args, "-projection_cell", true, false); 82 204 PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", true, false); … … 84 206 PXOPT_LOOKUP_F64(decl, config->args, "-decl", true, false); 85 207 PXOPT_LOOKUP_F32(radius, config->args, "-radius", true, false); 86 87 // Insert the run 88 if (!lapRunInsert(config->dbh, 89 NULL, // lap_id 90 projection_cell, 91 tess_id, 92 ra, 93 decl, 94 radius, 95 NULL, // registered 96 "new", // state 97 0 // fault 98 )) { 99 // rollback 208 PXOPT_LOOKUP_STR(filter, config->args, "-filter", true, false); 209 PXOPT_LOOKUP_STR(label, config->args, "-label", false, false); 210 PXOPT_LOOKUP_STR(dist_group, config->args, "-dist_group", false, false); 211 212 lapRunRow *run = lapRunRowAlloc(0, // lap_id 213 seq_id, 214 tess_id, 215 projection_cell, 216 filter, 217 "new", // state 218 label, 219 dist_group, 220 NULL, // registered 221 0, // fault 222 NULL, // quick_sass_id 223 NULL, // final_sass_id 224 ); 225 if (!run) { 226 psError(PS_ERR_UNKNOWN, false, "failed to alloc lapRun object"); 227 return(true); 228 } 229 230 if (!psDBTransaction(config->dbh)) { 231 psError(PS_ERR_UNKNOWN, false, "database error"); 232 return false; 233 } 234 235 if (!lapSequenceInsertObject(config->dbh, run)) { 100 236 if (!psDBRollback(config->dbh)) { 101 237 psError(PS_ERR_UNKNOWN, false, "database error"); 102 238 } 103 psError(PS_ERR_UNKNOWN, false, "database error"); 104 105 return false; 106 } 239 psError(PS_ERR_UNKNOWN, false "database error"); 240 psFree(run); 241 return(true); 242 } 243 244 // point of no return 245 if (!psDBCommit(config->dbh)) { 246 psError(PS_ERR_UNKNOWN, false, "database error"); 247 return false; 248 } 249 250 if (lapSequencePrintObject(stdout, run, !simple)) { 251 psError(PS_ERR_UNKNOWN, false, "failed to print object"); 252 psFree(run); 253 return false; 254 } 255 107 256 psS64 lap_id = psDBLastInsertID(config->dbh); 108 109 257 110 258 // Find the input exposures … … 166 314 { 167 315 PS_ASSERT_PTR_NON_NULL(config, false); 316 168 317 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 169 318 170 psmetadata *where = psMetadataAlloc(); 319 psMetadata *where = psMetadataAlloc(); 320 PXOPT_COPY_S64(config->args, where, "-seq_id", "seq_id", "=="); 171 321 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 172 322 PXOPT_COPY_STR(config->args, where, "-projection_cell", "projection_cell", "=="); 323 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 324 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 325 PXOPT_COPY_STR(config->args, where, "-state", "state", "=="); 326 PXOPT_COPY_STR(config->args, where, "-fault", "fault", "=="); 173 327 174 328 psString query = pxDataGet("laptool_pendingrun.sql"); 175 329 if (!query) { 176 330 psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement"); 331 return false; 332 } 333 if (psListLength(where->list)) { 334 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 335 psStringAppend(&query, " WHERE %s", whereClause); 336 psFree(whereClause); 337 } 338 psStringAppend(&query, " ORDER BY rawExp.dateobs "); 339 340 if (!p_psDBRunQuery(config->dbh, query)) { 341 psError(PS_ERR_UNKNOWN, false, "database error"); 342 psFree(query); 343 return false; 344 } 345 psFree(query); 346 347 psArray *output = p_psDBFetchResult(config->dbh); 348 if (!output) { 349 psErrorCode err = psErrorCodeLast(); 350 switch (err) { 351 case PS_ERR_DB_CLIENT: 352 psError(PXTOOLS_ERR_SYS, false, "database error"); 353 case PS_ERR_DB_SERVER: 354 psError(PXTOOLS_ERR_PROG, false, "database error"); 355 default: 356 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 357 } 358 359 return false; 360 } 361 if (!psArrayLength(output)) { 362 psTrace("laptool", PS_LOG_INFO, "no rows found"); 363 psFree(output); 364 return true; 365 } 366 367 if (psArrayLength(output)) { 368 if (!ippdbPrintMetadatas(stdout, output, "lapRun", !simple)) { 369 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 370 psFree(output); 371 return false; 372 } 373 } 374 375 psFree(output); 376 377 return true; 378 } 379 380 static bool updaterunMode(pxConfig *config) 381 { 382 PS_ASSERT_PTR_NON_NULL(config, false); 383 384 psMetadata *where = psMetadataAlloc(); 385 PXOPT_LOOKUP_S64(lap_id, config->args, "-lap_id", true, false); 386 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 387 388 psMetadata *values = psMetadataAlloc(); 389 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); 390 PXOPT_COPY_STR(config->args, values, "-set_state", "state", "=="); 391 PXOPT_COPY_S16(config->args, values, "-fault", "fault", "=="); 392 PXOPT_COPY_STR(config->args, values, "-set_label", "label", "=="); 393 PXOPT_COPY_S64(config->args, values, "-set_quick_sass_id", "quick_sass_id", "=="); 394 PXOPT_COPY_S64(config->args, values, "-set_final_sass_id", "final_sass_id", "=="); 395 396 long rows = psDBUpdateRows(config->dbh, "lapRun", where, values); 397 psFree(values); 398 399 if (rows) { 400 // We're done with these exposures now, so mark them as inactive. 401 if ((strcmp(state,"drop") == 0)|| 402 (strcmp(state,"full") == 0)) { 403 values = psMetadataAlloc(); 404 psMetadataAddBool(values, PS_LIST_TAIL, "active", 0, "", false); 405 long exps = psDBUpdateRows(config->dbh, "lapExp", where, values); 406 407 if (exps) { 408 return(true); 409 } 410 else { 411 return(false); 412 } 413 } 414 return(true); 415 } 416 else { 417 return(false); 418 } 419 } 420 421 // Exposure level 422 423 static bool pendingexpMode(pxConfig *config) 424 { 425 PS_ASSERT_PTR_NON_NULL(config, false); 426 427 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 428 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 429 430 psMetadata *where = psMetadataAlloc(); 431 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 432 433 psString query = pxDataGet("laptool_pendingexp.sql"); 434 if (!query) { 435 psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement"); 436 return false; 437 } 438 if (psListLength(where->list)) { 439 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 440 psStringAppend(&query, " WHERE %s", whereClause); 441 psFree(whereClause); 442 } 443 444 if (limit) { 445 psString limitString = psDBGenerateLimitSQL(limit); 446 psStringAppend(&query, " %s" limitString); 447 psFree(limitString); 448 } 449 if (!p_psDBRunQuery(config->dbh, query)) { 450 psError(PS_ERR_UNKNOWN, false, "database error"); 451 psFree(query); 452 return false; 453 } 454 psFree(query); 455 456 psArray *output = p_psDBFetchResult(config->dbh); 457 if (!output) { 458 psErrorCode err = psErrorCodeLast(); 459 switch (err) { 460 case PS_ERR_DB_CLIENT: 461 psError(PXTOOLS_ERR_SYS, false, "database error"); 462 case PS_ERR_DB_SERVER: 463 psError(PXTOOLS_ERR_PROG, false, "database error"); 464 default: 465 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 466 } 467 468 return false; 469 } 470 if (!psArrayLength(output)) { 471 psTrace("laptool", PS_LOG_INFO, "no rows found"); 472 psFree(output); 473 return true; 474 } 475 476 if (psArrayLength(output)) { 477 if (!ippdbPrintMetadatas(stdout, output, "lapExp", !simple)) { 478 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 479 psFree(output); 480 return false; 481 } 482 } 483 484 psFree(output); 485 486 return true; 487 } 488 489 490 static bool exposuresMode(pxConfig *config) 491 { 492 PS_ASSERT_PTR_NON_NULL(config, false); 493 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 494 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 495 496 psMetadata *where = psMetadataAlloc(); 497 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 498 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 499 500 psString query = pxDataGet("laptool_exposures.sql"); 501 if (!query) { 502 psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement"); 177 503 return(false); 178 504 } 179 505 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 180 506 if (whereClause) { 181 psString Prepend(&whereClause, "\n AND");507 psStringSubstitute(&query,whereClause,"@WHERE@"); 182 508 } 183 509 … … 218 544 psFree(output); 219 545 return(true); 220 221 } 222 static bool updaterunMode(pxConfig *config) 223 { 224 PS_ASSERT_PTR_NON_NULL(config, false); 225 226 psMetadata *where = psMetadataAlloc(); 227 PXOPT_LOOKUP_S64(lap_id, config->args, "-lap_id", true, false); 228 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 229 PXOPT_LOOKUP_STR(set_state, config->args, "-set_state", false, false); 230 231 if ((fault == INT16_MAX)&&(!set_state)) { 232 psError(PS_ERR_UNKNOWN, false, "one of -fault or -set_state must be selected"); 233 return(false); 234 } 235 546 } 547 548 static bool stacksMode(pxConfig *config) 549 { 550 PS_ASSERT_PTR_NON_NULL(config, false); 551 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 552 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 553 236 554 psMetadata *where = psMetadataAlloc(); 237 555 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 238 239 // Set a fault 240 if (fault != INT16_MAX) { 241 // this is fairly dangerous : can set all if the where is not set... 242 if (!pxSetFaultCode(config->dbh, "lapRun", where, fault, 0)) { 243 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 244 psFree (where); 245 return false; 246 } 247 psFree (where); 248 return(true); 249 } 250 251 // Set the state, and deactivate the exposures if needed. 252 253 if ((strcmp(set_state,"drop") == 0)|| 254 (strcmp(set_state,"full") == 0)) { 255 // Deactivate exposures 256 257 psString query = pxDataGet("laptool_updaterun_deactivate.sql"); 258 if (!query) { 259 psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement"); 260 return(false); 261 } 262 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 263 psStringAppend(&query, whereClause, " \n "); 264 if (!p_psDBRunQuery(config->dbh, query)) { 265 psError(PS_ERR_UNKNOWN, false, "database error"); 266 psFree(query); 267 return(false); 268 } 269 psFree(query); 270 } 271 272 char *query = "UPDATE lapRun SET state = '%s' WHERE lap_id = %"PRId64; 273 if (!p_psDBRunQueryF(config->dbh, query, state, lap_id)) { 274 psError(PS_ERR_UNKNOWN, false, 275 "failed to change state for lap_id %"PRId64, lap_id); 276 return(false); 277 } 278 279 return(true); 280 } 281 // Exposure level 282 283 static bool exposuresMode(pxConfig *config) 284 { 285 PS_ASSERT_PTR_NON_NULL(config, false); 286 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 287 288 psmetadata *where = psMetadataAlloc(); 289 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 290 291 psString query = pxDataGet("laptool_exposures.sql"); 556 557 psString query = pxDataGet("laptool_stacks.sql"); 292 558 if (!query) { 293 559 psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement"); … … 327 593 } 328 594 329 if (!ippdbPrintMetadatas(stdout, output, "lap Exp", !simple)) {595 if (!ippdbPrintMetadatas(stdout, output, "lapRunStacks", !simple)) { 330 596 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 331 597 psFree(output); … … 335 601 psFree(output); 336 602 return(true); 337 338 } 339 340 341 static bool pendingchipexpMode(pxConfig *config) 342 { 343 PS_ASSERT_PTR_NON_NULL(config, false); 603 } 604 605 static bool updateexpMode(pxConfig *config) 606 { 607 PS_ASSERT_PTR_NON_NULL(config, false); 608 609 psMetadata *where = psMetadataAlloc(); 610 PXOPT_LOOKUP_S64(lap_id, config->args, "-lap_id", true, false); 611 PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", true, false); 612 PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", false, false); 613 614 PXOPT_LOOKUP_S64(set_chip_id, config->args, "-set_chip_id", false, false); 615 PXOPT_LOOKUP_S64(set_pair_id, config->args, "-set_pair_id", false, false); 616 PXOPT_LOOKUP_BOOL(private, config->args, "-private", false, false); 617 PXOPT_LOOKUP_BOOL(public, config->args, "-public", false, false); 618 PXOPT_LOOKUP_BOOL(pairwise, config->args, "-pairwise", false, false); 619 PXOPT_LOOKUP_BOOL(nopairwise, config->args, "-nopairwise", false, false); 620 PXOPT_LOOKUP_BOOL(active, config->args, "-active", false, false); 621 PXOPT_LOOKUP_BOOL(inactive, config->args, "-inactive", false, false); 622 623 624 if (private && public) { 625 psError(PS_ERR_UNKNOWN, false, "only one of -private and -public may be selected"); 626 } 627 if (active && inactive) { 628 psError(PS_ERR_UNKNOWN, false, "only one of -active and -inactive may be selected"); 629 } 630 if (pairwise && nopairwise) { 631 psError(PS_ERR_UNKNOWN, false, "only one of -pairwise and -nopairwise may be selected"); 632 } 633 634 psMetadata *where = psMetadataAlloc(); 635 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 636 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 637 PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "=="); 638 639 psMetadata *values = psMetadataAlloc(); 640 if (set_chip_id) { 641 PXOPT_COPY_S64(config->args, values, "-set_chip_id", "chip_id", "=="); 642 } 643 if (set_pair_id) { 644 PXOPT_COPY_S64(config->args, values, "-set_pair_id", "pair_id", "=="); 645 } 646 if (private) { 647 psMetadataAddBool(values, PS_LIST_TAIL, "private", 1, "", false); 648 } 649 else if (public) { 650 psMetadataAddBool(values, PS_LIST_TAIL, "private", 0, "", false); 651 } 652 if (active) { 653 psMetadataAddBool(values, PS_LIST_TAIL, "active", 1, "", false); 654 } 655 else if (inactive) { 656 psMetadataAddBool(values, PS_LIST_TAIL, "active", 0, "", false); 657 } 658 if (pairwise) { 659 psMetadataAddBool(values, PS_LIST_TAIL, "pairwise", 1, "", false); 660 } 661 else if (nopairwise) { 662 psMetadataAddBool(values, PS_LIST_TAIL, "pairwise", 0, "", false); 663 } 664 665 long rows = psDBUpdateRows(config->dbh,"lapExp",where,values); 666 if (rows) { 667 return(true); 668 } 669 else { 670 return(false); 671 } 672 } 673 674 675 676 677 static bool inactiveexpMode(pxConfig *config) 678 { 679 PS_ASSERT_PTR_NON_NULL(config, false); 680 681 psMetadata *where = psMetadataAlloc(); 682 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 344 683 345 684 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 346 347 psmetadata *where = psMetadataAlloc(); 348 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 349 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 350 351 psString query = pxDataGet("laptool_pendingchipexp.sql"); 685 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 686 687 psString query = pxDataGet("laptool_inactiveexp.sql"); 352 688 if (!query) { 353 689 psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement"); … … 356 692 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 357 693 if (whereClause) { 358 psString Prepend(&whereClause, "\n AND");694 psStringSubstitute(&query,whereClause,"@WHERE@"); 359 695 } 360 696 … … 395 731 psFree(output); 396 732 return(true); 397 398 399 } 400 static bool pendingquickstackMode(pxConfig *config) 401 { 402 PS_ASSERT_PTR_NON_NULL(config, false); 403 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 404 405 psmetadata *where = psMetadataAlloc(); 406 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 407 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 408 409 psString query = pxDataGet("laptool_pendingquickstack.sql"); 410 if (!query) { 411 psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement"); 412 return(false); 413 } 414 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 415 if (whereClause) { 416 psStringPrepend(&whereClause, "\n AND "); 417 } 418 419 psString limitString = NULL; 420 if (limit) { 421 limitString = psDBGenerateLimitSQL(limit); 422 psStringPrepend(&limitString, "\n"); 423 } 424 425 if (!p_psDBRunQueryF(config->dbh, query, whereClause, limitString ? limitString : "")) { 426 psError(PXTOOLS_ERR_PROG, false, "database error"); 427 psFree(limitString); 428 psFree(query); 429 psFree(whereClause); 430 return(false); 431 } 432 psFree(limitString); 433 psFree(query); 434 psFree(whereClause); 435 436 psArray *output = p_psDBFetchResult(config->dbh); 437 if (!output) { 438 psError(PS_ERR_UNKNOWN, false, "database error"); 439 return(false); 440 } 441 if (!psArrayLength(output)) { 442 psTrace("laptool", PS_LOG_INFO, "no rows found"); 443 psFree(output); 444 return(true); 445 } 446 447 if (!ippdbPrintMetadatas(stdout, output, "lapExp", !simple)) { 448 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 449 psFree(output); 450 return(false); 451 } 452 453 psFree(output); 454 return(true); 455 456 457 } 458 static bool pendingdiffMode(pxConfig *config) 459 { 460 PS_ASSERT_PTR_NON_NULL(config, false); 461 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 462 463 psmetadata *where = psMetadataAlloc(); 464 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 465 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 466 467 psString query = pxDataGet("laptool_pendingdiff.sql"); 468 if (!query) { 469 psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement"); 470 return(false); 471 } 472 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 473 if (whereClause) { 474 psStringPrepend(&whereClause, "\n AND "); 475 } 476 477 psString limitString = NULL; 478 if (limit) { 479 limitString = psDBGenerateLimitSQL(limit); 480 psStringPrepend(&limitString, "\n"); 481 } 482 483 if (!p_psDBRunQueryF(config->dbh, query, whereClause, limitString ? limitString : "")) { 484 psError(PXTOOLS_ERR_PROG, false, "database error"); 485 psFree(limitString); 486 psFree(query); 487 psFree(whereClause); 488 return(false); 489 } 490 psFree(limitString); 491 psFree(query); 492 psFree(whereClause); 493 494 psArray *output = p_psDBFetchResult(config->dbh); 495 if (!output) { 496 psError(PS_ERR_UNKNOWN, false, "database error"); 497 return(false); 498 } 499 if (!psArrayLength(output)) { 500 psTrace("laptool", PS_LOG_INFO, "no rows found"); 501 psFree(output); 502 return(true); 503 } 504 505 if (!ippdbPrintMetadatas(stdout, output, "lapExp", !simple)) { 506 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 507 psFree(output); 508 return(false); 509 } 510 511 psFree(output); 512 return(true); 513 514 515 } 516 static bool pendingfinalstackMode(pxConfig *config) 517 { 518 PS_ASSERT_PTR_NON_NULL(config, false); 519 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 520 521 psmetadata *where = psMetadataAlloc(); 522 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 523 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 524 525 psString query = pxDataGet("laptool_pendingfinalstack.sql"); 526 if (!query) { 527 psError(PXTOOL_ERR_SYS, false, "failed to retrieve SQL statement"); 528 return(false); 529 } 530 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 531 if (whereClause) { 532 psStringPrepend(&whereClause, "\n AND "); 533 } 534 535 psString limitString = NULL; 536 if (limit) { 537 limitString = psDBGenerateLimitSQL(limit); 538 psStringPrepend(&limitString, "\n"); 539 } 540 541 if (!p_psDBRunQueryF(config->dbh, query, whereClause, limitString ? limitString : "")) { 542 psError(PXTOOLS_ERR_PROG, false, "database error"); 543 psFree(limitString); 544 psFree(query); 545 psFree(whereClause); 546 return(false); 547 } 548 psFree(limitString); 549 psFree(query); 550 psFree(whereClause); 551 552 psArray *output = p_psDBFetchResult(config->dbh); 553 if (!output) { 554 psError(PS_ERR_UNKNOWN, false, "database error"); 555 return(false); 556 } 557 if (!psArrayLength(output)) { 558 psTrace("laptool", PS_LOG_INFO, "no rows found"); 559 psFree(output); 560 return(true); 561 } 562 563 if (!ippdbPrintMetadatas(stdout, output, "lapExp", !simple)) { 564 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 565 psFree(output); 566 return(false); 567 } 568 569 psFree(output); 570 return(true); 571 572 573 } 574 static bool updateexpMode(pxConfig *config) 575 { 576 PS_ASSERT_PTR_NON_NULL(config, false); 577 578 psMetadata *where = psMetadataAlloc(); 579 PXOPT_LOOKUP_S64(lap_id, config->args, "-lap_id", true, false); 580 PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", true, false); 581 PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", false, false); 582 583 PXOPT_LOOKUP_S64(set_chip_id, config->args, "-set_chip_id", false, false); 584 PXOPT_LOOKUP_BOOL(private, config->args, "-private", false, false); 585 PXOPT_LOOKUP_BOOL(active, config->args, "-active", false, false); 586 PXOPT_LOOKUP_BOOL(inactive, config->args, "-inactive", false, false); 587 588 if (active == inactive) { 589 psError(PS_ERR_UNKNOWN, false, "only one of -active and -inactive may be selected"); 590 } 591 592 psMetadata *where = psMetadataAlloc(); 593 PXOPT_COPY_S64(config->args, where, "-lap_id", "lap_id", "=="); 594 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 595 PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "=="); 596 597 psMetadata *values = psMetadataAlloc(); 598 if (set_chip_id) { 599 PXOPT_COPY_S64(config->args, values, "-set_chip_id", "chip_id", "=="); 600 } 601 if (private) { 602 PXOPT_COPY_BOOL(config->args, values, "-private", "private", "=="); 603 } 604 if (active) { 605 PXOPT_COPY_BOOL(config->args, values, "-active", "active", "=="); 606 } 607 if (inactive) { 608 psMetadataAddBool(values, PS_LIST_TAIL, "active", 0, "", false); 609 } 610 611 long rows = psDBUpdateRows(config->dbh,"lapExp",where,values); 612 if (rows) { 613 return(true); 614 } 615 else { 616 return(false); 617 } 618 } 619 620 621 622 733 } 734 -
branches/czw_branch/20110406/ippTools/src/laptool.h
r31385 r31396 9 9 10 10 typedef enum { 11 LAPTOOL_MODE_DEFINERUN = 0x0, 11 LAPTOOL_MODE_DEFINESEQUENCE = 0x0, 12 LAPTOOL_MODE_LISTSEQUENCE, 13 LAPTOOL_MODE_DEFINERUN, 12 14 LAPTOOL_MODE_PENDINGRUN, 15 LAPTOOL_MODE_UPDATERUN, 16 LAPTOOL_MODE_PENDINGEXP, 13 17 LAPTOOL_MODE_EXPOSURES, 14 LAPTOOL_MODE_PENDINGCHIPEXP, 15 LAPTOOL_MODE_PENDINGQUICKSTACK, 16 LAPTOOL_MODE_PENDINGDIFF, 17 LAPTOOL_MODE_PENDINGFINALSTACK, 18 LAPTOOL_MODE_UPDATERUN, 19 LAPTOOL_MODE_UPDATEEXP 18 LAPTOOL_MODE_STACKS, 19 LAPTOOL_MODE_UPDATEEXP, 20 LAPTOOL_MODE_INACTIVEEXP 20 21 } laptoolMode; 21 22 -
branches/czw_branch/20110406/ippTools/src/laptoolConfig.c
r31385 r31396 32 32 } 33 33 34 // -definesequence 35 psMetadata *definesequenceArgs = psMetadataAlloc(); 36 ADD_OPT(Str, definesequenceArgs, "-name", "short name for this LAP sequence (required)", NULL); 37 ADD_OPT(Str, definesequenceArgs, "-description", "define the description for this LAP sequence (required)", NULL); 38 ADD_OPT(Bool,definesequenceArgs, "-simple", "use the simple output format", false); 39 40 // -listsequence 41 psMetadata *listsequenceArgs = psMetadataAlloc(); 42 ADD_OPT(S64, listsequenceArgs, "-seq_id", "search by LAP sequence ID", 0); 43 ADD_OPT(Str, listsequenceArgs, "-seq_name", "search by LAP sequence name", 0); 44 ADD_OPT(Bool,listsequenceArgs, "-simple", "use the simple output format", false); 45 ADD_OPT(U64, listsequenceArgs, "-limit", "limit result set to N items", 0); 46 47 34 48 // -definerun 35 49 psMetadata *definerunArgs = psMetadataAlloc(); 50 ADD_OPT(S64, definerunArgs, "-seq_id", "define the LAP sequence for this run (required)", 0); 36 51 ADD_OPT(Str, definerunArgs, "-projection_cell", "define the projection cell for this run (required)", NULL); 37 52 ADD_OPT(Str, definerunArgs, "-tess_id", "define the tessellation used (required)", NULL); … … 39 54 ADD_OPT(F64, definerunArgs, "-decl", "define DEC center (required)", NAN); 40 55 ADD_OPT(F32, definerunArgs, "-radius", "define radius from center to consider (required)", NAN); 41 56 ADD_OPT(Str, definerunArgs, "-filter", "define the filter used (required)", NULL); 57 ADD_OPT(Str, definerunArgs, "-label", "define the label used", NULL); 58 ADD_OPT(Str, definerunArgs, "-dist_group", "define the distribution group for this data", NULL); 59 42 60 // -pendingrun 43 61 psMetadata *pendingrunArgs = psMetadataAlloc(); 44 ADD_OPT(Str, pendingrunArgs, "-projection_cell", "projection cell to consider", NULL); 45 ADD_OPT(S64, pendingrunArgs, "-lap_id", "lap run ID", 0); 46 ADD_OPT(U64, pendingrunArgs, "-limit", "limit result set to N items", 0); 47 ADD_OPT(Bool,pendingrunArgs, "-simple", "use the simple output format", false); 62 ADD_OPT(S64, pendingrunArgs, "-seq_id", "search by LAP sequence ID", 0); 63 ADD_OPT(S64, pendingrunArgs, "-lap_id", "search by LAP run ID", 0); 64 ADD_OPT(Str, pendingrunArgs, "-projection_cell", "search by projection cell", NULL); 65 ADD_OPT(Str, pendingrunArgs, "-filter", "search by filter", NULL); 66 ADD_OPT(Str, pendingrunArgs, "-label", "search by LAP run label", NULL); 67 ADD_OPT(Str, pendingrunArgs, "-state", "search by LAP run state", NULL); 68 ADD_OPT(Str, pendingrunArgs, "-fault", "search by LAP run fault", NULL); 69 70 // -updaterun 71 psMetadata *updaterunArgs = psMetadataAlloc(); 72 ADD_OPT(S64, updaterunArgs, "-lap_id", "search by lap run ID", 0); 73 ADD_OPT(Str, updaterunArgs, "-set_state", "set state", NULL); 74 ADD_OPT(S16, updaterunArgs, "-fault", "set fault code", INT16_MAX); 75 ADD_OPT(Str, updaterunArgs, "-set_label", "set label", NULL); 76 ADD_OPT(S64, updaterunArgs, "-set_quick_sass_id", "set quick stack sass_id", NAN); 77 ADD_OPT(S64, updaterunArgs, "-set_final_sass_id", "set final stack sass_id", NAN); 78 79 80 // -pendingexp 81 psMetadata *pendingexpArgs = psMetadataAlloc(); 82 ADD_OPT(S64, pendingexpArgs, "-lap_id", "lap run ID", 0); 83 ADD_OPT(Str, pendingexpArgs, "-projection_cell", "projection cell to consider", NULL); 84 ADD_OPT(U64, pendingexpArgs, "-limit", "limit result set to N items", 0); 85 ADD_OPT(Bool,pendingexpArgs, "-simple", "use the simple output format", false); 48 86 49 87 // -exposures 50 88 psMetadata *exposuresArgs = psMetadataAlloc(); 51 ADD_OPT(S64, exposuresArgs, "-lap_id", "search by lap run ID", 0); 52 ADD_OPT(Bool,exposuresArgs, "-simple", "use the simple output format", false); 89 ADD_OPT(S64, exposuresArgs, "-lap_id", "search by lap run ID", 0); 90 ADD_OPT(S64, exposuresArgs, "-exp_id", "search by exp_id", 0); 91 ADD_OPT(Bool,exposuresArgs, "-simple", "use the simple output format", false); 92 ADD_OPT(U64, exposuresArgs, "-limit", "limit result set to N items", 0); 53 93 54 // -pendingexp 55 psMetadata *pendingchipexpArgs = psMetadataAlloc(); 56 ADD_OPT(S64, pendingchipexpArgs, "-lap_id", "search by lap run ID", 0); 57 ADD_OPT(Str, pendingchipexpArgs, "-filter", "search by filter", 0); 58 ADD_OPT(Bool,pendingchipexpArgs, "-simple", "use the simple output format", false); 59 94 // -stacks 95 psMetadata *stacksArgs = psMetadataAlloc(); 96 ADD_OPT(S64, stacksArgs, "-lap_id", "search by lap run ID", 0); 97 ADD_OPT(Bool,stacksArgs, "-simple", "use the simple output format", false); 98 ADD_OPT(U64, stacksArgs, "-limit", "limit result set to N items", 0); 60 99 61 // -pendingquickstack62 psMetadata *pendingquickstackArgs = psMetadataAlloc();63 ADD_OPT(S64, pendingquickstackArgs, "-lap_id", "search by lap run ID", 0);64 ADD_OPT(Str, pendingquickstackArgs, "-filter", "search by filter", 0);65 ADD_OPT(Bool,pendingquickstackArgs, "-simple", "use the simple output format", false);66 67 // -pendingdiff68 psMetadata *pendingdiffArgs = psMetadataAlloc();69 ADD_OPT(S64, pendingdiffArgs, "-lap_id", "search by lap run ID", 0);70 ADD_OPT(Str, pendingdiffArgs, "-filter", "search by filter", 0);71 ADD_OPT(Bool,pendingdiffArgs, "-simple", "use the simple output format", false);72 73 // -pendingfinalstack74 psMetadata *pendingfinalstackArgs = psMetadataAlloc();75 ADD_OPT(S64, pendingfinalstackArgs, "-lap_id", "search by lap run ID", 0);76 ADD_OPT(Str, pendingfinalstackArgs, "-filter", "search by filter", 0);77 ADD_OPT(Bool,pendingfinalstackArgs, "-simple", "use the simple output format", false);78 79 // -updaterun80 psMetadata *updaterunArgs = psMetadataAlloc();81 ADD_OPT(S64, updaterunArgs, "-lap_id", "search by lap run ID", 0);82 ADD_OPT(Str, updaterunArgs, "-set_state", "set state", NULL);83 ADD_OPT(S16, updaterunArgs, "-fault", "set fault code", INT16_MAX);84 85 100 // -updateexp 86 101 psMetadata *updateexpArgs = psMetadataAlloc(); 87 ADD_OPT(S64, updateexpArgs, "-lap_id", "search by lap run ID", 0);102 ADD_OPT(S64, updateexpArgs, "-lap_id", "search by lap run ID", 0); 88 103 ADD_OPT(S64, updateexpArgs, "-exp_id", "search by exposure ID", 0); 89 104 ADD_OPT(S64, updateexpArgs, "-chip_id", "search by chip ID", 0); 90 105 ADD_OPT(S64, updateexpArgs, "-set_chip_id", "set the chip ID", 0); 106 ADD_OPT(S64, updateexpArgs, "-set_pair_id", "set the pair ID", 0); 91 107 ADD_OPT(Bool,updateexpArgs, "-private", "set this exposure as private", 0); 108 ADD_OPT(Bool,updateexpArgs, "-public", "set this exposure as public", 0); 109 ADD_OPT(Bool,updateexpArgs, "-pairwise", "set this exposure to be pairwise", 0); 110 ADD_OPT(Bool,updateexpArgs, "-nopairwise", "set this exposure to not be pairwise", 0); 92 111 ADD_OPT(Bool,updateexpArgs, "-active", "set this exposure to active", 0); 93 112 ADD_OPT(Bool,updateexpArgs, "-inactive", "set this exposure to active", 0); 94 113 95 114 // -inactiveexp 115 psMetadata *inactiveexpArgs = psMetadataAlloc(); 116 ADD_OPT(S64, inactiveexpArgs, "-lap_id", "search by lap run ID", 0); 117 ADD_OPT(Bool,inactiveexpArgs, "-simple", "use the simple output format", false); 118 ADD_OPT(U64, inactiveexpArgs, "-limit", "limit result set to N items", 0); 119 96 120 97 121 psMetadata *argSets = psMetadataAlloc(); 98 122 psMetadata *modes = psMetadataAlloc(); 99 123 124 PXOPT_ADD_MODE("-definesequence", "", LAPTOOL_MODE_DEFINESEQUENCE, definesequenceArgs); 125 PXOPT_ADD_MODE("-listsequence", "", LAPTOOL_MODE_LISTSEQUENCE, listsequenceArgs); 100 126 PXOPT_ADD_MODE("-definerun", "", LAPTOOL_MODE_DEFINERUN, definerunArgs); 101 127 PXOPT_ADD_MODE("-pendingrun", "", LAPTOOL_MODE_PENDINGRUN, pendingrunArgs); 128 PXOPT_ADD_MODE("-updaterun", "", LAPTOOL_MODE_UPDATERUN, updaterunArgs); 129 PXOPT_ADD_MODE("-pendingexp", "", LAPTOOL_MODE_PENDINGEXP, pendingexpArgs); 102 130 PXOPT_ADD_MODE("-exposures", "", LAPTOOL_MODE_EXPOSURES, exposuresArgs); 103 PXOPT_ADD_MODE("-pendingchipexp", "", LAPTOOL_MODE_PENDINGCHIPEXP, pendingchipexpArgs); 104 PXOPT_ADD_MODE("-pendingquickstack", "", LAPTOOL_MODE_PENDINGQUICKSTACK,pendingquickstackArgs); 105 PXOPT_ADD_MODE("-pendingdiff", "", LAPTOOL_MODE_PENDINGDIFF, pendingdiffArgs); 106 PXOPT_ADD_MODE("-pendingfinalstack", "", LAPTOOL_MODE_PENDINGFINALSTACK,pendingfinalstackArgs); 107 PXOPT_ADD_MODE("-updaterun", "", LAPTOOL_MODE_UPDATERUN, updaterunArgs); 131 PXOPT_ADD_MODE("-stacks", "", LAPTOOL_MODE_STACKS, stacksArgs); 108 132 PXOPT_ADD_MODE("-updateexp", "", LAPTOOL_MODE_UPDATEEXP, updateexpArgs); 109 133 PXOPT_ADD_MODE("-inactiveexp", "", LAPTOOL_MODE_INACTIVEEXP, inactiveexpArgs); 134 110 135 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) { 111 136 psError(PS_ERR_UNKNOWN, true, "option parsing failed");
Note:
See TracChangeset
for help on using the changeset viewer.
