From 43bef211c8694451067d54788b95d2d33af07f37 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@llnl.gov> Date: Mon, 23 Mar 2009 19:36:47 +0000 Subject: [PATCH] now controller sends reservations on first start up --- src/slurmctld/controller.c | 15 +++++++++++++-- src/slurmctld/job_mgr.c | 2 +- src/slurmctld/reservation.c | 21 +++++++++++++++++++++ src/slurmctld/reservation.h | 5 +++++ src/slurmctld/slurmctld.h | 5 ++++- 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c index e8c826168b5..76aee382ac8 100644 --- a/src/slurmctld/controller.c +++ b/src/slurmctld/controller.c @@ -1022,8 +1022,7 @@ static int _accounting_cluster_ready() /* see if we are running directly to a database * instead of a slurmdbd. */ - send_jobs_to_accounting(event_time); - send_nodes_to_accounting(event_time); + send_all_to_accounting(event_time); rc = SLURM_SUCCESS; } @@ -1344,6 +1343,18 @@ void save_all_state(void) dump_assoc_mgr_state(slurmctld_conf.state_save_location); } +/* send all info for the controller to accounting */ +extern void send_all_to_accounting(time_t event_time) +{ + /* ignore the rcs here because if there was an error we will + push the requests on the queue and process them when the + database server comes back up. + */ + send_jobs_to_accounting(event_time); + send_nodes_to_accounting(event_time); + send_resvs_to_accounting(event_time); +} + /* * _report_locks_set - report any slurmctld locks left set * RET count of locks currently set diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index a929dc3d6a4..2c4872300fc 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -6609,7 +6609,7 @@ extern int update_job_wckey(char *module, struct job_record *job_ptr, return SLURM_SUCCESS; } -extern int send_jobs_to_accounting(time_t event_time) +extern int send_jobs_to_accounting() { ListIterator itr = NULL; struct job_record *job_ptr; diff --git a/src/slurmctld/reservation.c b/src/slurmctld/reservation.c index 970bd1b4d9e..4e100ada0c6 100644 --- a/src/slurmctld/reservation.c +++ b/src/slurmctld/reservation.c @@ -2389,6 +2389,27 @@ extern void fini_job_resv_check(void) list_iterator_destroy(iter); } +/* send all reservations to accounting. Only needed at + * first registration + */ +extern int send_resvs_to_accounting() +{ + ListIterator itr = NULL; + slurmctld_resv_t *resv_ptr; + + if(!resv_list) + return SLURM_SUCCESS; + + itr = list_iterator_create(resv_list); + while ((resv_ptr = list_next(itr))) { + _post_resv_create(resv_ptr); + } + list_iterator_destroy(itr); + + return SLURM_SUCCESS; +} + + /* Set or clear NODE_STATE_MAINT for node_state as needed */ extern void set_node_maint_mode(void) { diff --git a/src/slurmctld/reservation.h b/src/slurmctld/reservation.h index e95ea39abfa..d91ec7590b4 100644 --- a/src/slurmctld/reservation.h +++ b/src/slurmctld/reservation.h @@ -65,6 +65,11 @@ extern int dump_all_resv_state(void); /* Purge all reservation data structures */ extern void resv_fini(void); +/* send all reservations to accounting. Only needed at + * first registration + */ +extern int send_resvs_to_accounting(); + /* Set or clear NODE_STATE_MAINT for node_state as needed */ extern void set_node_maint_mode(void); diff --git a/src/slurmctld/slurmctld.h b/src/slurmctld/slurmctld.h index a75118e209b..b4c03ebd176 100644 --- a/src/slurmctld/slurmctld.h +++ b/src/slurmctld/slurmctld.h @@ -1444,10 +1444,13 @@ extern void run_health_check(void); /* save_all_state - save entire slurmctld state for later recovery */ extern void save_all_state(void); +/* send all info for the controller to accounting */ +extern void send_all_to_accounting(time_t event_time); + /* sends all jobs in eligible state to accounting. Only needed at * first registration */ -extern int send_jobs_to_accounting(time_t event_time); +extern int send_jobs_to_accounting(); /* send all nodes in a down like state to accounting. Only needed at * first registration -- GitLab