Changeset 33303
- Timestamp:
- Feb 17, 2012, 2:42:48 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src
- Files:
-
- 17 edited
-
addstar/test/relphot.setphot.parallel.dvo (modified) (4 diffs)
-
libdvo/include/dvo.h (modified) (1 diff)
-
libdvo/src/HostTable.c (modified) (2 diffs)
-
photdbc/src/CopyFromHostLocation.c (modified) (1 diff)
-
photdbc/src/CopyToHostLocation.c (modified) (2 diffs)
-
relphot/include/relphot.h (modified) (1 diff)
-
relphot/src/ImageSubset.c (modified) (1 diff)
-
relphot/src/args.c (modified) (1 diff)
-
relphot/src/load_catalogs.c (modified) (2 diffs)
-
relphot/src/reload_catalogs.c (modified) (3 diffs)
-
uniphot/include/setphot.h (modified) (1 diff)
-
uniphot/src/ImageSubset.c (modified) (2 diffs)
-
uniphot/src/initialize_setphot.c (modified) (2 diffs)
-
uniphot/src/initialize_setphot_client.c (modified) (3 diffs)
-
uniphot/src/match_zpts_to_images.c (modified) (1 diff)
-
uniphot/src/setphot.c (modified) (1 diff)
-
uniphot/src/update_dvo_setphot.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/addstar/test/relphot.setphot.parallel.dvo
r33302 r33303 158 158 159 159 # run setphot on the serial db and check that the images now match the expected values 160 exec setphot - update -ubercal testzpt.fits -D CATDIR $catdir160 exec setphot -reset -update -ubercal testzpt.fits -D CATDIR $catdir 161 161 for i 0 mjd_uc[] 162 162 ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i setphot_uc … … 178 178 179 179 # run setphot on the parallel db and check that the images now match the expected values 180 exec setphot - parallel -update -ubercal testzpt.fits -D CATDIR $catdir.p0180 exec setphot -reset -parallel -update -ubercal testzpt.fits -D CATDIR $catdir.p0 181 181 182 182 # bring the detections back to the local db 183 exec dvodist -in $catdir.p0 >& log.dvodist.in 183 # exec dvodist -in $catdir.p0 >& log.dvodist.in 184 # XXX this should now not be needed 184 185 185 186 # check the results … … 190 191 ckexposure $catdir.p0 mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i setphot_nc 191 192 end 192 193 # push the detections back out to the parallel db194 exec dvodist -out $catdir.p0 >& log.dvodist.in195 193 196 194 # run relphot on the parallel db and check that the images now match the expected values 197 195 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 198 196 199 # bring the detections back to the local db200 exec dvodist -in $catdir.p0 >& log.dvodist.in201 202 197 for i 0 mjd_uc[] 203 198 ckexposure $catdir.p0 mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot … … 208 203 209 204 tapDONE 205 end 206 207 macro qt 208 209 ## SER 210 211 # run setphot on the serial db and check that the images now match the expected values 212 exec setphot -reset -update -ubercal testzpt.fits -D CATDIR $catdir 213 for i 0 mjd_uc[] 214 ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i setphot_uc 215 end 216 for i 0 mjd_nc[] 217 ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i setphot_nc 218 end 219 220 # run relphot on the serial db and check that the images now match the expected values 221 exec relphot g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -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.s0 222 for i 0 mjd_uc[] 223 ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot 224 end 225 for i 0 mjd_nc[] 226 ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot 227 end 228 229 ## PAR 230 231 # run setphot on the parallel db and check that the images now match the expected values 232 exec setphot -reset -parallel -update -ubercal testzpt.fits -D CATDIR $catdir.p0 233 234 # check the results 235 for i 0 mjd_uc[] 236 ckexposure $catdir.p0 mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i setphot_uc 237 end 238 for i 0 mjd_nc[] 239 ckexposure $catdir.p0 mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i setphot_nc 240 end 241 242 # run relphot on the parallel db and check that the images now match the expected values 243 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 244 245 for i 0 mjd_uc[] 246 ckexposure $catdir.p0 mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot 247 end 248 for i 0 mjd_nc[] 249 ckexposure $catdir.p0 mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot 250 end 210 251 end 211 252 -
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/include/dvo.h
r33257 r33303 579 579 // functions for parallel DVO 580 580 HostTable *HostTableLoad (char *catdir, char *rootname); 581 int HostTableWaitJobs (HostTable *table, char *file, int lineno); 581 582 582 583 # endif -
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/HostTable.c
r33239 r33303 1 1 # include "dvo.h" 2 # include <sys/types.h> 3 # include <sys/wait.h> 2 4 3 5 void InitHosts (HostInfo *hosts, int Nhosts, int NHOSTS) { … … 114 116 return table; 115 117 } 118 119 // wait for all children to complete, report output to stdout 120 int HostTableWaitJobs (HostTable *table, char *file, int lineno) { 121 122 int i; 123 124 // we have launched table->Nhosts jobs; wait for all of them to complete... 125 // if one (N) failed to launch, we will get an ECHILD error from the last (N) calls 126 int done = FALSE; 127 for (i = 0; !done && (i < table->Nhosts); i++) { 128 int status = 0; 129 130 // XXX we'll need to pass in WNOHANG and keep retrying if we want to have a timeout... 131 int pid = waitpid (-1, &status, 0); 132 if (!pid) { 133 // this should only occur if we called waitpid with the WNOHANG option 134 fprintf (stderr, "programming error (1)? %s %d", file, lineno); 135 exit (2); 136 } 137 if (pid == -1) { 138 switch (errno) { 139 case ECHILD: 140 done = TRUE; 141 break; 142 default: 143 fprintf (stderr, "programming error (2)? %s %d", file, lineno); 144 exit (2); 145 } 146 } 147 148 // find the host which has finished 149 int j; 150 int found = FALSE; 151 for (j = 0; j < table->Nhosts; j++) { 152 if (table->hosts[j].pid != pid) continue; 153 found = TRUE; 154 // check on the status of this and report any output? 155 fprintf (stderr, "job finished for %s (%d)\n", table->hosts[j].hostname, pid); 156 // read the stderr and stdout 157 IOBuffer buffer; 158 InitIOBuffer (&buffer, 100); 159 EmptyIOBuffer (&buffer, 100, table->hosts[j].stdio[1]); 160 fprintf (stderr, "--- stdout from %s ---\n", table->hosts[j].hostname); 161 write (STDOUT_FILENO, buffer.buffer, buffer.Nbuffer); 162 fprintf (stderr, "\n"); 163 164 InitIOBuffer (&buffer, 100); 165 EmptyIOBuffer (&buffer, 100, table->hosts[j].stdio[2]); 166 fprintf (stderr, "--- stderr from %s ---\n", table->hosts[j].hostname); 167 write (STDOUT_FILENO, buffer.buffer, buffer.Nbuffer); 168 fprintf (stderr, "\n"); 169 if (WIFEXITED(status)) { 170 fprintf (stderr, "normal completion, exit status is %d\n", WEXITSTATUS(status)); 171 if (WEXITSTATUS(status)) { 172 fprintf (stderr, "job failed on %s\n", table->hosts[j].hostname); 173 exit (1); 174 } 175 } else { 176 fprintf (stderr, "job exited abnormally on %s\n", table->hosts[j].hostname); 177 exit (1); 178 } 179 } 180 if (!found) { 181 fprintf (stderr, "failed to matched finished job to known host!\n"); 182 exit (2); 183 } 184 } 185 return TRUE; 186 } -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/CopyFromHostLocation.c
r33225 r33303 86 86 87 87 valid: 88 89 // the output (tgtname) could exist and be a link to the same file; delete it if it exists 90 status = stat (tgtname, &filestat); 91 if (!status) { 92 // a tgtfile already exists; get rid of it 93 if (unlink (tgtname)) { 94 fprintf (stderr, "failed to remove CATDIR file %s\n", tgtname); 95 success = FALSE; 96 continue; 97 } 98 } 99 88 100 // read srcname, write to tgtname, get MD5 sum for srcname as we go: 89 101 if (!get_md5_with_copy (srcname, tgtname, srcDigest)) { -
branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/CopyToHostLocation.c
r33223 r33303 11 11 struct stat filestat; 12 12 char srcname[1024]; 13 char newname[1024]; 13 14 char tgtname[1024]; 14 15 char outdir[1024]; … … 131 132 skylist->regions[i]->hostFlags |= DATA_ON_TGT; 132 133 for (j = 0; success && (j < 4); j++) { 134 sprintf (tgtname, "%s/%s.%s", host->pathname, skylist->regions[i]->name, extname[j]); 133 135 sprintf (srcname, "%s/%s.%s", catdir, skylist->regions[i]->name, extname[j]); 134 if (!DEBUG && DELETE_ORIGINAL) unlink (srcname); 136 if (!DEBUG && DELETE_ORIGINAL) { 137 unlink (srcname); 138 } else { 139 sprintf (newname, "%s/%s.%s.bck", catdir, skylist->regions[i]->name, extname[j]); 140 status = stat (newname, &filestat); 141 if (!status) { 142 // a backup file already exists; get rid of it 143 if (unlink (newname)) { 144 fprintf (stderr, "failed to remove old backup file %s\n", newname); 145 continue; 146 } 147 } 148 if (rename (srcname, newname)) { 149 fprintf (stderr, "failed to rename %s to %s\n", srcname, newname); 150 continue; 151 } 152 char *absname = abspath (tgtname, 1024); 153 if (symlink (absname, srcname)) { 154 fprintf (stderr, "failed to make symlink from %s to %s\n", absname, srcname); 155 } 156 free (absname); 157 } 135 158 } 136 159 } -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h
r33301 r33303 314 314 int CopyAverageTiny (AverageTiny *averageT, Average *average); 315 315 int CopyMeasureTiny (MeasureTiny *measureT, Measure *measure); 316 317 int HostTableWaitJobs (HostTable *table, char *file, int lineno); -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ImageSubset.c
r33297 r33303 43 43 if (!gfits_load_header (f, &theader)) { 44 44 fclose (f); 45 return (NULL);45 return NULL; 46 46 } 47 47 -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c
r33298 r33303 394 394 } 395 395 396 KEEP_UBERCAL = FALSE; 397 if ((N = get_argument (argc, argv, "-keep-ubercal"))) { 398 remove_argument (N, &argc, argv); 399 KEEP_UBERCAL = TRUE; 400 } 401 396 402 /* define time */ 397 403 TimeSelect = FALSE; -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/load_catalogs.c
r33301 r33303 121 121 // options / arguments that can affect relphot_client -load: 122 122 // VERBOSE, VERBOSE2 123 // KEEP_UBERCAL 123 124 // RESET (-reset) 124 125 // TimeSelect -time … … 138 139 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 139 140 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 141 if (KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -keep-ubercal", command); strcpy (command, tmpline); } 140 142 if (DophotSelect) { snprintf (tmpline, 1024, "%s -dophot %d", command, DophotValue); strcpy (command, tmpline); } 141 143 if (ImagSelect) { snprintf (tmpline, 1024, "%s -instmag %f %f", command, ImagMin, ImagMax); strcpy (command, tmpline); } -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/reload_catalogs.c
r33301 r33303 1 1 # include "relphot.h" 2 # include <sys/types.h>3 # include <sys/wait.h>4 2 5 3 # define DEBUG 1 … … 157 155 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 158 156 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 157 if (KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -keep-ubercal", command); strcpy (command, tmpline); } 159 158 if (AreaSelect) { snprintf (tmpline, 1024, "%s -area %f %f %f %f", command, AreaXmin, AreaXmax, AreaYmin, AreaYmax); strcpy (command, tmpline); } 160 159 if (TimeSelect) { … … 198 197 return (TRUE); 199 198 } 200 201 // wait for all children to complete, report output to stdout202 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) calls208 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 option216 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 finished231 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 stdout239 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/uniphot/include/setphot.h
r33255 r33303 19 19 20 20 /* global variables set in parameter file */ 21 char ImageCat[256]; 22 char CATDIR[256]; 21 # define MAX_PATH_LENGTH 1024 22 char ImageCat[MAX_PATH_LENGTH]; 23 char *CATDIR; 23 24 int HOST_ID; 24 25 char *HOSTDIR; 25 26 char *IMAGES; 26 27 int VERBOSE; 28 int RESET; 27 29 int UBERCAL; // load the supplied ubercal zero point fits table (with flat-field corrections) 28 30 int NO_METADATA; // the supplied ubercal data has no descriptive metadata 29 int VERBOSE;30 31 int UPDATE; 32 int PARALLEL; 33 int PARALLEL_MANUAL; 34 int PARALLEL_SERIAL; 31 35 32 36 /***** prototypes ****/ -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/ImageSubset.c
r33255 r33303 39 39 40 40 // load data for this header 41 if (!gfits_load_header (f, &theader)) return (NULL); 41 if (!gfits_load_header (f, &theader)) { 42 fclose (f); 43 return NULL; 44 } 42 45 43 46 // read the fits table bytes 44 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) return (NULL); 45 46 // XXX close the fits file here 47 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { 48 fclose (f); 49 return NULL; 50 } 51 fclose (f); 47 52 48 53 // a bit annoying : we read the entire block of data (180M), then extract the columns, then set the image structure values. … … 153 158 gfits_free_table (&ftable); 154 159 160 fclose (f); 161 fflush (f); 162 155 163 return TRUE; 156 164 } -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/initialize_setphot.c
r33241 r33303 31 31 if ((N = get_argument (argc, argv, "-v"))) { 32 32 VERBOSE = TRUE; 33 remove_argument (N, &argc, argv); 34 } 35 36 RESET = FALSE; 37 if ((N = get_argument (argc, argv, "-reset"))) { 38 RESET = TRUE; 39 remove_argument (N, &argc, argv); 40 } 41 42 PARALLEL = FALSE; 43 if ((N = get_argument (argc, argv, "-parallel"))) { 44 PARALLEL = TRUE; 45 remove_argument (N, &argc, argv); 46 } 47 // this is a test mode : rather than launching the remote jobs and waiting for completion, 48 // setphot will simply list the remote command and wait for the user to signal completion 49 PARALLEL_MANUAL = FALSE; 50 if ((N = get_argument (argc, argv, "-parallel-manual"))) { 51 PARALLEL = TRUE; // -parallel-manual implies -parallel 52 PARALLEL_MANUAL = TRUE; 53 remove_argument (N, &argc, argv); 54 } 55 // this is a test mode : rather than launching the setphot_client jobs remotely, they are 56 // run in serial via 'system' 57 PARALLEL_SERIAL = FALSE; 58 if ((N = get_argument (argc, argv, "-parallel-serial"))) { 59 if (PARALLEL_MANUAL) { 60 fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n"); 61 exit (1); 62 } 63 PARALLEL = TRUE; // -parallel-serial implies -parallel 64 PARALLEL_SERIAL = TRUE; 33 65 remove_argument (N, &argc, argv); 34 66 } … … 82 114 if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file); 83 115 84 GetConfig (config, "CATDIR", "%s", 0, CATDIR); 116 // force CATDIR to be absolute (so parallel mode will work) 117 char *tmpcatdir = NULL; 118 ALLOCATE (tmpcatdir, char, MAX_PATH_LENGTH); 119 GetConfig (config, "CATDIR", "%s", 0, tmpcatdir); 120 CATDIR = abspath (tmpcatdir, MAX_PATH_LENGTH); 121 free (tmpcatdir); 122 85 123 sprintf (ImageCat, "%s/Images.dat", CATDIR); 86 124 -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/initialize_setphot_client.c
r33241 r33303 33 33 } 34 34 35 RESET = FALSE; 36 if ((N = get_argument (argc, argv, "-reset"))) { 37 RESET = TRUE; 38 remove_argument (N, &argc, argv); 39 } 40 35 41 UBERCAL = FALSE; 36 42 if ((N = get_argument (argc, argv, "-ubercal"))) { … … 61 67 if (!HOSTDIR) goto usage; 62 68 63 CATDIR[0] = 0;64 69 if ((N = get_argument (argc, argv, "-catdir"))) { 65 70 remove_argument (N, &argc, argv); 66 strcpy (CATDIR,argv[N]);71 CATDIR = strcreate (argv[N]); 67 72 remove_argument (N, &argc, argv); 68 73 } 69 if (!CATDIR [0]) goto usage;74 if (!CATDIR) goto usage; 70 75 71 76 IMAGES = NULL; … … 81 86 82 87 usage: 83 fprintf (stderr, "USAGE: setphot_client -host name (hostname) -catdir (catdir) -hostdir (hostdir) -images (images) [options]\n");88 fprintf (stderr, "USAGE: setphot_client -hostID (hostID) -catdir (catdir) -hostdir (hostdir) -images (images) [options]\n"); 84 89 fprintf (stderr, " options:\n"); 85 90 fprintf (stderr, " -v : verbose mode\n"); -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/match_zpts_to_images.c
r33241 r33303 38 38 // sort the zpts 39 39 sort_zpts_by_time (zpts, Nzpts); 40 41 if (RESET) { 42 for (i = 0; i < Nimage; i++) { 43 image[i].Mcal = 0.0; 44 image[i].dMcal = NAN; 45 image[i].flags &= ~ID_IMAGE_PHOTOM_NOCAL; // clear the NOCAL flag 46 } 47 } 40 48 41 49 NImatch = 0; // matched images -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/setphot.c
r33241 r33303 21 21 zpts = load_zpt_ubercal (argv[1], &Nzpts, &flatcorrTable); 22 22 23 char flatcorrfile[64]; 24 snprintf (flatcorrfile, 64, "%s/flatcorr.fits", CATDIR); 23 char flatcorrfile[MAX_PATH_LENGTH]; 24 int size = snprintf (flatcorrfile, MAX_PATH_LENGTH, "%s/flatcorr.fits", CATDIR); 25 assert (size < MAX_PATH_LENGTH); 25 26 FlatCorrectionSave(&flatcorrTable, flatcorrfile); 26 27 // XXX should this program save any old copy of this file? -
branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_dvo_setphot.c
r33255 r33303 14 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 15 16 # define PARALLEL 117 16 if (PARALLEL && !HOST_ID) { 18 17 update_dvo_setphot_parallel (sky, image, Nimage); … … 105 104 for (i = 0; i < table->Nhosts; i++) { 106 105 106 // ensure that the paths are absolute path names 107 char *tmppath = abspath (table->hosts[i].pathname, MAX_PATH_LENGTH); 108 free (table->hosts[i].pathname); 109 table->hosts[i].pathname = tmppath; 110 107 111 char command[1024]; 108 snprintf (command, 1024, "setphot_client - test -hostname %s-catdir %s -hostdir %s -images %s",109 table->hosts[i].host name, CATDIR, table->hosts[i].pathname, imageFile);112 snprintf (command, 1024, "setphot_client -hostID %d -catdir %s -hostdir %s -images %s", 113 table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, imageFile); 110 114 111 115 fprintf (stderr, "command: %s\n", command); 112 116 113 // launch the job on the remote machine (no handshake) 114 int errorInfo = 0; 115 int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE); 116 if (!pid) { 117 if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo); 118 exit (1); 117 char tmpline[1024]; 118 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 119 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 120 if (UPDATE) { snprintf (tmpline, 1024, "%s -update", command); strcpy (command, tmpline); } 121 if (UBERCAL) { snprintf (tmpline, 1024, "%s -ubercal", command); strcpy (command, tmpline); } 122 123 if (PARALLEL_MANUAL) continue; 124 125 if (PARALLEL_SERIAL) { 126 int status = system (command); 127 if (status) { 128 fprintf (stderr, "ERROR running setphot_client\n"); 129 exit (2); 130 } 131 } else { 132 // launch the job on the remote machine (no handshake) 133 int errorInfo = 0; 134 int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE); 135 if (!pid) { 136 if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo); 137 exit (1); 138 } 139 table->hosts[i].pid = pid; // save for future reference 119 140 } 120 table->hosts[i].pid = pid; // save for future reference121 122 // check that all hosts started OK?123 141 } 124 142 125 // watch for stdout / stderr from those jobs... 126 // wait for all of them to complete... 143 // wait for the remote jobs to be completed 144 if (PARALLEL_MANUAL) { 145 fprintf (stderr, "run the setphot_client commands above. when these are done, hit return\n"); 146 getchar(); 147 } 148 if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) { 149 HostTableWaitJobs (table, __FILE__, __LINE__); 150 } 127 151 128 152 return (TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.
