Changeset 36188
- Timestamp:
- Oct 9, 2013, 10:36:43 AM (13 years ago)
- Location:
- trunk/Ohana/src/dvopsps
- Files:
-
- 4 edited
-
include/dvopsps.h (modified) (2 diffs)
-
src/initialize_dvopsps.c (modified) (4 diffs)
-
src/insert_detections_dvopsps.c (modified) (1 diff)
-
src/insert_detections_dvopsps_catalog.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/dvopsps/include/dvopsps.h
r35578 r36188 3 3 # include <signal.h> 4 4 # include "mysql.h" 5 # include "limits.h" 5 6 6 7 # define DVO_MAX_PATH 1024 … … 38 39 int PARALLEL_MANUAL; 39 40 int PARALLEL_SERIAL; 41 42 char *TIME_START; 43 char *TIME_END; 44 45 int PHOTCODE_START; 46 int PHOTCODE_END; 40 47 41 48 char *SINGLE_CPT; -
trunk/Ohana/src/dvopsps/src/initialize_dvopsps.c
r35206 r36188 2 2 3 3 void usage_dvopsps () { 4 fprintf (stderr, "USAGE: dvopsps (mode) [dbinfo] (mode)[options]\n");4 fprintf (stderr, "USAGE: dvopsps (mode) [dbinfo] [options]\n"); 5 5 fprintf (stderr, " mysql database info is supplied with these:\n"); 6 6 fprintf (stderr, " -dbhost : database host machine\n"); … … 11 11 fprintf (stderr, " -v : verbose mode\n"); 12 12 fprintf (stderr, " -region Rmin Rmax Dmin Dmax\n"); 13 fprintf (stderr, " -cpt n0000/0000.00 : limit to the named cpt file\n"); 13 14 fprintf (stderr, " -parallel : run in parallel mode\n"); 15 fprintf (stderr, " -insert-remote : in parallel mode, the client sends the data to the dbhost\n"); 16 fprintf (stderr, " -time-start YYYY/MM/DD,hh:mm:ss : limit detections to >= this time\n"); 17 fprintf (stderr, " -time-end YYYY/MM/DD,hh:mm:ss : limit detections to < this time\n"); 18 19 fprintf (stderr, " -photcode-start NN : limit detections to >= this photcode number\n"); 20 fprintf (stderr, " -photcode-end NN : limit detections to < this photcode number\n"); 21 fprintf (stderr, "\n"); 22 23 fprintf (stderr, " (mode) is one of detections, objects, skytable\n"); 24 25 fprintf (stderr, "\n"); 14 26 fprintf (stderr, " -h : this help list\n"); 15 27 fprintf (stderr, " -help : this help list\n"); 16 28 fprintf (stderr, " --h : this help list\n"); 17 29 fprintf (stderr, " --help : this help list\n"); 30 18 31 fprintf (stderr, " Note that the dvo db can be specified by -D CATDIR (directory)\n"); 19 32 exit (2); … … 110 123 if ((N = get_argument (argc, argv, "-insert-remote"))) { 111 124 SAVE_REMOTE = FALSE; 125 remove_argument (N, &argc, argv); 126 } 127 128 TIME_START = NULL; 129 if ((N = get_argument (argc, argv, "-time-start"))) { 130 remove_argument (N, &argc, argv); 131 TIME_START = strcreate(argv[N]); 132 remove_argument (N, &argc, argv); 133 time_t TIME_START_SEC; 134 if (!ohana_str_to_time (TIME_START, &TIME_START_SEC)) { 135 fprintf (stderr, "error with starting time given by -time-start: %s\n", TIME_START); 136 exit (2); 137 } 138 } 139 140 TIME_END = NULL; 141 if ((N = get_argument (argc, argv, "-time-end"))) { 142 remove_argument (N, &argc, argv); 143 TIME_END = strcreate(argv[N]); 144 remove_argument (N, &argc, argv); 145 time_t TIME_END_SEC; 146 if (!ohana_str_to_time (TIME_END, &TIME_END_SEC)) { 147 fprintf (stderr, "error with starting time given by -time-end: %s\n", TIME_END); 148 exit (2); 149 } 150 } 151 152 PHOTCODE_START = 0; 153 if ((N = get_argument (argc, argv, "-photcode-start"))) { 154 remove_argument (N, &argc, argv); 155 PHOTCODE_START = atoi(argv[N]); 156 remove_argument (N, &argc, argv); 157 } 158 159 PHOTCODE_END = INT_MAX; 160 if ((N = get_argument (argc, argv, "-photcode-end"))) { 161 remove_argument (N, &argc, argv); 162 PHOTCODE_END = atoi(argv[N]); 112 163 remove_argument (N, &argc, argv); 113 164 } … … 260 311 } 261 312 313 TIME_START = NULL; 314 if ((N = get_argument (argc, argv, "-time-start"))) { 315 remove_argument (N, &argc, argv); 316 TIME_START = strcreate(argv[N]); 317 remove_argument (N, &argc, argv); 318 time_t TIME_START_SEC; 319 if (!ohana_str_to_time (TIME_START, &TIME_START_SEC)) { 320 fprintf (stderr, "error with starting time given by -time-start: %s\n", TIME_START); 321 exit (2); 322 } 323 } 324 325 TIME_END = NULL; 326 if ((N = get_argument (argc, argv, "-time-end"))) { 327 remove_argument (N, &argc, argv); 328 TIME_END = strcreate(argv[N]); 329 remove_argument (N, &argc, argv); 330 time_t TIME_END_SEC; 331 if (!ohana_str_to_time (TIME_END, &TIME_END_SEC)) { 332 fprintf (stderr, "error with starting time given by -time-end: %s\n", TIME_END); 333 exit (2); 334 } 335 } 336 337 PHOTCODE_START = 0; 338 if ((N = get_argument (argc, argv, "-photcode-start"))) { 339 remove_argument (N, &argc, argv); 340 PHOTCODE_START = atoi(argv[N]); 341 remove_argument (N, &argc, argv); 342 } 343 344 PHOTCODE_END = INT_MAX; 345 if ((N = get_argument (argc, argv, "-photcode-end"))) { 346 remove_argument (N, &argc, argv); 347 PHOTCODE_END = atoi(argv[N]); 348 remove_argument (N, &argc, argv); 349 } 350 262 351 VERBOSE = FALSE; 263 352 if ((N = get_argument (argc, argv, "-v"))) { -
trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps.c
r35804 r36188 152 152 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 153 153 if (SAVE_REMOTE) { snprintf (tmpline, 1024, "%s -save %s", command, table->hosts[i].results); strcpy (command, tmpline); } 154 155 // some filters -- these are the detections we skip 156 if (TIME_START) { snprintf (tmpline, 1024, "%s -time-start %s", command, TIME_START); strcpy (command, tmpline); } 157 if (TIME_END) { snprintf (tmpline, 1024, "%s -time-end %s", command, TIME_END); strcpy (command, tmpline); } 158 159 if (PHOTCODE_START > 0) { snprintf (tmpline, 1024, "%s -photcode-start %d", command, PHOTCODE_START); strcpy (command, tmpline); } 160 if (PHOTCODE_END <= INT_MAX) { snprintf (tmpline, 1024, "%s -photcode-end %d", command, PHOTCODE_END); strcpy (command, tmpline); } 154 161 155 162 fprintf (stderr, "command: %s\n", command); -
trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
r36097 r36188 29 29 } 30 30 31 time_t TIME_START_SEC = 0; 32 time_t TIME_END_SEC = 0; 33 if (TIME_START) ohana_str_to_time (TIME_START, &TIME_START_SEC); // we validate this in the args.c 34 if (TIME_END) ohana_str_to_time (TIME_END, &TIME_END_SEC); // we validate this in the args.c 35 31 36 for (i = 0; i < catalog[0].Naverage; i++) { 32 37 … … 40 45 Average *average = &catalog->average[i]; 41 46 Measure *measure = &catalog->measure[m + j]; 47 48 // some filters -- these are the detections we skip 49 if (TIME_START && (measure->t < TIME_START_SEC)) continue; 50 if (TIME_END && (measure->t >= TIME_END_SEC)) continue; 51 52 if (measure->photcode < PHOTCODE_START) continue; 53 if (measure->photcode >= PHOTCODE_END) continue; 54 42 55 PhotCode *code = GetPhotcodebyCode(measure->photcode); 43 56 … … 87 100 } 88 101 102 time_t TIME_START_SEC = 0; 103 time_t TIME_END_SEC = INT_MAX; 104 89 105 int insert_detections_dvopsps_catalog (Catalog *catalog, MYSQL *mysql) { 90 106 … … 108 124 int status = TRUE; 109 125 126 if (TIME_START) ohana_str_to_time (TIME_START, &TIME_START_SEC); // we validate this in the args.c 127 if (TIME_END) ohana_str_to_time (TIME_END, &TIME_END_SEC); // we validate this in the args.c 128 110 129 // NOTE for testing, just do a few objects 111 130 if (!mysql) { … … 121 140 for (j = 0; j < average[i].Nmeasure; j++) { 122 141 142 off_t Nmeas = m + j; 143 144 // some filters -- these are the detections we skip (not an error, just skipped) 145 if (TIME_START && (measure[Nmeas].t < TIME_START_SEC)) continue; 146 if (TIME_END && (measure[Nmeas].t >= TIME_END_SEC)) continue; 147 148 if (measure[Nmeas].photcode < PHOTCODE_START) continue; 149 if (measure[Nmeas].photcode >= PHOTCODE_END) continue; 150 123 151 // XXX check return status 124 if (!insert_detections_mysql_value (&buffer, &average[i], &measure[ m+j])) {152 if (!insert_detections_mysql_value (&buffer, &average[i], &measure[Nmeas])) { 125 153 fprintf (stderr, "failure to insert detections in mysql\n"); 126 154 status = FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.
