From 5ab69ccb6deb2c5c10701f784a8b6c38abc14c15 Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Tue, 28 Apr 2015 14:21:36 -0700 Subject: [PATCH] Change SchedulingParameters sched_min_interval meaning Make this be the minimum time between the end of one scheduling cycle and the start of the next cycle (rather than using start times for both). Set the default value to 1,000,000 microseconds for Cray/ALPS systems. --- doc/man/man5/slurm.conf.5 | 7 ++++--- src/slurmctld/job_scheduler.c | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/doc/man/man5/slurm.conf.5 b/doc/man/man5/slurm.conf.5 index e8264d96571..e53f10612f9 100644 --- a/doc/man/man5/slurm.conf.5 +++ b/doc/man/man5/slurm.conf.5 @@ -2278,10 +2278,11 @@ The scheduler runs in a limited fashion every time that any event happens which could enable a job to start (e.g. job submit, job terminate, etc.). If these events happen at a high frequency, the scheduler can run very frequently and consume significant resources if not throttled by this option. -This option specifies the minimum time between the start of a scheduling -cycle, without considering how long the scheduling logic runs. +This option specifies the minimum time between the end of one scheduling +cycle and the beginning of the next scheduling cycle. A value of zero will disable throttling of the scheduling logic interval. -The default value is zero microseconds (throttling is disabled). +The default value is 1,000,000 microseconds on Cray/ALPS systems and +zero microseconds (throttling is disabled) on other systems. .RE .TP diff --git a/src/slurmctld/job_scheduler.c b/src/slurmctld/job_scheduler.c index 2a1039f5683..02919d59deb 100644 --- a/src/slurmctld/job_scheduler.c +++ b/src/slurmctld/job_scheduler.c @@ -119,8 +119,12 @@ static int save_last_part_update = 0; static pthread_mutex_t sched_mutex = PTHREAD_MUTEX_INITIALIZER; static int sched_pend_thread = 0; -static int sched_min_interval = 0; static struct timeval sched_last = {0, 0}; +#ifdef HAVE_ALPS_CRAY +static int sched_min_interval = 1000000; +#else +static int sched_min_interval = 0; +#endif extern diag_stats_t slurmctld_diag_stats; @@ -794,13 +798,20 @@ extern int schedule(uint32_t job_limit) sched_job_limit += job_limit; /* test more jobs */ if (delta_t >= sched_min_interval) { - sched_last.tv_sec = now.tv_sec; - sched_last.tv_usec = now.tv_usec; + /* Temporariy set time in the future until we get the real + * scheduler completion time */ + sched_last.tv_sec = now.tv_sec + 10; job_limit = sched_job_limit; sched_job_limit = -1; slurm_mutex_unlock(&sched_mutex); job_count = _schedule(job_limit); + + slurm_mutex_lock(&sched_mutex); + gettimeofday(&now, NULL); + sched_last.tv_sec = now.tv_sec; + sched_last.tv_usec = now.tv_usec; + slurm_mutex_unlock(&sched_mutex); } else if (sched_pend_thread == 0) { /* We don't want to run now, but also don't want to defer * this forever, so spawn a thread to run later */ -- GitLab