From a4c786d52613063d338ee010f4415e8a6aef0513 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 9 Mar 2022 16:31:01 +0100 Subject: GUI: Use sbatch/scancel/scontrol instead of Slurm API This commit strips out all references to the Slurm API, instead making subprocess calls to sbatch and scontrol. Attempting to use the Slurm API seems to have been a mis-step. First, it seems that nowhere has the Slurm headers pre-installed. Literally none of the facilities where there are known deployments of CrystFEL have them. And in a significant fraction of cases, getting them installed is difficult, slow or impossible. In addition, the API doesn't seem to work in all cases, so we already shell out to 'scancel' to abort jobs - see d76fc3495. There are some tricky implications for submitting Slurm jobs from a container via the API. The Slurm REST API offers a solution, but is very new and not widely available. Calls to the Slurm executables are much easier to 'tunnel' out of a container. This isn't a great solution. It's a net increase of only about 40 lines of source code, but it incurs some unpleasant string handling and will probably be less reliable overall. It completely relies on Slurm's not being internationalised. If Slurm's messages start getting translated, we will be in trouble. --- src/gui_project.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/gui_project.c') diff --git a/src/gui_project.c b/src/gui_project.c index 59f9852a..7ab4e367 100644 --- a/src/gui_project.c +++ b/src/gui_project.c @@ -880,6 +880,7 @@ static void read_frames(FILE *fh, struct crystfelproject *proj) } +/* NB caller is responsible for applying default_project() to proj */ int load_project(struct crystfelproject *proj) { FILE *fh; @@ -887,12 +888,6 @@ int load_project(struct crystfelproject *proj) fh = fopen("crystfel.project", "r"); if ( fh == NULL ) return 1; - if ( default_project(proj) ) { - ERROR("Failed to make default project when loading.\n"); - fclose(fh); - return 1; - } - read_parameters(fh, proj); read_results(fh, proj); read_frames(fh, proj); @@ -1226,12 +1221,11 @@ int default_project(struct crystfelproject *proj) return 1; } - #ifdef HAVE_SLURM - if ( make_slurm_backend(&proj->backends[proj->n_backends++]) ) { - ERROR("SLURM backend setup failed\n"); - return 1; + if ( make_slurm_backend(&proj->backends[proj->n_backends]) == 0 ) { + proj->n_backends++; + } else { + STATUS("Slurm unavailable\n"); } - #endif /* Default parameter values */ proj->show_centre = 1; -- cgit v1.2.3