aboutsummaryrefslogtreecommitdiff
path: root/src/gui_backend_slurm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui_backend_slurm.c')
-rw-r--r--src/gui_backend_slurm.c92
1 files changed, 77 insertions, 15 deletions
diff --git a/src/gui_backend_slurm.c b/src/gui_backend_slurm.c
index b5c75bb5..cb0cee59 100644
--- a/src/gui_backend_slurm.c
+++ b/src/gui_backend_slurm.c
@@ -31,39 +31,101 @@
#include <sys/wait.h>
#include <gtk/gtk.h>
-#include "crystfel_gui.h"
+#include "gui_project.h"
-struct slurm_backend_priv
+struct slurm_indexing_opts
{
- int dummy;
+ char *partition;
+ int block_size;
+ char *email_address;
};
-static void cancel(void *vp)
+struct slurm_indexing_job
{
+ double frac_complete;
+ /* FIXME: List of SLURM job numbers to track */
+};
+
+
+static void cancel_indexing(void *job_priv)
+{
+ //struct slurm_indexing_job *job = job_priv;
}
-static void *run_indexing(struct crystfelproject *proj)
+static void *run_indexing(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 slurm_indexing_opts *opts = opts_priv;
return NULL;
}
-static GtkWidget *make_parameters(void)
+static GtkWidget *make_indexing_parameters_widget(void *opts_priv)
{
+ //struct slurm_indexing_opts *opts = opts_priv;
+
return gtk_label_new("SLURM params");
}
-const struct crystfel_backend _backend_slurm =
- {
- .name = "slurm",
- .friendly_name = "SLURM",
- .make_parameters = make_parameters,
- .run_indexing = run_indexing,
- .cancel = cancel,
- };
+static struct slurm_indexing_opts *make_default_slurm_opts()
+{
+ struct slurm_indexing_opts *opts = malloc(sizeof(struct slurm_indexing_opts));
+ if ( opts == NULL ) return NULL;
+
+ opts->partition = NULL;
+ opts->block_size = 1000;
+ opts->email_address = NULL;
-const struct crystfel_backend *backend_slurm = &_backend_slurm;
+ return opts;
+}
+
+
+static void write_indexing_opts(void *opts_priv, FILE *fh)
+{
+ struct slurm_indexing_opts *opts = opts_priv;
+
+ fprintf(fh, "indexing.slurm.block_size %i\n",
+ opts->block_size);
+ fprintf(fh, "indexing.slurm.partition %s\n",
+ opts->partition);
+ fprintf(fh, "indexing.slurm.email_address %s\n",
+ opts->email_address);
+}
+
+
+static void read_indexing_opt(void *opts_priv,
+ const char *key,
+ const char *val)
+{
+ //struct slurm_indexing_opts *opts = opts_priv;
+
+ STATUS("SLURM got %s = '%s'\n", key, val);
+ /* FIXME: Parse and set */
+}
+
+
+int make_slurm_backend(struct crystfel_backend *be)
+{
+ be->name = "slurm";
+ be->friendly_name = "SLURM";
+
+ be->make_indexing_parameters_widget = make_indexing_parameters_widget;
+ be->run_indexing = run_indexing;
+ be->cancel_indexing = cancel_indexing;
+ be->write_indexing_opts = write_indexing_opts;
+ be->read_indexing_opt = read_indexing_opt;
+
+ be->indexing_opts_priv = make_default_slurm_opts();
+ if ( be->indexing_opts_priv == NULL ) return 1;
+
+ return 0;
+};