aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-09-02 14:57:16 +0200
committerThomas White <taw@physics.org>2019-09-12 16:35:52 +0200
commitb0ceb28b75b7b0642cc40fa5dc4a48dcf8ec92ec (patch)
tree9e997fd426d675148c5cf206bacc9a689d34843c /src
parent6e713e3a78167d421acd7b511d07675ca0032d5a (diff)
Increase indexing timeout when using pinkIndexer
Diffstat (limited to 'src')
-rw-r--r--src/im-sandbox.c20
-rw-r--r--src/im-sandbox.h2
-rw-r--r--src/indexamajig.c14
3 files changed, 28 insertions, 8 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index dacc2dbb..d9348b37 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 */
@@ -157,17 +163,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",
@@ -1044,7 +1051,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)
+ const char *zmq_address, int timeout)
{
int i;
struct sandbox *sb;
@@ -1073,6 +1080,7 @@ int create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
sb->iargs = iargs;
sb->serial = serial_start;
sb->tmpdir = tmpdir;
+ 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 9da11526..b1f5502a 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);
+ const char *zmq_address, int timeout);
#endif /* IM_SANDBOX_H */
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 9fe14c65..13a44471 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -313,6 +313,7 @@ int main(int argc, char *argv[])
char *spectrum_fn = NULL;
int zmq = 0;
char *zmq_address = NULL;
+ int timeout = 240;
/* Defaults */
iargs.cell = NULL;
@@ -1363,6 +1364,8 @@ int main(int argc, char *argv[])
} else {
+ int i, n;
+ const IndexingMethod *methods;
IndexingFlags flags = 0;
if ( iargs.cell != NULL ) {
@@ -1400,6 +1403,15 @@ int main(int argc, char *argv[])
return 1;
}
+ methods = indexing_methods(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
@@ -1439,7 +1451,7 @@ int main(int argc, char *argv[])
}
r = create_sandbox(&iargs, n_proc, prefix, config_basename, fh,
- st, tmpdir, serial_start, zmq_address);
+ st, tmpdir, serial_start, zmq_address, timeout);
free_imagefile_field_list(iargs.copyme);
cell_free(iargs.cell);