aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-09-08 12:03:00 +0200
committerThomas White <taw@physics.org>2020-09-08 16:16:48 +0200
commitc5abcd75f237c3fc03e13a9550404a3a391b31c6 (patch)
tree775cd12819b1eb2b7c512aa14bf5eb2a6659b8cb /src
parent1501d5ff2d0eb6d485beed579d5e1051682d5cc5 (diff)
Just use project structure in backends
We have to pass the crystfelproject anyway, to add the new results to the list. It seems messy to pass everything else separately, when at this moment the values must be exactly what is in the project structure anyway.
Diffstat (limited to 'src')
-rw-r--r--src/gui_backend_local.c20
-rw-r--r--src/gui_backend_slurm.c26
-rw-r--r--src/gui_index.c11
-rw-r--r--src/gui_project.h10
4 files changed, 22 insertions, 45 deletions
diff --git a/src/gui_backend_local.c b/src/gui_backend_local.c
index 6d385d82..cbb8767b 100644
--- a/src/gui_backend_local.c
+++ b/src/gui_backend_local.c
@@ -146,14 +146,8 @@ void setup_subprocess(gpointer user_data)
static void *run_indexing(const char *job_title,
const char *job_notes,
- char **filenames,
- char **events,
- int n_frames,
- char *geom_filename,
- struct peak_params *peak_search_params,
- struct index_params *indexing_params,
- void *opts_priv,
- struct crystfelproject *proj)
+ struct crystfelproject *proj,
+ void *opts_priv)
{
struct local_indexing_opts *opts = opts_priv;
GIOChannel *ioch;
@@ -206,23 +200,23 @@ static void *run_indexing(const char *job_title,
old_pwd = getcwd(NULL, 0);
chdir(workdir);
- if ( write_file_list(filenames, events, n_frames) ) {
+ if ( write_file_list(proj->filenames, proj->events, proj->n_frames) ) {
STATUS("Failed to write list\n");
free(job);
return NULL;
}
chdir(old_pwd);
- job->n_frames = n_frames;
+ job->n_frames = proj->n_frames;
job->frac_complete = 0.0;
snprintf(n_thread_str, 63, "%i", opts->n_processes);
- args = indexamajig_command_line(geom_filename,
+ args = indexamajig_command_line(proj->geom_filename,
n_thread_str,
"files.lst",
"crystfel.stream",
- peak_search_params,
- indexing_params);
+ &proj->peak_search_params,
+ &proj->indexing_params);
i = 0;
while ( args[i] != NULL ) {
diff --git a/src/gui_backend_slurm.c b/src/gui_backend_slurm.c
index d10c5d4b..53bee2bc 100644
--- a/src/gui_backend_slurm.c
+++ b/src/gui_backend_slurm.c
@@ -318,14 +318,8 @@ static void write_partial_file_list(GFile *workdir,
static void *run_indexing(const char *job_title,
const char *job_notes,
- char **filenames,
- char **events,
- int n_frames,
- char *geom_filename,
- struct peak_params *peak_search_params,
- struct index_params *indexing_params,
- void *opts_priv,
- struct crystfelproject *proj)
+ struct crystfelproject *proj,
+ void *opts_priv)
{
struct slurm_indexing_opts *opts = opts_priv;
struct slurm_job *job;
@@ -376,9 +370,9 @@ static void *run_indexing(const char *job_title,
job = malloc(sizeof(struct slurm_job));
if ( job == NULL ) return 0;
- job->n_frames = n_frames;
- job->n_blocks = n_frames / opts->block_size;
- if ( n_frames % opts->block_size ) job->n_blocks++;
+ job->n_frames = proj->n_frames;
+ job->n_blocks = proj->n_frames / opts->block_size;
+ if ( proj->n_frames % opts->block_size ) job->n_blocks++;
STATUS("Splitting job into %i blocks of max %i frames\n",
job->n_blocks, opts->block_size);
@@ -411,9 +405,11 @@ static void *run_indexing(const char *job_title,
write_partial_file_list(workdir_file, file_list,
i, opts->block_size,
- filenames, events, n_frames);
+ proj->filenames,
+ proj->events,
+ proj->n_frames);
- job_id = submit_batch_job(geom_filename,
+ job_id = submit_batch_job(proj->geom_filename,
file_list,
stream_filename,
opts->email_address,
@@ -424,8 +420,8 @@ static void *run_indexing(const char *job_title,
workdir,
stderr_file,
stdout_file,
- peak_search_params,
- indexing_params);
+ &proj->peak_search_params,
+ &proj->indexing_params);
if ( job_id == 0 ) {
fail = 1;
diff --git a/src/gui_index.c b/src/gui_index.c
index d0790e4c..d11028b4 100644
--- a/src/gui_index.c
+++ b/src/gui_index.c
@@ -98,15 +98,8 @@ static int run_indexing_all(struct crystfelproject *proj,
void *job_priv;
be = &proj->backends[backend_idx];
- job_priv = be->run_indexing(job_title, job_notes,
- proj->filenames,
- proj->events,
- proj->n_frames,
- proj->geom_filename,
- &proj->peak_search_params,
- &proj->indexing_params,
- be->indexing_opts_priv,
- proj);
+ job_priv = be->run_indexing(job_title, job_notes, proj,
+ be->indexing_opts_priv);
if ( job_priv != NULL ) {
add_running_task(proj, "Indexing all frames",
diff --git a/src/gui_project.h b/src/gui_project.h
index af0335bb..d830473b 100644
--- a/src/gui_project.h
+++ b/src/gui_project.h
@@ -99,14 +99,8 @@ struct crystfel_backend {
* It should return a void pointer representing this job */
void *(*run_indexing)(const char *job_title,
const char *job_notes,
- char **filenames,
- char **events,
- int n_frames,
- char *geom_filename,
- struct peak_params *peak_search_params,
- struct index_params *indexing_params,
- void *opts_priv,
- struct crystfelproject *proj);
+ struct crystfelproject *proj,
+ void *opts_priv);
/* Called to ask the backend to cancel the job */
void (*cancel_task)(void *job_priv);