aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-09-23 14:56:27 +0200
committerThomas White <taw@physics.org>2019-09-23 14:56:27 +0200
commit7251c3d83cc0bce49597ec41f97f930d5f70fb78 (patch)
tree4f0801ede67a2143cc05c86c314ecab40502e46a /src
parent7fcddbf213e2674871ef078a3b228a32fd9f488f (diff)
parentaad71902c94b3bc21ab34b0e2c92972400921574 (diff)
Merge branch 'tom/pinkindexer'
Diffstat (limited to 'src')
-rw-r--r--src/im-sandbox.c20
-rw-r--r--src/im-sandbox.h2
-rw-r--r--src/indexamajig.c30
-rw-r--r--src/process_image.c13
-rw-r--r--src/process_image.h1
5 files changed, 43 insertions, 23 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index da632618..8097c273 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -73,6 +73,12 @@ struct sandbox
int n_processed_last_stats;
time_t t_last_stats;
+ /* Processing timeout in seconds. After this long without responding
+ * to a ping, the worker will be killed. After 3 times this long
+ * working on one image, even with ping responses, a warning will be
+ * shown to the user. */
+ int timeout;
+
struct index_args *iargs;
/* Worker processes */
@@ -158,17 +164,18 @@ static void check_hung_workers(struct sandbox *sb)
stamp_response(sb, i);
}
- if ( tnow - sb->last_response[i] > 240 ) {
- STATUS("Worker %i did not respond for 4 minutes - "
- "sending it SIGKILL.\n", i);
+ if ( tnow - sb->last_response[i] > sb->timeout ) {
+ STATUS("Worker %i did not respond for %i seconds - "
+ "sending it SIGKILL.\n", i, sb->timeout);
kill(sb->pids[i], SIGKILL);
stamp_response(sb, i);
}
- if ( tnow - sb->shared->time_last_start[i] > 600 ) {
+ if ( tnow - sb->shared->time_last_start[i] > sb->timeout*3 ) {
if ( !sb->shared->warned_long_running[i] ) {
STATUS("Worker %i has been working on one "
- "frame for more than 10 minutes.\n", i);
+ "frame for more than %i seconds (just "
+ "for info).\n", i, sb->timeout);
STATUS("Event ID is: %s\n",
sb->shared->last_ev[i]);
STATUS("Task ID is: %s\n",
@@ -1045,7 +1052,7 @@ char *create_tempdir(const char *temp_location)
int create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
int config_basename, FILE *fh,
Stream *stream, const char *tmpdir, int serial_start,
- const char *zmq_address, int profile)
+ const char *zmq_address, int timeout, int profile)
{
int i;
struct sandbox *sb;
@@ -1075,6 +1082,7 @@ int create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
sb->serial = serial_start;
sb->tmpdir = tmpdir;
sb->profile = profile;
+ sb->timeout = timeout;
if ( zmq_address != NULL ) {
sb->zmq = 1;
sb->zmq_address = zmq_address;
diff --git a/src/im-sandbox.h b/src/im-sandbox.h
index 2c43a543..3acd62db 100644
--- a/src/im-sandbox.h
+++ b/src/im-sandbox.h
@@ -84,6 +84,6 @@ extern void set_last_task(char *lt, const char *task);
extern int create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
int config_basename, FILE *fh, Stream *stream,
const char *tempdir, int serial_start,
- const char *zmq_address, int profile);
+ const char *zmq_address, int timeout, int profile);
#endif /* IM_SANDBOX_H */
diff --git a/src/indexamajig.c b/src/indexamajig.c
index bb115cc3..e607ec29 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -117,6 +117,7 @@ struct indexamajig_arguments
TakeTwoOptions **taketwo_opts_ptr;
FelixOptions **felix_opts_ptr;
XGandalfOptions **xgandalf_opts_ptr;
+ PinkIndexerOptions **pinkindexer_opts_ptr;
};
@@ -139,6 +140,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
state->child_inputs[0] = args->taketwo_opts_ptr;
state->child_inputs[1] = args->felix_opts_ptr;
state->child_inputs[2] = args->xgandalf_opts_ptr;
+ state->child_inputs[3] = args->pinkindexer_opts_ptr;
break;
case 'h' :
@@ -255,6 +257,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
ERROR("Invalid value for --min-peaks\n");
return EINVAL;
}
+ (*(args->pinkindexer_opts_ptr))->min_peaks = args->iargs.min_peaks;
break;
case 304 :
@@ -479,10 +482,8 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
break;
case 503 :
- if ( sscanf(arg, "%f", &args->iargs.fix_bandwidth) != 1 ) {
- ERROR("Invalid value for --fix-bandwidth\n");
- return EINVAL;
- }
+ ERROR("The option --fix-bandwidth is no longer used.\n");
+ ERROR("Set the bandwidth in the geometry file instead.\n");
break;
case 504 :
@@ -593,9 +594,11 @@ int main(int argc, char *argv[])
int r;
struct beam_params beam;
char *zmq_address = NULL;
+ int timeout = 240;
TakeTwoOptions *taketwo_opts = NULL;
FelixOptions *felix_opts = NULL;
XGandalfOptions *xgandalf_opts = NULL;
+ PinkIndexerOptions *pinkindexer_opts = NULL;
/* Defaults for "top level" arguments */
args.filename = NULL;
@@ -620,6 +623,7 @@ int main(int argc, char *argv[])
args.taketwo_opts_ptr = &taketwo_opts;
args.felix_opts_ptr = &felix_opts;
args.xgandalf_opts_ptr = &xgandalf_opts;
+ args.pinkindexer_opts_ptr = &pinkindexer_opts;
/* Defaults for process_image arguments */
args.iargs.cell = NULL;
@@ -675,7 +679,6 @@ int main(int argc, char *argv[])
args.iargs.push_res = -1.0;
args.iargs.highres = +INFINITY;
args.iargs.fix_profile_r = -1.0;
- args.iargs.fix_bandwidth = -1.0;
args.iargs.fix_divergence = -1.0;
args.iargs.no_image_data = 0;
@@ -809,6 +812,7 @@ int main(int argc, char *argv[])
{&taketwo_argp, 0, NULL, -2},
{&felix_argp, 0, NULL, -2},
{&xgandalf_argp, 0, NULL, -2},
+ {&pinkIndexer_argp, 0, NULL, -2},
{0}
};
@@ -979,6 +983,8 @@ int main(int argc, char *argv[])
} else {
+ int i, n;
+ const IndexingMethod *methods;
IndexingFlags flags = 0;
if ( args.iargs.cell != NULL ) {
@@ -1005,16 +1011,26 @@ int main(int argc, char *argv[])
}
args.iargs.ipriv = setup_indexing(args.indm_str, args.iargs.cell,
- args.iargs.det,
+ args.iargs.det, args.iargs.beam,
args.iargs.tols, flags,
taketwo_opts,
xgandalf_opts,
+ pinkindexer_opts,
felix_opts);
if ( args.iargs.ipriv == NULL ) {
ERROR("Failed to set up indexing system\n");
return 1;
}
+ methods = indexing_methods(args.iargs.ipriv, &n);
+ for ( i=0; i<n; i++ ) {
+ if ( methods[i] & INDEXING_PINKINDEXER ) {
+ /* Extend timeout if using pinkIndexer */
+ timeout = 3000;
+ break;
+ }
+ }
+
}
/* Change back to where we were before. Sandbox code will create
@@ -1056,7 +1072,7 @@ int main(int argc, char *argv[])
r = create_sandbox(&args.iargs, args.n_proc, args.prefix, args.basename,
fh, st, tmpdir, args.serial_start, zmq_address,
- args.profile);
+ timeout, args.profile);
free_imagefile_field_list(args.iargs.copyme);
cell_free(args.iargs.cell);
diff --git a/src/process_image.c b/src/process_image.c
index 654ffd46..f28952bc 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -226,6 +226,8 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
&imfile) ) return;
}
+ image.bw = iargs->beam->bandwidth;
+
/* Take snapshot of image before applying horrible noise filters */
time_accounts_set(taccs, TACC_FILTER);
set_last_task(last_task, "image filter");
@@ -369,17 +371,12 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
} else {
image.div = 0.0;
}
- if ( iargs->fix_bandwidth >= 0.0 ) {
- image.bw = iargs->fix_bandwidth;
- } else {
- image.bw = 0.00000001;
- }
-
- /* Set beam spectrum for pink beam data */
+ /* Set beam spectrum */
if ( iargs->spectrum != NULL ) {
image.spectrum = iargs->spectrum;
} else {
- image.spectrum = spectrum_generate_gaussian(image.lambda, image.bw);
+ image.spectrum = spectrum_generate_gaussian(image.lambda,
+ image.bw);
}
if ( image_feature_count(image.features) < iargs->min_peaks ) {
diff --git a/src/process_image.h b/src/process_image.h
index 1b899619..395a54cd 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -107,7 +107,6 @@ struct index_args
float push_res;
float highres;
float fix_profile_r;
- float fix_bandwidth;
float fix_divergence;
int overpredict;
Spectrum *spectrum;