Changeset 38271
- Timestamp:
- May 13, 2015, 11:37:34 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150419/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c
r38062 r38271 1 1 # include "dvomerge.h" 2 2 # define DEBUG 1 3 # define MACHINE_GROUPS 1 3 4 4 5 // in parallel mode, the target database may be distributed, while the input database is … … 9 10 10 11 int dvomergeUpdate_parallel (char *input, char *output, SkyTable *outsky, IDmapType *IDmap); 12 int dvomergeUpdate_parallel_group (HostTableGroup *group, char *absinput, char *absoutput, SkyTable *sky); 13 int dvomergeUpdate_parallel_table (HostTable *table, char *absinput, char *absoutput); 11 14 12 15 int dvomergeUpdate_catalogs (char *input, char *output, SkyTable *outsky, SkyList *inlist, int NsecfiltInput, int NsecfiltOutput, IDmapType *IDmap, int *secfiltMap) { … … 254 257 } 255 258 259 # if (MACHINE_GROUPS) 260 int Ngroups; 261 HostTableGroup *groups = HostTableGroups (table, &Ngroups); 262 // split the table into Ngroups, each with a unique set of machines (this avoids overloading the remote host machines) 263 264 int i; 265 for (i = 0; i < Ngroups; i++) { 266 // update only a group of unique machines at a time 267 dvomergeUpdate_parallel_group (&groups[i], absinput, absoutput, outsky); 268 } 269 # else 270 dvomergeUpdate_parallel_table (table, absinput, absoutput); 271 # endif 272 273 return TRUE; 274 } 275 276 // launch the dvomergeUpdate_client jobs to the parallel hosts 277 int dvomergeUpdate_parallel_table (HostTable *table, char *absinput, char *absoutput) { 278 256 279 int i; 257 280 for (i = 0; i < table->Nhosts; i++) { … … 320 343 return TRUE; 321 344 } 345 346 // launch the dvomergeUpdate_client jobs to the parallel hosts 347 int dvomergeUpdate_parallel_group (HostTableGroup *group, char *absinput, char *absoutput, SkyTable *sky) { 348 349 int i, j; 350 for (i = 0; i < group->Nhosts; i++) { 351 352 if (sky->Nregions < group->Nhosts) { 353 // do any of the regions want this host? 354 int wantThisHost = FALSE; 355 for (j = 0; j < sky->Nregions; j++) { 356 if (HostTableTestHost (&sky->regions[j], group->hosts[i][0].hostID)) { 357 wantThisHost = TRUE; 358 break; 359 } 360 } 361 if (!wantThisHost) { 362 // fprintf (stderr, "skip host %s\n", group->hosts[i][0].hostname); 363 continue; 364 } 365 } 366 367 // ensure that the paths are absolute path names 368 char *tmppath = abspath (group->hosts[i][0].pathname, DVO_MAX_PATH); 369 free (group->hosts[i][0].pathname); 370 group->hosts[i][0].pathname = tmppath; 371 372 // options / arguments that can affect relastro_client -update-objects: 373 char command[DVO_MAX_PATH]; 374 snprintf (command, DVO_MAX_PATH, "dvomerge_client %s into %s -hostID %d -hostdir %s -region %f %f %f %f -D ADDSTAR_RADIUS %f", 375 absinput, absoutput, group->hosts[i][0].hostID, group->hosts[i][0].pathname, 376 UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, RADIUS 377 ); 378 379 char tmpline[DVO_MAX_PATH]; 380 if (VERBOSE) { snprintf (tmpline, DVO_MAX_PATH, "%s -v", command); strcpy (command, tmpline); } 381 if (VERIFY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify", command); strcpy (command, tmpline); } 382 if (VERIFY_CATALOG_ONLY) { snprintf (tmpline, DVO_MAX_PATH, "%s -verify-catalogs", command); strcpy (command, tmpline); } 383 if (REPLACE_BY_PHOTCODE) { snprintf (tmpline, DVO_MAX_PATH, "%s -replace", command); strcpy (command, tmpline); } 384 if (PARALLEL_INPUT) { snprintf (tmpline, DVO_MAX_PATH, "%s -parallel-input", command); strcpy (command, tmpline); } 385 if (FORCE_MERGE) { snprintf (tmpline, DVO_MAX_PATH, "%s -force-merge", command); strcpy (command, tmpline); } 386 if (MATCHED_TABLES) { snprintf (tmpline, DVO_MAX_PATH, "%s -matched-tables", command); strcpy (command, tmpline); } 387 if (UPDATE_CATFORMAT) { snprintf (tmpline, DVO_MAX_PATH, "%s -update-catformat %s", command, UPDATE_CATFORMAT); strcpy (command, tmpline); } 388 389 // add some config variables: 390 snprintf (tmpline, DVO_MAX_PATH, "%s -D CATMODE %s", command, CATMODE); strcpy (command, tmpline); 391 snprintf (tmpline, DVO_MAX_PATH, "%s -D CATFORMAT %s", command, CATFORMAT); strcpy (command, tmpline); 392 snprintf (tmpline, DVO_MAX_PATH, "%s -D SKY_DEPTH %d", command, SKY_DEPTH); strcpy (command, tmpline); 393 394 fprintf (stderr, "command: %s\n", command); 395 396 if (PARALLEL_MANUAL) continue; 397 398 if (PARALLEL_SERIAL) { 399 int status = system (command); 400 if (status) { 401 fprintf (stderr, "ERROR running photdbc_client\n"); 402 exit (2); 403 } 404 } else { 405 // launch the job on the remote machine (no handshake) 406 int errorInfo = 0; 407 int pid = rconnect ("ssh", group->hosts[i][0].hostname, command, group->hosts[i][0].stdio, &errorInfo, FALSE); 408 if (!pid) { 409 if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", group->hosts[i][0].hostname, errorInfo); 410 exit (1); 411 } 412 group->hosts[i][0].pid = pid; // save for future reference 413 } 414 } 415 416 if (PARALLEL_MANUAL) { 417 fprintf (stderr, "run the photdbc_client commands above. when these are done, hit return\n"); 418 getchar(); 419 } 420 if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) { 421 int status = HostTableGroupWaitJobsGetIO (group, __FILE__, __LINE__, VERBOSE); 422 if (!status) { 423 fprintf (stderr, "error running one of the remote clients\n"); 424 return status; 425 } 426 } 427 428 return TRUE; 429 }
Note:
See TracChangeset
for help on using the changeset viewer.
