From a6d523d345f1777a9f9917176fce6724ceba7f11 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Tue, 13 Apr 2010 18:15:56 +0000 Subject: [PATCH] Add new configuration parameter JobSubmitPlugins. It's value is not used yet. --- NEWS | 4 ++++ RELEASE_NOTES | 4 ++++ doc/man/man5/slurm.conf.5 | 12 ++++++++++++ slurm/slurm.h.in | 1 + src/api/config_info.c | 5 +++++ src/common/read_config.c | 6 ++++++ src/common/slurm_protocol_api.c | 19 +++++++++++++++++++ src/common/slurm_protocol_api.h | 7 +++++++ src/common/slurm_protocol_pack.c | 3 +++ src/slurmctld/proc_req.c | 1 + 10 files changed, 62 insertions(+) diff --git a/NEWS b/NEWS index afd83677ded..17f4d6efadd 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ This file describes changes in recent versions of SLURM. It primarily documents those changes that are of interest to users and admins. + -- Add new configuration parameter JobSubmitPlugins which provides a mechanism + to set default job parameters or perform other site-configurable actions at + job submit time. + * Changes in SLURM 2.2.0.pre5 ============================= -- Modify commands to accept time format with one or two digit hour value diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 302aceb5dfb..8e6bebbf61e 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -76,6 +76,10 @@ CONFIGURATION FILE CHANGES (see "man slurm.conf" for details) * Added new configuration parameters SlurmSchedLogFile and SlurmSchedLogLevel to support writing scheduling events to a separate log file. +* Added new configuration parameter JobSubmitPlugins which provides a mechanism + to set default job parameters or perform other site-configurable actions at + job submit time. + * Added "--enable-partial-attach" option to configure (build) script. * Added support for new partition states of DRAIN and INACTIVE and new partition diff --git a/doc/man/man5/slurm.conf.5 b/doc/man/man5/slurm.conf.5 index b8cf112a2e3..42e8f43ac70 100644 --- a/doc/man/man5/slurm.conf.5 +++ b/doc/man/man5/slurm.conf.5 @@ -640,6 +640,18 @@ Use the \fBsbatch\fR \fI\-\-no\-requeue\fR or \fI\-\-requeue\fR option to change the default behavior for individual jobs. The default value is 1. +.TP +\fBJobSubmitPlugins\fR +A comma delimited list of job submission plugins to be used. +The specified plugins will be executed in the order listed. +These are intended to be site\-specific plugins which can be used to set +default job parameters and/or logging events. +Sample plugins available in the distribution include "defaults", "logging" and +"partition". +See the SLURM code in "src/plugins/job_submit" and modify the code to satisfy +your needs. +No job submission plugins are used by default. + .TP \fBKillOnBadExit\fR If set to 1, the job will be terminated immediately when one of the diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in index 06476edbbfc..2f001254981 100644 --- a/slurm/slurm.h.in +++ b/slurm/slurm.h.in @@ -1342,6 +1342,7 @@ typedef struct slurm_ctl_conf { char *job_credential_public_certificate;/* path to public certificate*/ uint16_t job_file_append; /* if set, append to stdout/err file */ uint16_t job_requeue; /* If set, jobs get requeued on node failre */ + char *job_submit_plugins; /* List of job_submit plugins to use */ uint16_t kill_on_bad_exit; /* If set, the job will be * terminated immediately when one of * the processes is aborted or crashed */ diff --git a/src/api/config_info.c b/src/api/config_info.c index 1ba4450e6e5..ec54ef0fd61 100644 --- a/src/api/config_info.c +++ b/src/api/config_info.c @@ -529,6 +529,11 @@ extern void *slurm_ctl_conf_2_key_pairs (slurm_ctl_conf_t* slurm_ctl_conf_ptr) key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); + key_pair = xmalloc(sizeof(config_key_pair_t)); + key_pair->name = xstrdup("JobSubmitPlugins"); + key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_submit_plugins); + list_append(ret_list, key_pair); + snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->kill_on_bad_exit); key_pair = xmalloc(sizeof(config_key_pair_t)); diff --git a/src/common/read_config.c b/src/common/read_config.c index d0554b20194..8c51cc6d063 100644 --- a/src/common/read_config.c +++ b/src/common/read_config.c @@ -195,6 +195,7 @@ s_p_options_t slurm_conf_options[] = { {"JobCredentialPublicCertificate", S_P_STRING}, {"JobFileAppend", S_P_UINT16}, {"JobRequeue", S_P_UINT16}, + {"JobSubmitPlugins", S_P_STRING}, {"KillTree", S_P_UINT16, _defunct_option}, {"KillOnBadExit", S_P_UINT16}, {"KillWait", S_P_UINT16}, @@ -1435,6 +1436,7 @@ free_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr, bool purge_node_hash) xfree (ctl_conf_ptr->job_comp_user); xfree (ctl_conf_ptr->job_credential_private_key); xfree (ctl_conf_ptr->job_credential_public_certificate); + xfree (ctl_conf_ptr->job_submit_plugins); xfree (ctl_conf_ptr->licenses); xfree (ctl_conf_ptr->mail_prog); xfree (ctl_conf_ptr->mpi_default); @@ -1538,6 +1540,7 @@ init_slurm_conf (slurm_ctl_conf_t *ctl_conf_ptr) xfree (ctl_conf_ptr->job_credential_public_certificate); ctl_conf_ptr->job_file_append = (uint16_t) NO_VAL; ctl_conf_ptr->job_requeue = (uint16_t) NO_VAL; + xfree(ctl_conf_ptr->job_submit_plugins); ctl_conf_ptr->kill_wait = (uint16_t) NO_VAL; xfree (ctl_conf_ptr->licenses); xfree (ctl_conf_ptr->mail_prog); @@ -2074,6 +2077,9 @@ _validate_and_set_defaults(slurm_ctl_conf_t *conf, s_p_hashtbl_t *hashtbl) else if (conf->job_requeue > 1) conf->job_requeue = 1; + s_p_get_string(&conf->job_submit_plugins, "JobSubmitPlugins", + hashtbl); + if (!s_p_get_uint16(&conf->get_env_timeout, "GetEnvTimeout", hashtbl)) conf->get_env_timeout = DEFAULT_GET_ENV_TIMEOUT; diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c index 9e560b52c31..1110b0f51af 100644 --- a/src/common/slurm_protocol_api.c +++ b/src/common/slurm_protocol_api.c @@ -947,6 +947,25 @@ char *slurm_get_health_check_program(void) return health_check_program; } +/* slurm_get_job_submit_plugins + * get job_submit_plugins from slurmctld_conf object from + * slurmctld_conf object + * RET char * - job_submit_plugins, MUST be xfreed by caller + */ +char *slurm_get_job_submit_plugins(void) +{ + char *job_submit_plugins = NULL; + slurm_ctl_conf_t *conf; + + if(slurmdbd_conf) { + } else { + conf = slurm_conf_lock(); + job_submit_plugins = xstrdup(conf->job_submit_plugins); + slurm_conf_unlock(); + } + return job_submit_plugins; +} + /* slurm_get_accounting_storage_type * returns the accounting storage type from slurmctld_conf object * RET char * - accounting storage type, MUST be xfreed by caller diff --git a/src/common/slurm_protocol_api.h b/src/common/slurm_protocol_api.h index 69d49af7635..26d455c58d8 100644 --- a/src/common/slurm_protocol_api.h +++ b/src/common/slurm_protocol_api.h @@ -196,6 +196,13 @@ uint32_t slurm_get_hash_val(void); */ char *slurm_get_health_check_program(void); +/* slurm_get_job_submit_plugins + * get job_submit_plugins from slurmctld_conf object from + * slurmctld_conf object + * RET char * - job_submit_plugins, MUST be xfreed by caller + */ +char *slurm_get_job_submit_plugins(void); + /* slurm_get_plugin_dir * get plugin directory from slurmctld_conf object from slurmctld_conf object * RET char * - plugin directory, MUST be xfreed by caller diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index 387979e6eb2..15706504a34 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -3819,6 +3819,7 @@ _pack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t * build_ptr, Buf buffer, packstr(build_ptr->job_credential_public_certificate, buffer); pack16(build_ptr->job_file_append, buffer); pack16(build_ptr->job_requeue, buffer); + packstr(build_ptr->job_submit_plugins, buffer); pack16(build_ptr->kill_on_bad_exit, buffer); pack16(build_ptr->kill_wait, buffer); @@ -4253,6 +4254,8 @@ _unpack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t **build_buffer_ptr, &uint32_tmp, buffer); safe_unpack16(&build_ptr->job_file_append, buffer); safe_unpack16(&build_ptr->job_requeue, buffer); + safe_unpackstr_xmalloc(&build_ptr->job_submit_plugins, + &uint32_tmp, buffer); safe_unpack16(&build_ptr->kill_on_bad_exit, buffer); safe_unpack16(&build_ptr->kill_wait, buffer); diff --git a/src/slurmctld/proc_req.c b/src/slurmctld/proc_req.c index 2349d7ab8be..ed0c278fda2 100644 --- a/src/slurmctld/proc_req.c +++ b/src/slurmctld/proc_req.c @@ -475,6 +475,7 @@ void _fill_ctld_conf(slurm_ctl_conf_t * conf_ptr) job_credential_public_certificate); conf_ptr->job_file_append = conf->job_file_append; conf_ptr->job_requeue = conf->job_requeue; + conf_ptr->job_submit_plugins = xstrdup(conf->job_submit_plugins); conf_ptr->get_env_timeout = conf->get_env_timeout; -- GitLab