IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33303


Ignore:
Timestamp:
Feb 17, 2012, 2:42:48 PM (14 years ago)
Author:
eugene
Message:

add a waitpid function for jobs on HostTable; updates on relphot/setphot tests; dvodist moves the original files out of the way and makes symlinks; add -reset to setphot; parallel remote launch for setphot; pass -keep-ubercal to relphot_client

Location:
branches/eam_branches/ipp-20111122/Ohana/src
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/addstar/test/relphot.setphot.parallel.dvo

    r33302 r33303  
    158158
    159159  # 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 $catdir
     160  exec setphot -reset -update -ubercal testzpt.fits -D CATDIR $catdir
    161161  for i 0 mjd_uc[]
    162162    ckexposure $catdir mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i setphot_uc
     
    178178
    179179  # 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.p0
     180  exec setphot -reset -parallel -update -ubercal testzpt.fits -D CATDIR $catdir.p0
    181181
    182182  # 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
    184185
    185186  # check the results
     
    190191    ckexposure $catdir.p0 mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i setphot_nc
    191192  end
    192 
    193   # push the detections back out to the parallel db
    194   exec dvodist -out $catdir.p0 >& log.dvodist.in
    195193
    196194  # run relphot on the parallel db and check that the images now match the expected values
    197195  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
    198196
    199   # bring the detections back to the local db
    200   exec dvodist -in $catdir.p0 >& log.dvodist.in
    201 
    202197  for i 0 mjd_uc[]
    203198    ckexposure $catdir.p0 mjd_uc[$i] zpt_uc[$i] exptime_uc[$i] airmass_uc[$i] $filt_uc:$i relphot
     
    208203
    209204  tapDONE
     205end
     206
     207macro 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
    210251end
    211252
  • branches/eam_branches/ipp-20111122/Ohana/src/libdvo/include/dvo.h

    r33257 r33303  
    579579// functions for parallel DVO
    580580HostTable    *HostTableLoad (char *catdir, char *rootname);
     581int HostTableWaitJobs (HostTable *table, char *file, int lineno);
    581582
    582583# endif
  • branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/HostTable.c

    r33239 r33303  
    11# include "dvo.h"
     2# include <sys/types.h>
     3# include <sys/wait.h>
    24
    35void InitHosts (HostInfo *hosts, int Nhosts, int NHOSTS) {
     
    114116  return table;
    115117}
     118
     119// wait for all children to complete, report output to stdout
     120int 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  
    8686
    8787    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
    88100      // read srcname, write to tgtname, get MD5 sum for srcname as we go:
    89101      if (!get_md5_with_copy (srcname, tgtname, srcDigest)) {
  • branches/eam_branches/ipp-20111122/Ohana/src/photdbc/src/CopyToHostLocation.c

    r33223 r33303  
    1111  struct stat filestat;
    1212  char srcname[1024];
     13  char newname[1024];
    1314  char tgtname[1024];
    1415  char outdir[1024];
     
    131132      skylist->regions[i]->hostFlags |= DATA_ON_TGT;
    132133      for (j = 0; success && (j < 4); j++) {
     134        sprintf (tgtname, "%s/%s.%s", host->pathname, skylist->regions[i]->name, extname[j]);
    133135        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        }
    135158      }
    136159    }
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h

    r33301 r33303  
    314314int CopyAverageTiny (AverageTiny *averageT, Average *average);
    315315int 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  
    4343  if (!gfits_load_header (f, &theader)) {
    4444    fclose (f);
    45     return (NULL);
     45    return NULL;
    4646  }
    4747
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/args.c

    r33298 r33303  
    394394  }
    395395
     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
    396402  /* define time */
    397403  TimeSelect = FALSE;
  • branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/load_catalogs.c

    r33301 r33303  
    121121    // options / arguments that can affect relphot_client -load:
    122122    // VERBOSE, VERBOSE2
     123    // KEEP_UBERCAL
    123124    // RESET (-reset)
    124125    // TimeSelect -time
     
    138139    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
    139140    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); }
    140142    if (DophotSelect)  { snprintf (tmpline, 1024, "%s -dophot %d",      command, DophotValue);       strcpy (command, tmpline); }
    141143    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  
    11# include "relphot.h"
    2 # include <sys/types.h>
    3 # include <sys/wait.h>
    42
    53# define DEBUG 1
     
    157155    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                                           strcpy (command, tmpline); }
    158156    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); }
    159158    if (AreaSelect)    { snprintf (tmpline, 1024, "%s -area %f %f %f %f", command, AreaXmin, AreaXmax, AreaYmin, AreaYmax); strcpy (command, tmpline); }
    160159    if (TimeSelect) {
     
    198197  return (TRUE);
    199198}     
    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/uniphot/include/setphot.h

    r33255 r33303  
    1919
    2020/* global variables set in parameter file */
    21 char         ImageCat[256];
    22 char         CATDIR[256];
     21# define MAX_PATH_LENGTH 1024
     22char         ImageCat[MAX_PATH_LENGTH];
     23char        *CATDIR;
    2324int          HOST_ID;
    2425char        *HOSTDIR;
    2526char        *IMAGES;
    2627int          VERBOSE;
     28int          RESET;
    2729int          UBERCAL; // load the supplied ubercal zero point fits table (with flat-field corrections)
    2830int          NO_METADATA; // the supplied ubercal data has no descriptive metadata
    29 int          VERBOSE;
    3031int          UPDATE;
     32int          PARALLEL;
     33int          PARALLEL_MANUAL;
     34int          PARALLEL_SERIAL;
    3135
    3236/***** prototypes ****/
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/ImageSubset.c

    r33255 r33303  
    3939
    4040  // 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  }
    4245
    4346  // 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);
    4752
    4853  // a bit annoying : we read the entire block of data (180M), then extract the columns, then set the image structure values.
     
    153158  gfits_free_table (&ftable);
    154159
     160  fclose (f);
     161  fflush (f);
     162
    155163  return TRUE;
    156164}
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/initialize_setphot.c

    r33241 r33303  
    3131  if ((N = get_argument (argc, argv, "-v"))) {
    3232    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;
    3365    remove_argument (N, &argc, argv);
    3466  }
     
    82114  if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file);
    83115
    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
    85123  sprintf (ImageCat, "%s/Images.dat", CATDIR);
    86124
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/initialize_setphot_client.c

    r33241 r33303  
    3333  }
    3434
     35  RESET = FALSE;
     36  if ((N = get_argument (argc, argv, "-reset"))) {
     37    RESET = TRUE;
     38    remove_argument (N, &argc, argv);
     39  }
     40
    3541  UBERCAL = FALSE;
    3642  if ((N = get_argument (argc, argv, "-ubercal"))) {
     
    6167  if (!HOSTDIR) goto usage;
    6268
    63   CATDIR[0] = 0;
    6469  if ((N = get_argument (argc, argv, "-catdir"))) {
    6570    remove_argument (N, &argc, argv);
    66     strcpy (CATDIR, argv[N]);
     71    CATDIR = strcreate (argv[N]);
    6772    remove_argument (N, &argc, argv);
    6873  }
    69   if (!CATDIR[0]) goto usage;
     74  if (!CATDIR) goto usage;
    7075
    7176  IMAGES = NULL;
     
    8186
    8287usage:
    83   fprintf (stderr, "USAGE: setphot_client -hostname (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");
    8489  fprintf (stderr, "  options:\n");
    8590  fprintf (stderr, "    -v : verbose mode\n");
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/match_zpts_to_images.c

    r33241 r33303  
    3838  // sort the zpts
    3939  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  }
    4048
    4149  NImatch = 0; // matched images
  • branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/setphot.c

    r33241 r33303  
    2121    zpts = load_zpt_ubercal (argv[1], &Nzpts, &flatcorrTable);
    2222
    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);
    2526    FlatCorrectionSave(&flatcorrTable, flatcorrfile);
    2627    // 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  
    1414  SkyTableSetFilenames (sky, CATDIR, "cpt");
    1515 
    16 # define PARALLEL 1
    1716  if (PARALLEL && !HOST_ID) {
    1817    update_dvo_setphot_parallel (sky, image, Nimage);
     
    105104  for (i = 0; i < table->Nhosts; i++) {
    106105
     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
    107111    char command[1024];
    108     snprintf (command, 1024, "setphot_client -test -hostname %s -catdir %s -hostdir %s -images %s",
    109               table->hosts[i].hostname, 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);
    110114
    111115    fprintf (stderr, "command: %s\n", command);
    112116
    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
    119140    }
    120     table->hosts[i].pid = pid; // save for future reference
    121 
    122     // check that all hosts started OK?
    123141  }
    124142
    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  }
    127151
    128152  return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.