Skip to content
Snippets Groups Projects
Commit 1240c1f6 authored by Moe Jette's avatar Moe Jette
Browse files

dd scancel support for --clusters option

parent 9b559a5c
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ documents those changes that are of interest to users and admins. ...@@ -26,6 +26,7 @@ documents those changes that are of interest to users and admins.
-- Improve accuracy of REQUEST_JOB_WILL_RUN start time with respect to higher -- Improve accuracy of REQUEST_JOB_WILL_RUN start time with respect to higher
priority pending jobs. priority pending jobs.
-- Add -R/--reservation option to squeue command as a job filter. -- Add -R/--reservation option to squeue command as a job filter.
-- Add scancel support for --clusters option.
* Changes in SLURM 2.3.0.pre5 * Changes in SLURM 2.3.0.pre5
============================= =============================
......
...@@ -365,10 +365,10 @@ static void _opt_args(int argc, char **argv) ...@@ -365,10 +365,10 @@ static void _opt_args(int argc, char **argv)
break; break;
case (int)'M': case (int)'M':
opt.ctld = true; opt.ctld = true;
if(opt.clusters) if (opt.clusters)
list_destroy(opt.clusters); list_destroy(opt.clusters);
if(!(opt.clusters = opt.clusters = slurmdb_get_info_cluster(optarg);
slurmdb_get_info_cluster(optarg))) { if (!opt.clusters) {
error("'%s' invalid entry for --cluster", error("'%s' invalid entry for --cluster",
optarg); optarg);
exit(1); exit(1);
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include "slurm/slurm.h" #include "slurm/slurm.h"
#include "src/common/list.h"
#include "src/common/log.h" #include "src/common/log.h"
#include "src/common/xstring.h" #include "src/common/xstring.h"
#include "src/common/xmalloc.h" #include "src/common/xmalloc.h"
...@@ -69,14 +70,16 @@ ...@@ -69,14 +70,16 @@
#define MAX_THREADS 20 #define MAX_THREADS 20
static void _cancel_jobs (void); static void _cancel_jobs (void);
static void *_cancel_job_id (void *cancel_info); static void *_cancel_job_id (void *cancel_info);
static void *_cancel_step_id (void *cancel_info); static void *_cancel_step_id (void *cancel_info);
static int _confirmation (int i, uint32_t step_id); static int _confirmation (int i, uint32_t step_id);
static void _filter_job_records (void); static void _filter_job_records (void);
static void _load_job_records (void); static void _load_job_records (void);
static int _verify_job_ids (void); static int _multi_cluster(List clusters);
static int _proc_cluster(void);
static int _verify_job_ids (void);
static job_info_msg_t * job_buffer_ptr = NULL; static job_info_msg_t * job_buffer_ptr = NULL;
...@@ -107,9 +110,41 @@ main (int argc, char *argv[]) ...@@ -107,9 +110,41 @@ main (int argc, char *argv[])
log_alter (log_opts, SYSLOG_FACILITY_DAEMON, NULL); log_alter (log_opts, SYSLOG_FACILITY_DAEMON, NULL);
} }
if (opt.clusters)
rc = _multi_cluster(opt.clusters);
else
rc = _proc_cluster();
exit (rc);
}
/* _multi_cluster - process job cancellation across a list of clusters */
static int
_multi_cluster(List clusters)
{
ListIterator itr;
int rc = 0, rc2;
itr = list_iterator_create(clusters);
if (!itr)
fatal("list_iterator_create: malloc failure");
while ((working_cluster_rec = list_next(itr))) {
rc2 = _proc_cluster();
rc = MAX(rc, rc2);
}
list_iterator_destroy(itr);
return rc;
}
/* _proc_cluster - process job cancellation on a specific cluster */
static int
_proc_cluster(void)
{
int rc;
_load_job_records(); _load_job_records();
rc = _verify_job_ids(); rc = _verify_job_ids();
if ((opt.account) || if ((opt.account) ||
(opt.interactive) || (opt.interactive) ||
(opt.job_name) || (opt.job_name) ||
...@@ -120,14 +155,14 @@ main (int argc, char *argv[]) ...@@ -120,14 +155,14 @@ main (int argc, char *argv[])
(opt.state != JOB_END) || (opt.state != JOB_END) ||
(opt.user_name) || (opt.user_name) ||
(opt.wckey)) { (opt.wckey)) {
_filter_job_records (); _filter_job_records();
} }
_cancel_jobs (); _cancel_jobs ();
slurm_free_job_info_msg(job_buffer_ptr);
exit (rc); return rc;
} }
/* _load_job_records - load all job information for filtering and verification */ /* _load_job_records - load all job information for filtering and verification */
static void static void
_load_job_records (void) _load_job_records (void)
......
...@@ -117,6 +117,8 @@ static int _multi_cluster(List clusters) ...@@ -117,6 +117,8 @@ static int _multi_cluster(List clusters)
int rc = 0, rc2; int rc = 0, rc2;
itr = list_iterator_create(clusters); itr = list_iterator_create(clusters);
if (!itr)
fatal("list_iterator_create: malloc failure");
while ((working_cluster_rec = list_next(itr))) { while ((working_cluster_rec = list_next(itr))) {
if (first) if (first)
first = false; first = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment