diff --git a/src/common/node_select.c b/src/common/node_select.c index 6d8aca094b770859df1ba817c4ad627a7e9e3aac..22e7c54cd6f9ac0f634c49003c91edb5bcbcee21 100644 --- a/src/common/node_select.c +++ b/src/common/node_select.c @@ -90,6 +90,7 @@ static int _select_get_ops(char *select_type, "select_p_job_expand_allow", "select_p_job_expand", "select_p_job_resized", + "select_p_job_signal", "select_p_job_fini", "select_p_job_suspend", "select_p_job_resume", @@ -686,6 +687,21 @@ extern int select_g_job_resized(struct job_record *job_ptr, (job_ptr, node_ptr); } +/* + * Pass job-step signal to plugin before signalling any job steps, so that + * any signal-dependent actions can be taken. + * IN job_ptr - job to be signalled + * IN signal - signal(7) number + */ +extern int select_g_job_signal(struct job_record *job_ptr, int signal) +{ + if (slurm_select_init(0) < 0) + return SLURM_ERROR; + + return (*(select_context[select_context_default].ops.job_signal)) + (job_ptr, signal); +} + /* * Note termination of job is starting. Executed from slurmctld. * IN job_ptr - pointer to job being terminated diff --git a/src/common/node_select.h b/src/common/node_select.h index 4fcbb7640d2f1ad6e39bc20573222ae8795e8cc3..19f3dca21f562fd6fd602efeacf2317b8135d4fd 100644 --- a/src/common/node_select.h +++ b/src/common/node_select.h @@ -159,6 +159,8 @@ typedef struct slurm_select_ops { struct job_record *to_job_ptr); int (*job_resized) (struct job_record *job_ptr, struct node_record *node_ptr); + int (*job_signal) (struct job_record *job_ptr, + int signal); int (*job_fini) (struct job_record *job_ptr); int (*job_suspend) (struct job_record *job_ptr); int (*job_resume) (struct job_record *job_ptr); @@ -447,6 +449,14 @@ extern int select_g_job_expand(struct job_record *from_job_ptr, extern int select_g_job_resized(struct job_record *job_ptr, struct node_record *node_ptr); +/* + * Pass job-step signal to plugin before signalling any job steps, so that + * any signal-dependent actions can be taken. + * IN job_ptr - job to be signalled + * IN signal - signal(7) number + */ +extern int select_g_job_signal(struct job_record *job_ptr, int signal); + /* * Note termination of job is starting. Executed from slurmctld. * IN job_ptr - pointer to job being terminated diff --git a/src/plugins/select/bluegene/select_bluegene.c b/src/plugins/select/bluegene/select_bluegene.c index 84e62d604e64c8e3e9435b7908d10f0e3b8bc860..e4bea7c4c83f08539c11ec173621678b38ec9938 100644 --- a/src/plugins/select/bluegene/select_bluegene.c +++ b/src/plugins/select/bluegene/select_bluegene.c @@ -1116,6 +1116,11 @@ extern int select_p_job_expand(struct job_record *from_job_ptr, return ESLURM_NOT_SUPPORTED; } +extern int select_p_job_signal(struct job_record *job_ptr, int signal) +{ + return SLURM_SUCCESS; +} + extern int select_p_job_fini(struct job_record *job_ptr) { #ifdef HAVE_BG diff --git a/src/plugins/select/cons_res/select_cons_res.c b/src/plugins/select/cons_res/select_cons_res.c index 6c7cf40e86a88c383ccc7be8c9433312e081d566..d6dab3741eb2c05e8e252ce233f9b9bbaeba69ac 100644 --- a/src/plugins/select/cons_res/select_cons_res.c +++ b/src/plugins/select/cons_res/select_cons_res.c @@ -1826,6 +1826,14 @@ extern int select_p_job_expand(struct job_record *from_job_ptr, return ESLURM_NOT_SUPPORTED; } +extern int select_p_job_signal(struct job_record *job_ptr, int signal) +{ + xassert(job_ptr); + xassert(job_ptr->magic == JOB_MAGIC); + + return SLURM_SUCCESS; +} + extern int select_p_job_fini(struct job_record *job_ptr) { xassert(job_ptr); diff --git a/src/plugins/select/cray/other_select.c b/src/plugins/select/cray/other_select.c index 97a0cc0c1aaeaf1087c239f4d4b7fce01039f33c..5b2a89643cdd74280eaf015497b4e3610d0ba628 100644 --- a/src/plugins/select/cray/other_select.c +++ b/src/plugins/select/cray/other_select.c @@ -85,6 +85,7 @@ static slurm_select_ops_t *_other_select_get_ops(slurm_select_context_t *c) "select_p_job_begin", "select_p_job_ready", "select_p_job_resized", + "select_p_job_signal", "select_p_job_fini", "select_p_job_suspend", "select_p_job_resume", @@ -428,6 +429,20 @@ extern int other_job_resized(struct job_record *job_ptr, (job_ptr, node_ptr); } +/* + * Pass job-step signal to other plugin. + * IN job_ptr - job to be signalled + * IN signal - signal(7) number + */ +extern int other_job_signal(struct job_record *job_ptr, int signal) +{ + if (other_select_init() < 0) + return -1; + + return (*(other_select_context->ops.job_signal)) + (job_ptr, signal); +} + /* * Note termination of job is starting. Executed from slurmctld. * IN job_ptr - pointer to job being terminated diff --git a/src/plugins/select/cray/other_select.h b/src/plugins/select/cray/other_select.h index e17b59884afa2ffdd17c1fd714597f57f70a7fef..bb93b23cfc177315e9f8f8c009f06cc845500f66 100644 --- a/src/plugins/select/cray/other_select.h +++ b/src/plugins/select/cray/other_select.h @@ -197,6 +197,13 @@ extern int other_job_expand(struct job_record *from_job_ptr, extern int other_job_resized(struct job_record *job_ptr, struct node_record *node_ptr); +/* + * Pass job-step signal to other plugin. + * IN job_ptr - job to be signalled + * IN signal - signal(7) number + */ +extern int other_job_signal(struct job_record *job_ptr, int signal); + /* * Note termination of job is starting. Executed from slurmctld. * IN job_ptr - pointer to job being terminated diff --git a/src/plugins/select/cray/select_cray.c b/src/plugins/select/cray/select_cray.c index 8c1c24a5cd9d01fca130de53fe0bdfcff1e81345..d3e4301f6e64e864f664dadb9e2d155a6903bdea 100644 --- a/src/plugins/select/cray/select_cray.c +++ b/src/plugins/select/cray/select_cray.c @@ -279,6 +279,11 @@ extern int select_p_job_expand(struct job_record *from_job_ptr, return ESLURM_NOT_SUPPORTED; } +extern int select_p_job_signal(struct job_record *job_ptr, int signal) +{ + return other_job_signal(job_ptr, signal); +} + extern int select_p_job_fini(struct job_record *job_ptr) { /* diff --git a/src/plugins/select/linear/select_linear.c b/src/plugins/select/linear/select_linear.c index 16db77c6157b6985bf97122813b19df7f59c1719..96fa2817341560477b55360bb1979697a9675c06 100644 --- a/src/plugins/select/linear/select_linear.c +++ b/src/plugins/select/linear/select_linear.c @@ -2827,6 +2827,11 @@ extern int select_p_job_resized(struct job_record *job_ptr, return rc; } +extern int select_p_job_signal(struct job_record *job_ptr, int signal) +{ + return SLURM_SUCCESS; +} + extern int select_p_job_fini(struct job_record *job_ptr) { int rc = SLURM_SUCCESS;