diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 1ebcec6f7281e241fe4afdd03f5a3524690b5ef6..60008491e32f03b37e737fd3422c8b566db44a80 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -71,7 +71,6 @@ #include "src/common/xstring.h" #include "src/common/assoc_mgr.h" -#include "src/slurmctld/acct_policy.h" #include "src/slurmctld/agent.h" #include "src/slurmctld/job_scheduler.h" #include "src/slurmctld/licenses.h" @@ -4773,7 +4772,6 @@ extern void job_completion_logger(struct job_record *job_ptr) g_slurm_jobcomp_write(job_ptr); jobacct_storage_g_job_complete(acct_db_conn, job_ptr); - acct_policy_job_fini(job_ptr); } /* diff --git a/src/slurmctld/node_scheduler.c b/src/slurmctld/node_scheduler.c index 654809ab331f92783462c3bf74d158913216501b..d7de9fe7aa80dba95e607b7df9ef55013f698939 100644 --- a/src/slurmctld/node_scheduler.c +++ b/src/slurmctld/node_scheduler.c @@ -111,7 +111,8 @@ static bitstr_t *_valid_features(struct job_details *detail_ptr, /* * allocate_nodes - change state of specified nodes to NODE_STATE_ALLOCATED - * also claim required licenses + * also claim required licenses and resources reserved by accounting + * policy association * IN job_ptr - job being allocated resources */ extern void allocate_nodes(struct job_record *job_ptr) @@ -126,14 +127,15 @@ extern void allocate_nodes(struct job_record *job_ptr) } license_job_get(job_ptr); + acct_policy_job_begin(job_ptr); return; } /* * deallocate_nodes - for a given job, deallocate its nodes and make - * their state NODE_STATE_COMPLETING - * also release the job's licenses + * their state NODE_STATE_COMPLETING also release the job's licenses + * and resources reserved by accounting policy association * IN job_ptr - pointer to terminating job (already in some COMPLETING state) * IN timeout - true if job exhausted time limit, send REQUEST_KILL_TIMELIMIT * RPC instead of REQUEST_TERMINATE_JOB @@ -153,6 +155,7 @@ extern void deallocate_nodes(struct job_record *job_ptr, bool timeout, xassert(job_ptr->details); license_job_return(job_ptr); + acct_policy_job_fini(job_ptr); if (slurm_sched_freealloc(job_ptr) != SLURM_SUCCESS) error("slurm_sched_freealloc(%u): %m", job_ptr->job_id); if (select_g_job_fini(job_ptr) != SLURM_SUCCESS) @@ -993,7 +996,6 @@ extern int select_nodes(struct job_record *job_ptr, bool test_only, mail_job_info(job_ptr, MAIL_JOB_BEGIN); jobacct_storage_g_job_start(acct_db_conn, job_ptr); - acct_policy_job_begin(job_ptr); slurm_sched_newalloc(job_ptr);