Changeset 24427
- Timestamp:
- Jun 15, 2009, 5:28:09 PM (17 years ago)
- Location:
- branches/pap_mops
- Files:
-
- 1 added
- 1 deleted
- 11 edited
-
dbconfig/publish.md (modified) (2 diffs)
-
ippScripts/Build.PL (modified) (1 diff)
-
ippScripts/scripts/publish_file.pl (added)
-
ippTools/doc/publish_flow.txt (modified) (1 diff)
-
ippTools/share/Makefile.am (modified) (1 diff)
-
ippTools/share/difftool_skyfile.sql (modified) (2 diffs)
-
ippTools/share/pubtool_advance.sql (deleted)
-
ippTools/share/pubtool_pending.sql (modified) (3 diffs)
-
ippTools/share/pubtool_revert.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (3 diffs)
-
ippTools/src/pubtool.c (modified) (12 diffs)
-
ippTools/src/pubtool.h (modified) (1 diff)
-
ippTools/src/pubtoolConfig.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_mops/dbconfig/publish.md
r24413 r24427 3 3 publishClient METADATA 4 4 client_id S64 0 # Primary Key AUTO_INCREMENT 5 product STR 64 5 6 stage STR 64 6 destination STR 2557 format STR 648 7 comment STR 255 9 8 END … … 13 12 client_id S64 0 14 13 stage_id S64 0 14 workdir STR 255 15 15 label STR 64 16 16 state STR 64 17 17 END 18 18 19 publish File METADATA19 publishDone METADATA 20 20 pub_id S64 0 # Primary Key 21 component STR 64 # Primary Key21 path_base STR 255 22 22 fault S16 0 23 23 END -
branches/pap_mops/ippScripts/Build.PL
r24174 r24427 90 90 scripts/receive_setstatus.pl 91 91 scripts/rcserver_checkstatus.pl 92 scripts/publish_file.pl 92 93 )], 93 94 dist_abstract => 'Scripts for running the Pan-STARRS IPP', -
branches/pap_mops/ippTools/doc/publish_flow.txt
r24413 r24427 3 3 4 4 ### Regularly run by pantasks to generate publishing runs based on data that has been processed 5 pubtool -definerun 5 pubtool -definerun -workdir /path/to/somewhere 6 6 7 7 ### Regularly run by pantasks to get list of files to publish 8 8 pubtool -pending 9 --> publish_file.pl --pub_id 12345 -- component skycell.123.456 --destination DataStore --stage diff --stage_id 67890 --format MOPS10 ----> pubtool -add -pub_id 12345 - -component skycell.123.456 --fault 09 --> publish_file.pl --pub_id 12345 --workdir /path/to/somewhere --product IPP-MOPS --stage diff --stage_id 67890 10 ----> pubtool -add -pub_id 12345 -path_base /path/to/somewherenice -fault 0 11 11 12 12 ### Run as required 13 13 pubtool -revert 14 14 15 ### Regularly run by pantasks to mark running publish runs as 'full'16 pubtool -advance -
branches/pap_mops/ippTools/share/Makefile.am
r24174 r24427 167 167 pxadmin_create_mirror_tables.sql \ 168 168 pxadmin_drop_tables.sql \ 169 pubtool_definerun.sql \ 170 pubtool_pending.sql \ 171 pubtool_revert.sql \ 169 172 pztool_find_completed_exp.sql \ 170 173 pztool_pendingimfile.sql \ -
branches/pap_mops/ippTools/share/difftool_skyfile.sql
r24416 r24427 6 6 diffRun.workdir, 7 7 diffRun.bothways, 8 camProcessedExp.zpt_obs, 9 camProcessedExp.zpt_stdev, 10 camProcessedExp.zpt_lq, 11 camProcessedExp.zpt_uq, 8 12 warp1, 9 13 stack1, … … 14 18 JOIN diffInputSkyfile USING(diff_id, skycell_id) 15 19 JOIN warpRun 16 ON warpRun.warp_id = diffInputSkyfile.warp1 20 ON warpRun.warp_id = diffInputSkyfile.warp1 -- NOTE: joining input only! 17 21 JOIN fakeRun USING(fake_id) 18 22 JOIN camRun USING(cam_id) 23 JOIN camProcessedExp USING(cam_id) 19 24 JOIN chipRun USING(chip_id) 20 25 JOIN rawExp USING(exp_id) -
branches/pap_mops/ippTools/share/pubtool_pending.sql
r24392 r24427 1 1 SELECT 2 publishRun.pub_id, 3 publishRun.stage_id, 4 publishClient.destination, 5 publishClient.stage, 6 publishClient.format, 7 publishToDo.component 8 FROM publishRun 9 JOIN publishClient USING(client_id) 10 JOIN (( 2 publishToDo.* 3 FROM (( 11 4 SELECT 12 pub_id, 13 diff_id AS stage_id, 14 skycell_id AS component 5 publishRun.pub_id, 6 publishClient.product, 7 publishClient.stage, 8 diffRun.diff_id AS stage_id, 9 publishRun.workdir 15 10 FROM publishRun 16 11 JOIN publishClient USING(client_id) … … 19 14 JOIN diffSkyfile USING(diff_id) 20 15 WHERE publishClient.stage = 'diff' 16 AND publishRun.state = 'new' 17 AND diffRun.state = 'full' 21 18 ) AS publishDiffs UNION ( 22 19 SELECT 23 pub_id, 24 cam_id AS stage_id, 25 NULL AS component 20 publishRun.pub_id, 21 publishClient.product, 22 publishClient.stage, 23 camRun.cam_id AS stage_id, 24 publishRun.workdir 26 25 FROM publishRun 27 26 JOIN publishClient USING(client_id) … … 29 28 ON camRun.cam_id = publishRun.stage_id 30 29 WHERE publishClient.stage = 'camera' 30 AND publishRun.state ='new' 31 AND camRun.state = 'full' 31 32 ) AS publishCams 32 ) AS publishToDo USING(pub_id, stage_id) 33 LEFT JOIN publishFile USING(pub_id, component) 34 WHERE publishRun.state = 'new' 35 AND publishFile.pub_id IS NULL 33 ) AS publishToDo 34 LEFT JOIN publishDone USING(pub_id) 35 WHERE publishDone.pub_id IS NULL -
branches/pap_mops/ippTools/share/pubtool_revert.sql
r24413 r24427 1 DELETE FROM publish File2 USING publish File, publishRun, publishClient3 WHERE publish File.pub_id = publishRun.pub_id1 DELETE FROM publishDone 2 USING publishDone, publishRun, publishClient 3 WHERE publishDone.pub_id = publishRun.pub_id 4 4 AND publishRun.client_id = publishClient.client_id 5 AND receiveResult.fault != 05 AND publishDone.fault != 0 -
branches/pap_mops/ippTools/share/pxadmin_create_tables.sql
r24377 r24427 1374 1374 CREATE TABLE publishClient ( 1375 1375 client_id BIGINT AUTO_INCREMENT, -- unique identifier 1376 product VARCHAR(64), -- product name 1377 stage VARCHAR(64) NOT NULL, -- stage of interest (chip, camera, diff, etc.) 1376 1378 comment VARCHAR(255), -- for human memory 1377 stage VARCHAR(64) NOT NULL, -- stage of interest (chip, camera, diff, etc.)1378 format VARCHAR(64), -- format of data1379 destination VARCHAR(255) NOT NULL, -- where to send data1380 1379 PRIMARY KEY(client_id) 1381 1380 ) ENGINE=innodb DEFAULT CHARSET=latin1; … … 1386 1385 client_id BIGINT NOT NULL, -- link to publishClient 1387 1386 stage_id BIGINT NOT NULL, -- link to various stage tables 1387 workdir VARCHAR(255) NOT NULL, -- working directory 1388 1388 label VARCHAR(64), -- label for run 1389 1389 state VARCHAR(64), -- state of run (new, full, etc.) … … 1397 1397 1398 1398 -- Publishing a file within a set 1399 CREATE TABLE publish File (1399 CREATE TABLE publishDone ( 1400 1400 pub_id BIGINT AUTO_INCREMENT, -- link to publishRun 1401 component VARCHAR(64), -- analagous to class_id or skycell_id1401 path_base VARCHAR(255), -- base path of output 1402 1402 fault SMALLINT NOT NULL DEFAULT 0, -- Fault code 1403 PRIMARY KEY(pub_id, component), 1404 KEY(component), 1403 PRIMARY KEY(pub_id), 1405 1404 KEY(fault), 1406 1405 FOREIGN KEY(pub_id) REFERENCES publishRun(pub_id) -
branches/pap_mops/ippTools/src/pubtool.c
r24413 r24427 36 36 static bool addMode(pxConfig *config); 37 37 static bool revertMode(pxConfig *config); 38 static bool advanceMode(pxConfig *config);39 38 40 39 # define MODECASE(caseName, func) \ … … 62 61 MODECASE(PUBTOOL_MODE_ADD, addMode); 63 62 MODECASE(PUBTOOL_MODE_REVERT, revertMode); 64 MODECASE(PUBTOOL_MODE_ADVANCE, advanceMode);65 63 default: 66 64 psAbort("invalid option (this should not happen)"); … … 89 87 90 88 // required 89 PXOPT_LOOKUP_STR(product, config->args, "-product", true, false); 91 90 PXOPT_LOOKUP_STR(stage, config->args, "-stage", true, false); 92 PXOPT_LOOKUP_STR(destination, config->args, "-destination", true, false);93 91 94 92 // optional 95 PXOPT_LOOKUP_STR(format, config->args, "-format", false, false);96 93 PXOPT_LOOKUP_STR(comment, config->args, "-comment", false, false); 97 94 98 if (!publishClientInsert(config->dbh, 0, stage, destination, format, comment)) {95 if (!publishClientInsert(config->dbh, 0, product, stage, comment)) { 99 96 psError(PS_ERR_UNKNOWN, false, "Database error"); 100 97 return false; … … 109 106 110 107 psMetadata *where = psMetadataAlloc(); // WHERE conditions 108 109 // required 110 PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", true, false); 111 111 112 112 // optional … … 141 141 psFree(query); 142 142 psFree(whereClause); 143 if (!psDB Transaction(config->dbh)) {143 if (!psDBRollback(config->dbh)) { 144 144 psError(PS_ERR_UNKNOWN, false, "Database error"); 145 145 } … … 152 152 if (!output) { 153 153 psError(PS_ERR_UNKNOWN, false, "Database error"); 154 if (!psDB Transaction(config->dbh)) {154 if (!psDBRollback(config->dbh)) { 155 155 psError(PS_ERR_UNKNOWN, false, "Database error"); 156 156 } … … 160 160 psTrace("pubtool", PS_LOG_INFO, "No rows found"); 161 161 psFree(output); 162 if (!psDB Transaction(config->dbh)) {162 if (!psDBRollback(config->dbh)) { 163 163 psError(PS_ERR_UNKNOWN, false, "Database error"); 164 164 } … … 171 171 psS64 stage = psMetadataLookupS64(NULL, row, "stage_id"); // Stage identifier 172 172 173 if (!publishRunInsert(config->dbh, 0, client, stage, set_label, "new")) {173 if (!publishRunInsert(config->dbh, 0, client, stage, workdir, set_label, "new")) { 174 174 psError(PS_ERR_UNKNOWN, false, "Unable to add fileset"); 175 175 psFree(output); 176 if (!psDB Transaction(config->dbh)) {176 if (!psDBRollback(config->dbh)) { 177 177 psError(PS_ERR_UNKNOWN, false, "Database error"); 178 178 } … … 182 182 psFree(output); 183 183 184 if (!psDB Transaction(config->dbh)) {184 if (!psDBCommit(config->dbh)) { 185 185 psError(PS_ERR_UNKNOWN, false, "Database error"); 186 186 return false; … … 259 259 // required 260 260 PXOPT_LOOKUP_S64(pub_id, config->args, "-pub_id", true, false); 261 PXOPT_LOOKUP_STR( component, config->args, "-component",true, false);261 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", true, false); 262 262 263 263 // optional 264 264 PXOPT_LOOKUP_S32(fault, config->args, "-fault", false, false); 265 265 266 if (!publishFileInsert(config->dbh, pub_id, component, fault)) { 266 if (!psDBTransaction(config->dbh)) { 267 psError(PS_ERR_UNKNOWN, false, "Database error"); 268 return false; 269 } 270 271 if (!publishDoneInsert(config->dbh, pub_id, path_base, fault)) { 267 272 psError(PS_ERR_UNKNOWN, false, "Unable to add file"); 273 if (!psDBRollback(config->dbh)) { 274 psError(PS_ERR_UNKNOWN, false, "Database error"); 275 } 276 return false; 277 } 278 279 if (!p_psDBRunQueryF(config->dbh, 280 "UPDATE publishRun SET state = 'full' WHERE pub_id = %" PRId64, 281 pub_id)) { 282 psError(PS_ERR_UNKNOWN, false, "Database error"); 283 if (!psDBRollback(config->dbh)) { 284 psError(PS_ERR_UNKNOWN, false, "Database error"); 285 } 286 return false; 287 } 288 289 if (!psDBCommit(config->dbh)) { 290 psError(PS_ERR_UNKNOWN, false, "Database error"); 268 291 return false; 269 292 } … … 283 306 PXOPT_COPY_S32(config->args, where, "-fault", "fault", "=="); 284 307 PXOPT_COPY_STR(config->args, where, "-client_id", "client_id", "=="); 285 PXOPT_COPY_STR(config->args, where, "-component", "component", "==");286 308 PXOPT_COPY_STR(config->args, where, "-comment", "comment", "LIKE"); 287 309 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); … … 310 332 return true; 311 333 } 312 static bool advanceMode(pxConfig *config) 313 { 314 PS_ASSERT_PTR_NON_NULL(config, false); 315 316 psString query = pxDataGet("pubtool_advance.sql"); 317 if (!query) { 318 psError(PXTOOLS_ERR_DATA, false, "Failed to retreive SQL statement"); 319 return false; 320 } 321 322 if (!p_psDBRunQuery(config->dbh, query)) { 323 psError(PS_ERR_UNKNOWN, false, "Database error"); 324 psFree(query); 325 return false; 326 } 327 psFree(query); 328 329 return true; 330 } 334 -
branches/pap_mops/ippTools/src/pubtool.h
r24377 r24427 30 30 PUBTOOL_MODE_ADD, 31 31 PUBTOOL_MODE_REVERT, 32 PUBTOOL_MODE_ADVANCE,33 32 } pubtoolMode; 34 33 -
branches/pap_mops/ippTools/src/pubtoolConfig.c
r24413 r24427 46 46 psMetadata *defineclientArgs = psMetadataAlloc(); 47 47 psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-stage", 0, "define stage (required)", NULL); 48 psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-destination", 0, "define destination (required)", NULL); 49 psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-format", 0, "define format", NULL); 48 psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-product", 0, "define product (required)", NULL); 50 49 psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-comment", 0, "define comment", NULL); 51 50 52 51 // -definerun 53 52 psMetadata *definerunArgs = psMetadataAlloc(); 53 psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-workdir", 0, "define workdir (required)", NULL); 54 54 psMetadataAddS64(definerunArgs, PS_LIST_TAIL, "-set_label", 0, "define label", 0); 55 55 psMetadataAddS64(definerunArgs, PS_LIST_TAIL, "-client_id", 0, "search by client_id", 0); … … 68 68 psMetadata *addArgs = psMetadataAlloc(); 69 69 psMetadataAddS64(addArgs, PS_LIST_TAIL, "-pub_id", 0, "define pub_id (required)", 0); 70 psMetadataAddStr(addArgs, PS_LIST_TAIL, "-component", 0, "define component (required)", NULL);71 70 psMetadataAddS32(addArgs, PS_LIST_TAIL, "-fault", 0, "define fault code", 0); 72 71 … … 74 73 psMetadata *revertArgs = psMetadataAlloc(); 75 74 psMetadataAddS64(revertArgs, PS_LIST_TAIL, "-pub_id", 0, "search on pub_id", 0); 76 psMetadataAddStr(revertArgs, PS_LIST_TAIL, "-component", 0, "search on component", NULL);77 75 psMetadataAddS32(revertArgs, PS_LIST_TAIL, "-fault", 0, "search on fault code", 0); 78 76 psMetadataAddStr(revertArgs, PS_LIST_TAIL, "-client_id", 0, "search on client_id", NULL); … … 80 78 psMetadataAddStr(revertArgs, PS_LIST_TAIL, "-label", 0, "search on label", NULL); 81 79 82 // -advance83 psMetadata *advanceArgs = psMetadataAlloc();84 80 85 81 psMetadata *argSets = psMetadataAlloc(); … … 91 87 PXOPT_ADD_MODE("-add", "", PUBTOOL_MODE_ADD, addArgs); 92 88 PXOPT_ADD_MODE("-revert", "", PUBTOOL_MODE_REVERT, revertArgs); 93 PXOPT_ADD_MODE("-advance", "", PUBTOOL_MODE_ADVANCE, advanceArgs);94 89 95 90 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
Note:
See TracChangeset
for help on using the changeset viewer.
