IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 26, 2012, 1:48:44 PM (14 years ago)
Author:
eugene
Message:

add -get-results option to remote

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

Legend:

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

    r34749 r34877  
    295295  return TRUE;
    296296}
     297
     298// re-gather the remote results files: this can be used in case one of the clients failed,
     299// and has since been re-run
     300int HostTableGetResults (char *uniquer, int VERBOSE) {
     301
     302  int i;
     303
     304  // load the list of hosts
     305  SkyTable *sky = GetSkyTable();
     306  if (!sky) {
     307    gprint (GP_ERR, "failed to load sky table for database\n");
     308    return FALSE;
     309  }
     310
     311  char *CATDIR = GetCATDIR ();
     312  if (!CATDIR) {
     313    gprint (GP_ERR, "failed to get CATDIR for database\n");
     314    return FALSE;
     315  }
     316
     317  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
     318  if (!table) {
     319    gprint (GP_ERR, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
     320    return FALSE;
     321  }   
     322
     323  // create the result file list
     324  char name[256];
     325  snprintf (name, 256, "RESULT_FILE:n");
     326  set_int_variable (name, table->Nhosts);
     327  snprintf (name, 256, "RESULT_DATA:n");
     328  set_int_variable (name, table->Nhosts);
     329  snprintf (name, 256, "RESULT_STATUS:n");
     330  set_int_variable (name, table->Nhosts);
     331
     332  // load fields from file
     333  for (i = 0; i < table->Nhosts; i++) {
     334
     335    snprintf (name, 256, "RESULT_FILE:%d", i);
     336    set_str_variable (name, table->hosts[i].results);
     337
     338    // DATA : 0 (unread), 1 (read)
     339    snprintf (name, 256, "RESULT_DATA:%d", i);
     340    set_int_variable (name, 0);
     341
     342    // STATUS : 0 (normal exit), -1 (crash), N (failure exit status)
     343    snprintf (name, 256, "RESULT_STATUS:%d", i);
     344    set_int_variable (name, table->hosts[i].status);
     345  }
     346
     347  free (table);
     348  return TRUE;
     349}
  • branches/eam_branches/ipp-20121219/Ohana/src/opihi/dvo/remote.c

    r34749 r34877  
    2626    gprint (GP_ERR, "  -v : verbose mode:\n");
    2727    gprint (GP_ERR, "OR:    remote -reload (uniquer)\n");
     28    gprint (GP_ERR, "OR:    remote -get-results (uniquer)\n");
    2829    return FALSE;
    2930  }
     
    4849  }
    4950
     51  if ((N = get_argument (argc, argv, "-get-results"))) {
     52    remove_argument (N, &argc, argv);
     53    if (argc != 2) {
     54      gprint (GP_ERR, "USAGE: remote -get-results (uniquer)\n");
     55      gprint (GP_ERR, " (uniquer) is the element in the middle of the results file\n");
     56      gprint (GP_ERR, " eg: dvo.results.XXXXX.YYYYY.fits\n");
     57      return FALSE;
     58    }
     59    int status = HostTableGetResults (argv[1], VERBOSE);
     60    return status;
     61  }
     62
    5063  // strip of the 'remote' and send the remaining arguments to the remote machine
    5164  int status = HostTableParallelOps (argc - 1, &argv[1], NULL, ReadVectors, 0, VERBOSE);
  • branches/eam_branches/ipp-20121219/Ohana/src/opihi/include/dvoshell.h

    r34749 r34877  
    102102int          HostTableParallelOps   PROTO((int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE));
    103103int          HostTableReloadResults PROTO((char *uniquer, int VERBOSE));
     104int          HostTableGetResults    PROTO((char *uniquer, int VERBOSE));
    104105
    105106# endif // DVOSHELL_H
Note: See TracChangeset for help on using the changeset viewer.