IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 25, 2012, 9:58:52 AM (14 years ago)
Author:
eugene
Message:

dvo remote -results option

Location:
branches/eam_branches/ipp-20120405/Ohana/src/opihi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/dvo/dvo_host_utils.c

    r33870 r33911  
    184184  return TRUE;
    185185}
     186
     187// re-gather the remote results files: this can be used in case one of the clients failed,
     188// and has since been re-run
     189int HostTableReloadResults (char *uniquer, int VERBOSE) {
     190
     191  int i;
     192
     193  // load the list of hosts
     194  SkyTable *sky = GetSkyTable();
     195  if (!sky) {
     196    gprint (GP_ERR, "failed to load sky table for database\n");
     197    return FALSE;
     198  }
     199
     200  char *CATDIR = GetCATDIR ();
     201  if (!CATDIR) {
     202    gprint (GP_ERR, "failed to get CATDIR for database\n");
     203    return FALSE;
     204  }
     205
     206  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
     207  if (!table) {
     208    gprint (GP_ERR, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
     209    return FALSE;
     210  }   
     211
     212  // load fields from file
     213  int    Nvec = 0;
     214  Vector **vec = NULL;
     215  for (i = 0; i < table->Nhosts; i++) {
     216    if (table->hosts[i].status) continue;
     217
     218    // ensure that the paths are absolute path names
     219    char *tmppath = abspath (table->hosts[i].pathname, DVO_MAX_PATH);
     220    free (table->hosts[i].pathname);
     221    table->hosts[i].pathname = tmppath;
     222
     223    // need to save the results filename with the uniquer
     224    // XXX a bit of a waste (but only 1024 * 60 bytes or so
     225    ALLOCATE (table->hosts[i].results, char, DVO_MAX_PATH);
     226    snprintf (table->hosts[i].results, DVO_MAX_PATH, "%s/dvo.results.%s.fits", table->hosts[i].pathname, uniquer);
     227
     228    int    Ninvec = 0;
     229    Vector **invec = ReadVectorTableFITS (table->hosts[i].results, "RESULT", &Ninvec);
     230    if (!invec) {
     231      // failed to read the file, now what?
     232      gprint (GP_ERR, "failed to read remote result file : %s\n", table->hosts[i].results);
     233      free (table->hosts[i].results);
     234      table->hosts[i].results = NULL;
     235      continue;
     236    }
     237    free (table->hosts[i].results);
     238    table->hosts[i].results = NULL;
     239
     240    vec = MergeVectors (vec, &Nvec, invec, Ninvec);
     241    if (vec != invec) {
     242      FreeVectorArray (invec, Ninvec);
     243    }
     244  }
     245
     246  for (i = 0; i < Nvec; i++) {
     247    AssignVector (vec[i], vec[i]->name, ANYVECTOR, TRUE);
     248  }
     249  free (vec);
     250
     251  free (table);
     252  return TRUE;
     253}
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/dvo/remote.c

    r33870 r33911  
    88  int N;
    99
     10  int VERBOSE = FALSE;
     11  if ((N = get_argument (argc, argv, "-v"))) {
     12    remove_argument (N, &argc, argv);
     13    VERBOSE = TRUE;
     14  }
     15
    1016  if (argc < 2) {
    1117    gprint (GP_ERR, "USAGE: remote (command)\n");
     
    1319    gprint (GP_ERR, "  options:\n");
    1420    gprint (GP_ERR, "  -v : verbose mode:\n");
     21    gprint (GP_ERR, "OR:    remote -reload (uniquer)\n");
    1522    return FALSE;
    1623  }
     
    2330  // with a set of vectors to load.
    2431
    25   int VERBOSE = FALSE;
    26   if ((N = get_argument (argc, argv, "-v"))) {
     32  if ((N = get_argument (argc, argv, "-reload"))) {
     33    if (argc != N) {
     34      gprint (GP_ERR, "USAGE: remote -reload (uniquer)\n");
     35      gprint (GP_ERR, " (uniquer) is the element in the middle of the results file\n");
     36      gprint (GP_ERR, " eg: dvo.results.XXXXX.YYYYY.fits\n");
     37      return FALSE;
     38    }
    2739    remove_argument (N, &argc, argv);
    28     VERBOSE = TRUE;
     40    int status = HostTableReloadResults (argv[1], VERBOSE);
     41    return status;
    2942  }
    3043
  • branches/eam_branches/ipp-20120405/Ohana/src/opihi/include/dvoshell.h

    r33662 r33911  
    101101int          HostTableLaunchJobs    PROTO((HostTable *table, char *basecmd, char *options));
    102102int          HostTableParallelOps   PROTO((int argc, char **argv, char *ResultFile, int Nelements, int VERBOSE));
    103 # endif
     103int          HostTableReloadResults PROTO((char *uniquer, int VERBOSE));
     104
     105# endif // DVOSHELL_H
Note: See TracChangeset for help on using the changeset viewer.