Changeset 33301
- Timestamp:
- Feb 17, 2012, 6:20:27 AM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src
- Files:
-
- 8 edited
-
addstar/test/relphot.parallel.dvo (modified) (3 diffs)
-
libohana/include/ohana.h (modified) (1 diff)
-
libohana/src/findexec.c (modified) (1 diff)
-
relphot/include/relphot.h (modified) (2 diffs)
-
relphot/src/ConfigInit.c (modified) (1 diff)
-
relphot/src/load_catalogs.c (modified) (2 diffs)
-
relphot/src/reload_catalogs.c (modified) (4 diffs)
-
relphot/src/relphot_client.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/addstar/test/relphot.parallel.dvo
r33297 r33301 132 132 133 133 # run relphot on the parallel db and check that the images now match the expected values 134 exec relphot -parallel -serialg,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir.p0 -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& log.relphot.p0135 136 exec dvodist -in $catdir.p0 134 exec relphot -parallel g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir.p0 -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& log.relphot.p0 135 136 exec dvodist -in $catdir.p0 >& log.dvodist.in 137 137 138 138 for i 0 mjd_nc[] … … 432 432 $catdir = $tmp1/$tmp2 433 433 434 exec rsync -auv $catdir/ $catdir.p0/ 434 exec rsync -auv $catdir/ $catdir.p0/ >& log.rsync 435 435 mkdir $catdir.d1 436 436 mkdir $catdir.d2 … … 442 442 exec echo "3 $hostname $catdir.d3" >> $catdir.p0/HostTable.dat 443 443 444 exec dvodist -out $catdir.p0 445 end 446 444 exec dvodist -out $catdir.p0 >& log.dvodist.out 445 end 446 -
branches/eam_branches/ipp-20111122/Ohana/src/libohana/include/ohana.h
r33238 r33301 264 264 int check_dir_access PROTO((char *path, int verbose)); 265 265 int check_file_exec PROTO((char *filename)); 266 char *abspath PROTO((char *oldpath, int maxlength)); 266 267 267 268 /* in glockfile.c */ -
branches/eam_branches/ipp-20111122/Ohana/src/libohana/src/findexec.c
r27435 r33301 404 404 return TRUE; 405 405 } 406 407 // ohana-based equivalent to 'realpath'. realpath does not guarantee an absolute path (eg on Solaris), 408 // just a 'cannonical path'. I don't care about resolving out links, just ensuring an absolute path 409 // also, realpath is a bit ambiguous on the maxlength argument 410 char *abspath (char *oldpath, int maxlength) { 411 412 if (!oldpath) return NULL; 413 414 if (oldpath[0] == '/') { 415 char *newpath = strcreate (oldpath); 416 return newpath; 417 } 418 419 char *cwd = getcwd(NULL, maxlength); 420 if (cwd == NULL) { 421 // XXX need an error reporting function... 422 fprintf (stderr, "error getting cwd (longer than %d chars?)\n", maxlength); 423 return NULL; 424 } 425 426 char *newpath = NULL; 427 428 int Nbytes = strlen(cwd) + strlen(oldpath) + 2; 429 ALLOCATE (newpath, char, Nbytes); 430 snprintf (newpath, Nbytes, "%s/%s", cwd, oldpath); 431 return newpath; 432 } -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h
r33298 r33301 71 71 72 72 /* global variables set in parameter file */ 73 char ImageCat[256]; 74 char ImageTemplate[256]; 75 char CatTemplate[256]; 76 char GSCFILE[256]; 77 char CATDIR[256]; 73 # define MAX_PATH_LENGTH 1024 74 char ImageCat[MAX_PATH_LENGTH]; 75 char ImageTemplate[MAX_PATH_LENGTH]; 76 char CatTemplate[MAX_PATH_LENGTH]; 77 char GSCFILE[MAX_PATH_LENGTH]; 78 char *CATDIR; 78 79 char CATMODE[16]; /* raw, mef, split, mysql */ 79 80 char CATFORMAT[16]; /* internal, elixir, loneos, panstarrs */ 80 char CameraConfig[ 256];81 char SKY_TABLE[ 256];81 char CameraConfig[MAX_PATH_LENGTH]; 82 char SKY_TABLE[MAX_PATH_LENGTH]; 82 83 int SKY_DEPTH; /** XXX EAM : depth of catalog tables, fix usage */ 83 84 … … 314 315 int CopyMeasureTiny (MeasureTiny *measureT, Measure *measure); 315 316 317 int HostTableWaitJobs (HostTable *table, char *file, int lineno); -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ConfigInit.c
r30616 r33301 33 33 GetConfig (config, "IMAGE_GOOD_FRACTION", "%lf", 0, &IMAGE_GOOD_FRACTION); 34 34 35 // force CATDIR to be absolute (so parallel mode will work) 36 char *tmpcatdir = NULL; 37 ALLOCATE (tmpcatdir, char, MAX_PATH_LENGTH); 38 GetConfig (config, "CATDIR", "%s", 0, tmpcatdir); 39 CATDIR = abspath (tmpcatdir, MAX_PATH_LENGTH); 40 free (tmpcatdir); 41 35 42 GetConfig (config, "GSCFILE", "%s", 0, GSCFILE); 36 GetConfig (config, "CATDIR", "%s", 0, CATDIR);37 43 ScanConfig (config, "CATMODE", "%s", 0, CATMODE); 38 44 ScanConfig (config, "CATFORMAT", "%s", 0, CATFORMAT); -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/load_catalogs.c
r33300 r33301 108 108 } 109 109 110 char *cwd;111 if ((cwd = getcwd(NULL, 1024)) == NULL) {112 fprintf (stderr, "error getting cwd (longer than 1024 chars?)\n");113 exit (1);114 }115 116 110 int i; 117 111 for (i = 0; i < table->Nhosts; i++) { 118 112 119 // if table->hosts[i].pathname is a relative path (pathname[0] is not '/'), then 120 // we need to prepend our current path 121 122 if (table->hosts[i].pathname[0] != '/') { 123 int Nbytes = strlen(cwd) + strlen(table->hosts[i].pathname) + 2; 124 char *newpath = NULL; 125 ALLOCATE (newpath, char, Nbytes); 126 snprintf (newpath, Nbytes, "%s/%s", cwd, table->hosts[i].pathname); 127 free (table->hosts[i].pathname); 128 table->hosts[i].pathname = newpath; 129 } 113 // ensure that the paths are absolute path names 114 char *tmppath = abspath (table->hosts[i].pathname, MAX_PATH_LENGTH); 115 free (table->hosts[i].pathname); 116 table->hosts[i].pathname = tmppath; 130 117 131 118 char catalogFile[512]; … … 190 177 } 191 178 if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) { 192 // we have launched table->Nhosts jobs; wait for all of them to complete... 193 for (i = 0; i < table->Nhosts; i++) { 194 int status = 0; 195 int pid = waitpid (-1, &status, 0); 196 197 // XXX we'll need to pass in WNOHANG and keep retrying if we want to have a timeout... 198 // find the host which has finished 199 int j; 200 for (j = 0; j < table->Nhosts; j++) { 201 if (table->hosts[j].pid != pid) continue; 202 // check on the status of this and report any output? 203 fprintf (stderr, "job finished for %s (%d)\n", table->hosts[j].hostname, pid); 204 if (WIFEXITED(status)) { 205 fprintf (stderr, "normal completion, exit status is %d\n", WEXITSTATUS(status)); 206 if (WEXITSTATUS(status)) { 207 fprintf (stderr, "job failed on %s\n", table->hosts[j].hostname); 208 } 209 } 210 // read the stderr and stdout 211 IOBuffer buffer; 212 InitIOBuffer (&buffer, 100); 213 EmptyIOBuffer (&buffer, 100, table->hosts[j].stdio[1]); 214 fprintf (stderr, "--- stdout from %s ---\n", table->hosts[j].hostname); 215 write (STDOUT_FILENO, buffer.buffer, buffer.Nbuffer); 216 fprintf (stderr, "\n"); 217 218 InitIOBuffer (&buffer, 100); 219 EmptyIOBuffer (&buffer, 100, table->hosts[j].stdio[2]); 220 fprintf (stderr, "--- stderr from %s ---\n", table->hosts[j].hostname); 221 write (STDOUT_FILENO, buffer.buffer, buffer.Nbuffer); 222 fprintf (stderr, "\n"); 223 } 224 } 179 HostTableWaitJobs (table, __FILE__, __LINE__); 225 180 } 226 181 -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c
r33298 r33301 1 1 # include "relphot.h" 2 # include <sys/types.h> 3 # include <sys/wait.h> 2 4 3 5 # define DEBUG 1 … … 132 134 int i; 133 135 for (i = 0; i < table->Nhosts; i++) { 136 137 // ensure that the paths are absolute path names 138 char *tmppath = abspath (table->hosts[i].pathname, MAX_PATH_LENGTH); 139 free (table->hosts[i].pathname); 140 table->hosts[i].pathname = tmppath; 134 141 135 142 char command[1024]; … … 179 186 } 180 187 table->hosts[i].pid = pid; // save for future reference 181 // check that all hosts started OK?182 188 } 183 189 } … … 186 192 fprintf (stderr, "run the relphot_client commands above. when these are done, hit return\n"); 187 193 getchar(); 188 } else { 189 // watch for stdout / stderr from those jobs... 190 // wait for all of them to complete... 191 } 192 194 } 195 if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) { 196 HostTableWaitJobs (table, __FILE__, __LINE__); 197 } 193 198 return (TRUE); 194 199 } 200 201 // wait for all children to complete, report output to stdout 202 int HostTableWaitJobs (HostTable *table, char *file, int lineno) { 203 204 int i; 205 206 // we have launched table->Nhosts jobs; wait for all of them to complete... 207 // if one (N) failed to launch, we will get an ECHILD error from the last (N) calls 208 int done = FALSE; 209 for (i = 0; !done && (i < table->Nhosts); i++) { 210 int status = 0; 211 212 // XXX we'll need to pass in WNOHANG and keep retrying if we want to have a timeout... 213 int pid = waitpid (-1, &status, 0); 214 if (!pid) { 215 // this should only occur if we called waitpid with the WNOHANG option 216 fprintf (stderr, "programming error (1)? %s %d", file, lineno); 217 exit (2); 218 } 219 if (pid == -1) { 220 switch (errno) { 221 case ECHILD: 222 done = TRUE; 223 break; 224 default: 225 fprintf (stderr, "programming error (2)? %s %d", file, lineno); 226 exit (2); 227 } 228 } 229 230 // find the host which has finished 231 int j; 232 int found = FALSE; 233 for (j = 0; j < table->Nhosts; j++) { 234 if (table->hosts[j].pid != pid) continue; 235 found = TRUE; 236 // check on the status of this and report any output? 237 fprintf (stderr, "job finished for %s (%d)\n", table->hosts[j].hostname, pid); 238 // read the stderr and stdout 239 IOBuffer buffer; 240 InitIOBuffer (&buffer, 100); 241 EmptyIOBuffer (&buffer, 100, table->hosts[j].stdio[1]); 242 fprintf (stderr, "--- stdout from %s ---\n", table->hosts[j].hostname); 243 write (STDOUT_FILENO, buffer.buffer, buffer.Nbuffer); 244 fprintf (stderr, "\n"); 245 246 InitIOBuffer (&buffer, 100); 247 EmptyIOBuffer (&buffer, 100, table->hosts[j].stdio[2]); 248 fprintf (stderr, "--- stderr from %s ---\n", table->hosts[j].hostname); 249 write (STDOUT_FILENO, buffer.buffer, buffer.Nbuffer); 250 fprintf (stderr, "\n"); 251 if (WIFEXITED(status)) { 252 fprintf (stderr, "normal completion, exit status is %d\n", WEXITSTATUS(status)); 253 if (WEXITSTATUS(status)) { 254 fprintf (stderr, "job failed on %s\n", table->hosts[j].hostname); 255 exit (1); 256 } 257 } else { 258 fprintf (stderr, "job exited abnormally on %s\n", table->hosts[j].hostname); 259 exit (1); 260 } 261 } 262 if (!found) { 263 fprintf (stderr, "failed to matched finished job to known host!\n"); 264 exit (2); 265 } 266 } 267 return TRUE; 268 } -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/relphot_client.c
r33254 r33301 22 22 // load the current sky table (layout of all SkyRegions) 23 23 SkyTable *sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, -1, VERBOSE); 24 if (!sky) { 25 fprintf (stderr, "ERROR running loading sky table from %s\n", CATDIR); 26 exit (2); 27 } 24 28 SkyTableSetFilenames (sky, CATDIR, "cpt"); 25 29 26 30 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch); 31 if (!skylist) { 32 fprintf (stderr, "ERROR setting up skylist for %s\n", CATDIR); 33 exit (2); 34 } 27 35 28 36 switch (MODE) { … … 30 38 int Ncatalog; 31 39 Catalog *catalog = load_catalogs (skylist, &Ncatalog, HOST_ID, HOSTDIR); 40 if (!catalog) { 41 fprintf (stderr, "ERROR loading catalogs from %s\n", CATDIR); 42 exit (2); 43 } 32 44 BrightCatalog *bcatalog = BrightCatalogMerge (catalog, Ncatalog); 33 45 if (!BrightCatalogSave (BCATALOG, bcatalog)) { 34 abort(); 46 fprintf (stderr, "ERROR saving bright catalog from %s\n", CATDIR); 47 exit (2); 35 48 } 36 49 break; … … 41 54 off_t Nimage; 42 55 ImageSubset *image = ImageSubsetLoad (IMAGES, &Nimage); 56 if (!image) { 57 fprintf (stderr, "ERROR loading image subset %s\n", CATDIR); 58 exit (2); 59 } 43 60 44 61 // save the available image information in the static array in ImageOps.c
Note:
See TracChangeset
for help on using the changeset viewer.
