Changeset 33662 for trunk/Ohana/src/opihi/dvo/avextract.c
- Timestamp:
- Apr 1, 2012, 3:24:39 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/avextract.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/avextract.c
r31450 r33662 37 37 } 38 38 39 int PARALLEL = FALSE; 40 if ((N = get_argument (argc, argv, "-parallel"))) { 41 remove_argument (N, &argc, argv); 42 PARALLEL = TRUE; 43 } 44 45 // use remote tables, but not dvo_client.. 46 int PARALLEL_LOCAL = FALSE; 47 HostTable *table = NULL; 48 if ((N = get_argument (argc, argv, "-parallel-local"))) { 49 remove_argument (N, &argc, argv); 50 PARALLEL_LOCAL = TRUE; 51 52 char *CATDIR = GetCATDIR(); 53 if (!CATDIR) { 54 gprint (GP_ERR, "CATDIR is not set\n"); 55 return FALSE; 56 } 57 SkyTable *sky = GetSkyTable(); 58 if (!sky) { 59 gprint (GP_ERR, "failed to load sky table for database\n"); 60 return FALSE; 61 } 62 table = HostTableLoad (CATDIR, sky->hosts); 63 if (!table) { 64 gprint (GP_ERR, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR); 65 return FALSE; 66 } 67 } 68 39 69 dvo_catalog_init (&catalog, TRUE); 40 70 … … 43 73 Nsecfilt = GetPhotcodeNsecfilt (); 44 74 45 // parse skyregion options 75 // parse skyregion options. NOTE: this is stripped off in parallel operation and always 76 // defined for the client via the -skyregion option. The dvo_client parses this 77 // argument in the main program, before it is passed to the command (like mextract) 46 78 if ((selection = SetRegionSelection (&argc, argv)) == NULL) { 47 79 print_error(); … … 85 117 /* load region corresponding to selection above */ 86 118 if ((skylist = SelectRegions (selection)) == NULL) goto escape; 119 120 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results 121 if (PARALLEL && !HOST_ID) { 122 int status = HostTableParallelOps (argc, argv, RESULT_FILE, 0, VERBOSE); 123 124 dbFreeFields (fields, Nfields); 125 dbFreeStack (stack, Nstack); 126 free (stack); 127 FreeSkyRegionSelection (selection); 128 dvo_catalog_free (&catalog); 129 130 return status; 131 } 87 132 88 133 /* create output storage vectors */ … … 114 159 interrupt = FALSE; 115 160 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 161 162 // does this host ID match the desired location for the table? 163 if (!HostTableTestHost(skylist[0].regions[i], HOST_ID)) continue; 164 116 165 /* lock, load, unlock catalog */ 117 catalog.filename = skylist[0].filename[i]; 166 char hostfile[1024]; 167 if (PARALLEL_LOCAL) { 168 int hostID = (skylist[0].regions[i]->hostFlags & DATA_USE_BCK) ? skylist[0].regions[i]->backupID : skylist[0].regions[i]->hostID; 169 int seq = table->index[hostID]; 170 HOSTDIR = table->hosts[seq].pathname; 171 } 172 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name); 173 catalog.filename = (HOST_ID || PARALLEL_LOCAL) ? hostfile : skylist[0].filename[i]; 118 174 catalog.catflags = LOAD_AVES | LOAD_SECF; 119 175 if (needMeasures) { … … 169 225 interrupt = FALSE; 170 226 for (n = 0; n < Nreturn; n++) { 171 vec[n][0].Nelements = Npts; 172 if (vec[n][0].type == OPIHI_FLT) { 173 REALLOCATE (vec[n][0].elements.Flt, opihi_flt, MAX(1,Npts)); 174 } else { 175 REALLOCATE (vec[n][0].elements.Int, opihi_int, MAX(1,Npts)); 176 } 177 } 178 227 ResetVector (vec[n], fields[n].type, Npts); 228 } 229 230 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) 231 if (RESULT_FILE) { 232 int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL); 233 if (!status) goto escape; 234 } 235 236 if (table) free (table); 179 237 if (vec) free (vec); 180 238 if (values) free (values); … … 187 245 188 246 escape: 247 if (table) free (table); 189 248 if (vec) free (vec); 190 249 if (values) free (values);
Note:
See TracChangeset
for help on using the changeset viewer.
