Exemple #1
0
extern uint32_t priority_g_set(uint32_t last_prio, struct job_record *job_ptr)
{
	if (slurm_priority_init() < 0)
		return 0;

	return (*(ops.set))(last_prio, job_ptr);
}
Exemple #2
0
extern void priority_g_job_end(struct job_record *job_ptr)
{
	if (slurm_priority_init() < 0)
		return;

	(*(ops.job_end))(job_ptr);
}
Exemple #3
0
extern List priority_g_get_priority_factors_list(
	priority_factors_request_msg_t *req_msg, uid_t uid)
{
	if (slurm_priority_init() < 0)
		return NULL;

	return (*(ops.get_priority_factors))(req_msg, uid);
}
Exemple #4
0
extern void priority_g_set_assoc_usage(slurmdb_assoc_rec_t *assoc)
{
	if (slurm_priority_init() < 0)
		return;

	(*(ops.set_assoc_usage))(assoc);
	return;
}
Exemple #5
0
extern List priority_g_get_priority_factors_list(
	priority_factors_request_msg_t *req_msg)
{
	if (slurm_priority_init() < 0)
		return NULL;

	return (*(g_priority_context->ops.get_priority_factors))(req_msg);
}
Exemple #6
0
extern void priority_g_set_assoc_usage(slurmdb_association_rec_t *assoc)
{
	if (slurm_priority_init() < 0)
		return;

	(*(g_priority_context->ops.set_assoc_usage))(assoc);
	return;
}
Exemple #7
0
extern double priority_g_calc_fs_factor(long double usage_efctv,
					long double shares_norm)
{
	if (slurm_priority_init() < 0)
		return 0.0;

	return (*(ops.calc_fs_factor))
		(usage_efctv, shares_norm);
}
Exemple #8
0
extern void priority_g_reconfig(bool assoc_clear)
{
	if (slurm_priority_init() < 0)
		return;

	(*(ops.reconfig))(assoc_clear);

	return;
}
Exemple #9
0
extern void priority_g_reconfig(void)
{
	if (slurm_priority_init() < 0)
		return;

	(*(g_priority_context->ops.reconfig))();

	return;
}
Exemple #10
0
int main (int argc, char **argv)
{
	log_options_t logopt = LOG_OPTS_STDERR_ONLY;
	slurm_ctl_conf_t *conf = NULL;
	shares_response_msg_t resp;

	log_init(xbasename(argv[0]), logopt, 0, NULL);
	xfree(slurmctld_conf.priority_type);
	//logopt.stderr_level += 5;
	logopt.prefix_level = 1;
	log_alter(logopt, 0, NULL);
	print_fields_have_header = 0;
	print_fields_parsable_print = PRINT_FIELDS_PARSABLE_ENDING;

	conf = slurm_conf_lock();
	/* force priority type to be multifactor */
	xfree(conf->priority_type);
	conf->priority_type = xstrdup("priority/multifactor");
	conf->priority_flags = PRIORITY_FLAGS_FAIR_TREE;
	/* force accounting type to be slurmdbd (It doesn't really talk
	 * to any database, but needs this to work with fairshare
	 * calculation). */
	xfree(conf->accounting_storage_type);
	conf->accounting_storage_type = xstrdup("accounting_storage/slurmdbd");
	/* set up a known environment to test against.  Since we are
	 * only concerned about the fairshare we won't look at the other
	 * factors here. */
	conf->priority_decay_hl = 1;
	conf->priority_favor_small = 0;
	conf->priority_max_age = conf->priority_decay_hl;
	conf->priority_reset_period = 0;
	conf->priority_weight_age = 0;
	conf->priority_weight_fs = 10000;
	conf->priority_weight_js = 0;
	conf->priority_weight_part = 0;
	conf->priority_weight_qos = 0;
	slurm_conf_unlock();

	/* we don't want to do any decay here so make the save state
	 * to /dev/null */
	xfree(slurmctld_conf.state_save_location);
	slurmctld_conf.state_save_location = "/dev/null";
	/* now set up the association tree */
	_setup_assoc_list();
	/* now set up the job list */
	job_list = list_create(_list_delete_job);

	/* now init the priorities of the associations */
	if (slurm_priority_init() != SLURM_SUCCESS)
		fatal("failed to initialize priority plugin");
	/* on some systems that don't have multiple cores we need to
	 * sleep to make sure the thread gets started. */
	sleep(1);
	memset(&resp, 0, sizeof(shares_response_msg_t));
	resp.assoc_shares_list = assoc_mgr_get_shares(NULL, 0, NULL, NULL);
	process(&resp, 0);

	/* free memory */
	if (slurm_priority_fini() != SLURM_SUCCESS)
		fatal("failed to finalize priority plugin");
	if (job_list)
		list_destroy(job_list);
	if (resp.assoc_shares_list)
		list_destroy(resp.assoc_shares_list);
	if (assoc_mgr_assoc_list)
		list_destroy(assoc_mgr_assoc_list);
	if (assoc_mgr_qos_list)
		list_destroy(assoc_mgr_qos_list);
	return 0;
}