/* backfill_agent - detached thread periodically attempts to backfill jobs */ extern void *backfill_agent(void *args) { time_t now; double wait_time; static time_t last_backfill_time = 0; /* Read config and partitions; Write jobs and nodes */ slurmctld_lock_t all_locks = { READ_LOCK, WRITE_LOCK, WRITE_LOCK, READ_LOCK }; _load_config(); last_backfill_time = time(NULL); while (!stop_backfill) { _my_sleep(backfill_interval); if (stop_backfill) break; if (config_flag) { config_flag = false; _load_config(); } now = time(NULL); wait_time = difftime(now, last_backfill_time); if ((wait_time < backfill_interval) || _job_is_completing() || _many_pending_rpcs() || !avail_front_end(NULL) || !_more_work(last_backfill_time)) continue; lock_slurmctld(all_locks); while (_attempt_backfill()) ; last_backfill_time = time(NULL); unlock_slurmctld(all_locks); } return NULL; }
/* backfill_agent - detached thread periodically attempts to backfill jobs */ extern void *backfill_agent(void *args) { struct timeval tv1, tv2; char tv_str[20]; time_t now; double wait_time; static time_t last_backfill_time = 0; /* Read config and partitions; Write jobs and nodes */ slurmctld_lock_t all_locks = { READ_LOCK, WRITE_LOCK, WRITE_LOCK, READ_LOCK }; _load_config(); last_backfill_time = time(NULL); while (!stop_backfill) { _my_sleep(backfill_interval); if (stop_backfill) break; if (config_flag) { config_flag = false; _load_config(); } now = time(NULL); wait_time = difftime(now, last_backfill_time); if ((wait_time < backfill_interval) || _job_is_completing() || _many_pending_rpcs() || !avail_front_end() || !_more_work(last_backfill_time)) continue; gettimeofday(&tv1, NULL); lock_slurmctld(all_locks); while (_attempt_backfill()) ; last_backfill_time = time(NULL); unlock_slurmctld(all_locks); gettimeofday(&tv2, NULL); _diff_tv_str(&tv1, &tv2, tv_str, 20); if (debug_flags & DEBUG_FLAG_BACKFILL) info("backfill: completed, %s", tv_str); } return NULL; }
/* backfill_agent - detached thread periodically attempts to backfill jobs */ extern void *backfill_agent(void *args) { time_t now; double wait_time; static time_t last_backfill_time = 0; /* Read config and partitions; Write jobs and nodes */ slurmctld_lock_t all_locks = { READ_LOCK, WRITE_LOCK, WRITE_LOCK, READ_LOCK }; #if HAVE_SYS_PRCTL_H if (prctl(PR_SET_NAME, "slurmctld_bckfl", NULL, NULL, NULL) < 0) { error("%s: cannot set my name to %s %m", __func__, "slurm_backfill"); } #endif _load_config(); last_backfill_time = time(NULL); while (!stop_backfill) { _my_sleep(backfill_interval * 1000000); if (stop_backfill) break; if (config_flag) { config_flag = false; _load_config(); } now = time(NULL); wait_time = difftime(now, last_backfill_time); if ((wait_time < backfill_interval) || _job_is_completing() || _many_pending_rpcs() || !avail_front_end(NULL) || !_more_work(last_backfill_time)) continue; lock_slurmctld(all_locks); (void) _attempt_backfill(); last_backfill_time = time(NULL); unlock_slurmctld(all_locks); } return NULL; }