IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33563


Ignore:
Timestamp:
Mar 16, 2012, 2:14:22 PM (14 years ago)
Author:
eugene
Message:

rework dvo_client calls to pass the command via a file, not the cmd line (parens too complex)

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

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/avextract.c

    r33543 r33563  
    4343  }
    4444
    45   // dump results directly to fits file (esp for parallel dvo)
    46   char *ResultFile = NULL;
    47   if ((N = get_argument (argc, argv, "-result"))) {
    48     remove_argument (N, &argc, argv);
    49     ResultFile = strcreate(argv[N]);
    50     remove_argument (N, &argc, argv);
    51   }
    52 
    5345  dvo_catalog_init (&catalog, TRUE);
    5446
     
    6355    print_error();
    6456    goto escape;
    65   }
    66 
    67   // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
    68   if (PARALLEL && !HOST_ID) {
    69     // not all parallel ops need to set the region selection...
    70     if (!SetSkyRegions (selection)) goto escape;
    71 
    72     int status = HostTableParallelOps (argc, argv, ResultFile, 0);
    73     return status;
    7457  }
    7558
     
    11093  /* load region corresponding to selection above */
    11194  if ((skylist = SelectRegions (selection)) == NULL) goto escape;
     95
     96  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
     97  if (PARALLEL && !HOST_ID) {
     98    int status = HostTableParallelOps (argc, argv, RESULT_FILE, 0);
     99
     100    dbFreeFields (fields, Nfields);
     101    dbFreeStack (stack, Nstack);
     102    free (stack);
     103    FreeSkyRegionSelection (selection);
     104    dvo_catalog_free (&catalog);
     105
     106    return status;
     107  }
    112108
    113109  /* create output storage vectors */
     
    204200
    205201  // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
    206   if (ResultFile) {
    207     int status = WriteVectorTableFITS (ResultFile, "RESULT", vec, Nreturn, FALSE, NULL);
     202  if (RESULT_FILE) {
     203    int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL);
    208204    if (!status) goto escape;
    209205  }
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/avmatch.c

    r33543 r33563  
    4848    remove_argument (N, &argc, argv);
    4949    PARALLEL = TRUE;
    50   }
    51 
    52   // dump results directly to fits file (esp for parallel dvo)
    53   char *ResultFile = NULL;
    54   if ((N = get_argument (argc, argv, "-result"))) {
    55     remove_argument (N, &argc, argv);
    56     ResultFile = strcreate(argv[N]);
    57     remove_argument (N, &argc, argv);
    5850  }
    5951
     
    9890
    9991    // I need to pass the RA & DEC vectors to the remote clients...
    100     int status = HostTableParallelOps (argc, argv, ResultFile, RAvec->Nelements);
    101     if (ResultFile) free (ResultFile);
     92    int status = HostTableParallelOps (argc, argv, RESULT_FILE, RAvec->Nelements);
    10293    if (vec) free (vec);
    10394   
     
    225216  // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
    226217  // only write the fields which were in a valid catalog
    227   if (ResultFile) {
     218  if (RESULT_FILE) {
    228219    // extend the array by one to hold index array
    229220    REALLOCATE (vec, Vector *, Nfields + 1);
     
    271262      vec[i][0].Nelements = Nfound;
    272263    }
    273     int status = WriteVectorTableFITS (ResultFile, "RESULT", vec, Nfields + 1, FALSE, NULL);
     264    int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nfields + 1, FALSE, NULL);
    274265    free (vec[Nfields]->elements.Int);
    275266    free (vec[Nfields]);
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/dvo.c.in

    r33308 r33563  
    4848  HOST_ID = 0;
    4949  HOSTDIR = NULL;
     50  RESULT_FILE = NULL;
    5051
    5152  return;
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/dvo_client.c

    r33313 r33563  
    11# include "dvoshell.h"
     2
     3int input PROTO((int, char **));
    24
    35/* program-dependent initialization */
     
    3941    remove_argument (N, argc, argv);
    4042    HOSTDIR = strcreate (argv[N]);;
     43    remove_argument (N, argc, argv);
     44  }
     45
     46  RESULT_FILE = NULL;
     47  if ((N = get_argument (*argc, argv, "-result"))) {
     48    remove_argument (N, argc, argv);
     49    RESULT_FILE = strcreate (argv[N]);;
    4150    remove_argument (N, argc, argv);
    4251  }
     
    8594  }
    8695
     96  int status = input (2, &argv[0]);
     97  if (!status) exit (2);
     98  exit (0);
     99
     100# if (0)
    87101  // identiy the comm
    88102  Command *cmd = MatchCommand (argv[1], TRUE, TRUE);
     
    96110  if (!status) exit (2);
    97111  exit (0);
     112# endif
    98113}
    99114
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/dvo_host_utils.c

    r33543 r33563  
    66# define MAX_PATH_LENGTH 1024
    77
    8 int HostTableLaunchJobs (HostTable *table, char *basecmd) {
     8int HostTableLaunchJobs (HostTable *table, char *basecmd, char *options) {
    99
    1010  int i;
     
    1919    snprintf (resultFile, MAX_PATH_LENGTH, "%s/dvo.results.fits", table->hosts[i].pathname);
    2020
     21    char *commandFile = abspath("dvo_client.command.txt", MAX_PATH_LENGTH);
     22    FILE *f = fopen (commandFile, "w");
     23    fprintf (f, "%s\n", basecmd);
     24    fclose (f);
     25
    2126    char command[1024];
    22     snprintf (command, 1024, "dvo_client %s -result %s -hostID %d -hostdir %s", basecmd, resultFile, table->hosts[i].hostID, table->hosts[i].pathname);
     27    snprintf (command, 1024, "dvo_client %s -result %s %s -hostID %d -hostdir %s", commandFile, resultFile, options, table->hosts[i].hostID, table->hosts[i].pathname);
     28    free (commandFile);
    2329
    2430    if (DEBUG || PARALLEL_MANUAL) fprintf (stderr, "command: %s\n", command);
     
    103109
    104110  char tmp;
    105   char *command = NULL;
    106   int length = snprintf (&tmp, 0, "%s -D CATDIR %s -time %s %s -skyregion %f %f %f %f", basecmd, CATDIR, TimeRef, TimeFormat, Rmin, Rmax, Dmin, Dmax);
     111  char *options = NULL;
     112  int length = snprintf (&tmp, 0, "-D CATDIR %s -time %s %s -skyregion %f %f %f %f", CATDIR, TimeRef, TimeFormat, Rmin, Rmax, Dmin, Dmax);
    107113
    108   ALLOCATE (command, char, length);
    109   snprintf (command, length, "%s -D CATDIR %s -time %s %s -skyregion %f %f %f %f", basecmd, CATDIR, TimeRef, TimeFormat, Rmin, Rmax, Dmin, Dmax);
     114  ALLOCATE (options, char, length);
     115  snprintf (options, length, "-D CATDIR %s -time %s %s -skyregion %f %f %f %f", CATDIR, TimeRef, TimeFormat, Rmin, Rmax, Dmin, Dmax);
    110116
    111117  // launch this command remotely
    112   HostTableLaunchJobs (table, command);
    113   free (command);
     118  HostTableLaunchJobs (table, basecmd, options);
     119  free (options);
     120  free (basecmd);
    114121
    115122  if (PARALLEL_MANUAL) {
     
    158165  free (vec);
    159166
     167  free (table);
    160168  return TRUE;
    161169}
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/gcat.c

    r20535 r33563  
    33int gcat (int argc, char **argv) {
    44 
    5   int i;
     5  int i, N;
    66  struct stat filestat;
    77  double Ra, Dec, Radius;
     
    99  SkyList *skylist;
    1010  void *Signal;
     11
     12  int ShowHost = FALSE;
     13  if ((N = get_argument (argc, argv, "-host"))) {
     14    remove_argument (N, &argc, argv);
     15    ShowHost = TRUE;
     16  }
     17  int ShowBackup = FALSE;
     18  if ((N = get_argument (argc, argv, "-backup"))) {
     19    remove_argument (N, &argc, argv);
     20    ShowBackup = TRUE;
     21  }
     22  int ShowFlags = FALSE;
     23  if ((N = get_argument (argc, argv, "-flags"))) {
     24    remove_argument (N, &argc, argv);
     25    ShowFlags = TRUE;
     26  }
    1127
    1228  if ((argc != 3) && (argc != 4)) {
     
    3147
    3248  for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) {
     49    gprint (GP_ERR, "%3d %s", i, skylist[0].regions[i][0].name);
    3350    if (stat (skylist[0].filename[i], &filestat) != -1) {
    34       gprint (GP_ERR, "%3d %s *\n", i, skylist[0].regions[i][0].name);
     51      gprint (GP_ERR, " *");
    3552    } else {
    36       gprint (GP_ERR, "%3d %s\n", i, skylist[0].regions[i][0].name);
     53      gprint (GP_ERR, "  ");
    3754    }
     55    if (ShowHost) {
     56      gprint (GP_ERR, "  %3d", skylist[0].regions[i][0].hostID);
     57    } else {
     58      gprint (GP_ERR, "     ");
     59    }
     60    if (ShowBackup) {
     61      gprint (GP_ERR, "  %3d", skylist[0].regions[i][0].backupID);
     62    } else {
     63      gprint (GP_ERR, "     ");
     64    }
     65    if (ShowFlags) {
     66      gprint (GP_ERR, "  0x%04x", skylist[0].regions[i][0].hostFlags);
     67    } else {
     68      gprint (GP_ERR, "        ");
     69    }
     70    gprint (GP_ERR, "\n");
    3871    set_str_variable ("CATNAME", skylist[0].filename[i]);
    3972  }
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/dvo/mextract.c

    r33543 r33563  
    3838    remove_argument (N, &argc, argv);
    3939    PARALLEL = TRUE;
    40   }
    41 
    42   // dump results directly to fits file (esp for parallel dvo)
    43   char *ResultFile = NULL;
    44   if ((N = get_argument (argc, argv, "-result"))) {
    45     remove_argument (N, &argc, argv);
    46     ResultFile = strcreate(argv[N]);
    47     remove_argument (N, &argc, argv);
    4840  }
    4941
     
    6355  }
    6456
    65   // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
    66   if (PARALLEL && !HOST_ID) {
    67     // not all parallel ops need to set the region selection...
    68     if (!SetSkyRegions (selection)) goto escape;
    69 
    70     int status = HostTableParallelOps (argc, argv, ResultFile, 0);
    71     return status;
    72   }
    73 
    7457  // init locally static variables (time refs)
    7558  dbExtractMeasuresInit();
     
    11295  /* load region corresponding to selection above */
    11396  if ((skylist = SelectRegions (selection)) == NULL) goto escape;
     97
     98  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
     99  if (PARALLEL && !HOST_ID) {
     100    int status = HostTableParallelOps (argc, argv, RESULT_FILE, 0);
     101
     102    dbFreeFields (fields, Nfields);
     103    dbFreeStack (stack, Nstack);
     104    free (stack);
     105    FreeSkyRegionSelection (selection);
     106    dvo_catalog_free (&catalog);
     107
     108    return status;
     109  }
    114110
    115111  // load image data if needed (for fields listed below)
     
    227223
    228224  // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
    229   if (ResultFile) {
    230     int status = WriteVectorTableFITS (ResultFile, "RESULT", vec, Nreturn, FALSE, NULL);
     225  if (RESULT_FILE) {
     226    int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL);
    231227    if (!status) goto escape;
    232228  }
     
    243239
    244240escape:
    245   if (ResultFile) free (ResultFile);
    246241  if (vec) free (vec);
    247242  free (values);
  • branches/eam_branches/ipp-20111122/Ohana/src/opihi/include/dvoshell.h

    r33543 r33563  
    3030int   HOST_ID;
    3131char *HOSTDIR;
     32char *RESULT_FILE;
    3233
    3334/*** dvo prototypes ***/
     
    9899dbValue      dbExtractImages        PROTO((Image *image, off_t Nimage, off_t N, dbField *field));
    99100
    100 int          HostTableLaunchJobs    PROTO((HostTable *table, char *basecmd));
     101int          HostTableLaunchJobs    PROTO((HostTable *table, char *basecmd, char *options));
    101102int          HostTableParallelOps   PROTO((int argc, char **argv, char *ResultFile, int Nelements));
    102103# endif
Note: See TracChangeset for help on using the changeset viewer.