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

Add full logic for support of association's MaxJobs

parent 7df704a6
No related branches found
No related tags found
No related merge requests found
...@@ -673,3 +673,21 @@ extern int assoc_mgr_validate_assoc_id(void *db_conn, ...@@ -673,3 +673,21 @@ extern int assoc_mgr_validate_assoc_id(void *db_conn,
return SLURM_ERROR; return SLURM_ERROR;
} }
extern void assoc_mgr_clear_used_info(void)
{
ListIterator itr = NULL;
acct_association_rec_t * found_assoc = NULL;
if (!local_association_list)
return;
slurm_mutex_lock(&local_association_lock);
itr = list_iterator_create(local_association_list);
while((found_assoc = list_next(itr))) {
found_assoc->used_jobs = 0;
found_assoc->used_share = 0;
}
list_iterator_destroy(itr);
slurm_mutex_unlock(&local_association_lock);
}
...@@ -120,4 +120,10 @@ extern int assoc_mgr_validate_assoc_id(void *db_conn, ...@@ -120,4 +120,10 @@ extern int assoc_mgr_validate_assoc_id(void *db_conn,
uint32_t assoc_id, uint32_t assoc_id,
int enforce); int enforce);
/*
* clear the used_* fields from every assocation,
* used on reconfiguration
*/
extern void assoc_mgr_clear_used_info(void);
#endif /* _SLURM_ASSOC_MGR_H */ #endif /* _SLURM_ASSOC_MGR_H */
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
#include "src/slurmctld/slurmctld.h" #include "src/slurmctld/slurmctld.h"
#define _DEBUG 0
static bool _valid_job_assoc(struct job_record *job_ptr) static bool _valid_job_assoc(struct job_record *job_ptr)
{ {
acct_association_rec_t assoc_rec, *assoc_ptr; acct_association_rec_t assoc_rec, *assoc_ptr;
...@@ -61,7 +63,8 @@ static bool _valid_job_assoc(struct job_record *job_ptr) ...@@ -61,7 +63,8 @@ static bool _valid_job_assoc(struct job_record *job_ptr)
assoc_rec.acct = job_ptr->account; assoc_rec.acct = job_ptr->account;
if (assoc_mgr_fill_in_assoc(acct_db_conn, &assoc_rec, if (assoc_mgr_fill_in_assoc(acct_db_conn, &assoc_rec,
accounting_enforce, &assoc_ptr)) { accounting_enforce, &assoc_ptr)) {
info("_validate_job_assoc: invalid account or " "partition for uid=%u jobid=%u", info("_validate_job_assoc: invalid account or "
"partition for uid=%u jobid=%u",
job_ptr->user_id, job_ptr->job_id); job_ptr->user_id, job_ptr->job_id);
return false; return false;
} }
...@@ -119,8 +122,10 @@ extern bool acct_policy_job_runnable(struct job_record *job_ptr) ...@@ -119,8 +122,10 @@ extern bool acct_policy_job_runnable(struct job_record *job_ptr)
return false; return false;
assoc_ptr = job_ptr->assoc_ptr; assoc_ptr = job_ptr->assoc_ptr;
#if _DEBUG
info("acct_job_limits: %u of %u", info("acct_job_limits: %u of %u",
assoc_ptr->used_jobs, assoc_ptr->max_jobs); assoc_ptr->used_jobs, assoc_ptr->max_jobs);
#endif
if ((assoc_ptr->max_jobs != NO_VAL) && if ((assoc_ptr->max_jobs != NO_VAL) &&
(assoc_ptr->max_jobs != INFINITE) && (assoc_ptr->max_jobs != INFINITE) &&
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include "src/common/assoc_mgr.h"
#include "src/common/hostlist.h" #include "src/common/hostlist.h"
#include "src/common/list.h" #include "src/common/list.h"
#include "src/common/macros.h" #include "src/common/macros.h"
...@@ -66,6 +67,7 @@ ...@@ -66,6 +67,7 @@
#include "src/common/switch.h" #include "src/common/switch.h"
#include "src/common/xstring.h" #include "src/common/xstring.h"
#include "src/slurmctld/acct_policy.h"
#include "src/slurmctld/job_scheduler.h" #include "src/slurmctld/job_scheduler.h"
#include "src/slurmctld/licenses.h" #include "src/slurmctld/licenses.h"
#include "src/slurmctld/locks.h" #include "src/slurmctld/locks.h"
...@@ -816,7 +818,7 @@ int read_slurm_conf(int recover) ...@@ -816,7 +818,7 @@ int read_slurm_conf(int recover)
_purge_old_node_state(old_node_table_ptr, old_node_record_count); _purge_old_node_state(old_node_table_ptr, old_node_record_count);
if ((rc = _build_bitmaps())) if ((rc = _build_bitmaps()))
return rc; /* fatal error */ fatal("_build_bitmaps failure");
license_free(); license_free();
if (license_init(slurmctld_conf.licenses) != SLURM_SUCCESS) if (license_init(slurmctld_conf.licenses) != SLURM_SUCCESS)
...@@ -1175,6 +1177,7 @@ static void _validate_node_proc_count(void) ...@@ -1175,6 +1177,7 @@ static void _validate_node_proc_count(void)
/* /*
* _restore_job_dependencies - Build depend_list and license_list for every job * _restore_job_dependencies - Build depend_list and license_list for every job
* also reset the runing job count for scheduling policy
*/ */
static int _restore_job_dependencies(void) static int _restore_job_dependencies(void)
{ {
...@@ -1185,8 +1188,14 @@ static int _restore_job_dependencies(void) ...@@ -1185,8 +1188,14 @@ static int _restore_job_dependencies(void)
bool valid; bool valid;
List license_list; List license_list;
assoc_mgr_clear_used_info();
job_iterator = list_iterator_create(job_list); job_iterator = list_iterator_create(job_list);
while ((job_ptr = (struct job_record *) list_next(job_iterator))) { while ((job_ptr = (struct job_record *) list_next(job_iterator))) {
if (accounting_enforce &&
((job_ptr->job_state == JOB_RUNNING) ||
(job_ptr->job_state == JOB_SUSPENDED)))
acct_policy_job_begin(job_ptr);
license_list = license_job_validate(job_ptr->licenses, &valid); license_list = license_job_validate(job_ptr->licenses, &valid);
if (job_ptr->license_list) if (job_ptr->license_list)
list_destroy(job_ptr->license_list); list_destroy(job_ptr->license_list);
......
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