View | Details | Raw Unified | Return to ticket 2242 | Differences between
and this patch

Collapse All | Expand All

(-)a/doc/man/man1/sacctmgr.1 (-4 / +31 lines)
Lines 1019-1024 The id of the QOS. Link Here
1019
Maximum number of TRES minutes each job is able to use.
1019
Maximum number of TRES minutes each job is able to use.
1020
1020
1021
.TP
1021
.TP
1022
\fIMaxTRESPerAccount\fP
1023
Maximum number of TRES each account is able to use.
1024
1025
.TP
1022
\fIMaxTRESPerJob\fP
1026
\fIMaxTRESPerJob\fP
1023
Maximum number of TRES each job is able to use.
1027
Maximum number of TRES each job is able to use.
1024
1028
Lines 1031-1037 Maximum number of TRES each node in a job allocation can use. Link Here
1031
Maximum number of TRES each user is able to use.
1035
Maximum number of TRES each user is able to use.
1032
1036
1033
.TP
1037
.TP
1034
\fIMaxJobs\fP
1038
\fIMaxJobsPerAccount\fP
1039
Maximum number of jobs each account is allowed to run at one time.
1040
1041
.TP
1042
\fIMaxJobsPerUser\fP
1035
Maximum number of jobs each user is allowed to run at one time.
1043
Maximum number of jobs each user is allowed to run at one time.
1036
1044
1037
.TP
1045
.TP
Lines 1040-1046 Minimum number of TRES each job running under this QOS must request. Link Here
1040
Otherwise the job will pend until modified.
1048
Otherwise the job will pend until modified.
1041
1049
1042
.TP
1050
.TP
1043
\fIMaxSubmitJobs\fP
1051
\fIMaxSubmitJobsPerAccount\fP
1052
Maximum number of jobs pending or running state at any time per account.
1053
1054
.TP
1055
\fIMaxSubmitJobsPerUser\fP
1044
Maximum number of jobs pending or running state at any time per user.
1056
Maximum number of jobs pending or running state at any time per user.
1045
1057
1046
.TP
1058
.TP
Lines 1156-1161 To clear a previously set value use the modify command with a new Link Here
1156
value of \-1.
1168
value of \-1.
1157
1169
1158
.TP
1170
.TP
1171
\fIMaxTRESPerAccount\fP
1172
Maximum number of TRES each account is able to use.
1173
To clear a previously set value use the modify command with a new value of \-1.
1174
1175
.TP
1159
\fIMaxTRESPerJob\fP
1176
\fIMaxTRESPerJob\fP
1160
Maximum number of TRES each job is able to use.
1177
Maximum number of TRES each job is able to use.
1161
To clear a previously set value use the modify command with a new
1178
To clear a previously set value use the modify command with a new
Lines 1172-1183 Maximum number of TRES each user is able to use. Link Here
1172
To clear a previously set value use the modify command with a new value of \-1.
1189
To clear a previously set value use the modify command with a new value of \-1.
1173
1190
1174
.TP
1191
.TP
1175
\fIMaxJobs\fP
1192
\fIMaxJobsPerAccount\fP
1193
Maximum number of jobs each account is allowed to run at one time.
1194
To clear a previously set value use the modify command with a new value of \-1.
1195
1196
.TP
1197
\fIMaxJobsPerUser\fP
1176
Maximum number of jobs each user is allowed to run at one time.
1198
Maximum number of jobs each user is allowed to run at one time.
1177
To clear a previously set value use the modify command with a new value of \-1.
1199
To clear a previously set value use the modify command with a new value of \-1.
1178
1200
1179
.TP
1201
.TP
1180
\fIMaxSubmitJobs\fP
1202
\fIMaxSubmitJobsPerAccount\fP
1203
Maximum number of jobs pending or running state at any time per account.
1204
To clear a previously set value use the modify command with a new value of \-1.
1205
1206
.TP
1207
\fIMaxSubmitJobsPerUser\fP
1181
Maximum number of jobs pending or running state at any time per user.
1208
Maximum number of jobs pending or running state at any time per user.
1182
To clear a previously set value use the modify command with a new value of \-1.
1209
To clear a previously set value use the modify command with a new value of \-1.
1183
1210
(-)a/slurm/slurm.h.in (-1 / +13 lines)
Lines 536-542 enum job_state_reason { Link Here
536
				      * (burst buffer) */
536
				      * (burst buffer) */
537
	WAIT_QOS_MIN_BB,           /* QOS MinTRESPerJob not reached
537
	WAIT_QOS_MIN_BB,           /* QOS MinTRESPerJob not reached
538
				    * (burst buffer) */
538
				    * (burst buffer) */
539
};
539
	/* QOS MaxTRESPerAccount */
540
	WAIT_QOS_MAX_BB_PER_ACCT,     /* exceeded burst buffer */
541
	WAIT_QOS_MAX_CPU_PER_ACCT,    /* exceeded CPUs */
542
	WAIT_QOS_MAX_ENERGY_PER_ACCT, /* exceeded Energy */
543
	WAIT_QOS_MAX_GRES_PER_ACCT,   /* exceeded GRES */
544
	WAIT_QOS_MAX_NODE_PER_ACCT,   /* exceeded Nodes */
545
	WAIT_QOS_MAX_LIC_PER_ACCT,    /* exceeded Licenses */
546
	WAIT_QOS_MAX_MEM_PER_ACCT,    /* exceeded Memory */
547
	WAIT_QOS_MAX_UNK_PER_ACCT,    /* exceeded Unknown */
548
	/********************/
549
	WAIT_QOS_MAX_JOB_PER_ACCT,    /* QOS MaxJobPerAccount exceeded */
550
	WAIT_QOS_MAX_SUB_JOB_PER_ACCT,/* QOS MaxJobSubmitSPerAccount exceeded */
551
 };
540
552
541
enum job_acct_types {
553
enum job_acct_types {
542
	JOB_START,
554
	JOB_START,
(-)a/slurm/slurmdb.h (-2 / +27 lines)
Lines 724-729 typedef struct { Link Here
724
} slurmdb_job_rec_t;
724
} slurmdb_job_rec_t;
725
725
726
typedef struct {
726
typedef struct {
727
	List acct_limit_list; /* slurmdb_used_limits_t's (DON'T PACK
728
			       * for state file) */
727
	List job_list; /* list of job pointers to submitted/running
729
	List job_list; /* list of job pointers to submitted/running
728
			  jobs (DON'T PACK) */
730
			  jobs (DON'T PACK) */
729
	uint32_t grp_used_jobs;	/* count of active jobs (DON'T PACK
731
	uint32_t grp_used_jobs;	/* count of active jobs (DON'T PACK
Lines 781-788 typedef struct { Link Here
781
					   * (DON'T PACK) */
783
					   * (DON'T PACK) */
782
	uint32_t grp_wall; /* total time in hours this qos can run for */
784
	uint32_t grp_wall; /* total time in hours this qos can run for */
783
785
786
	uint32_t max_jobs_pa;	/* max number of jobs an account can
787
				 * run with this qos at one time */
784
	uint32_t max_jobs_pu;	/* max number of jobs a user can
788
	uint32_t max_jobs_pu;	/* max number of jobs a user can
785
				 * run with this qos at one time */
789
				 * run with this qos at one time */
790
	uint32_t max_submit_jobs_pa; /* max number of jobs an account can
791
					submit with this qos at once */
786
	uint32_t max_submit_jobs_pu; /* max number of jobs a user can
792
	uint32_t max_submit_jobs_pu; /* max number of jobs a user can
787
					submit with this qos at once */
793
					submit with this qos at once */
788
	char *max_tres_mins_pj;    /* max number of tres seconds this
794
	char *max_tres_mins_pj;    /* max number of tres seconds this
Lines 791-796 typedef struct { Link Here
791
					  * based off the ordering of the
797
					  * based off the ordering of the
792
					  * total number of TRES in the system
798
					  * total number of TRES in the system
793
					  * (DON'T PACK) */
799
					  * (DON'T PACK) */
800
	char *max_tres_pa;         /* max number of tres this
801
				    * QOS can allocate per account */
802
	uint64_t *max_tres_pa_ctld;   /* max_tres_pa broken out in an array
803
				       * based off the ordering of the
804
				       * total number of TRES in the system
805
				       * (DON'T PACK) */
794
	char *max_tres_pj;         /* max number of tres this
806
	char *max_tres_pj;         /* max number of tres this
795
				    * qos can allocate per job */
807
				    * qos can allocate per job */
796
	uint64_t *max_tres_pj_ctld;   /* max_tres_pj broken out in an array
808
	uint64_t *max_tres_pj_ctld;   /* max_tres_pj broken out in an array
Lines 809-814 typedef struct { Link Here
809
				       * based off the ordering of the
821
				       * based off the ordering of the
810
				       * total number of TRES in the system
822
				       * total number of TRES in the system
811
				       * (DON'T PACK) */
823
				       * (DON'T PACK) */
824
	char *max_tres_run_mins_pa;   /* max number of tres minutes this
825
				       * qos can having running at one
826
				       * time per account, currently
827
				       * this doesn't do anything.
828
				       */
829
	uint64_t *max_tres_run_mins_pa_ctld; /* max_tres_run_mins_pa
830
					      * broken out in an array
831
					      * based off the ordering
832
					      * of the total number of TRES in
833
					      * the system, currently
834
					      * this doesn't do anything.
835
					      * (DON'T PACK) */
812
	char *max_tres_run_mins_pu;   /* max number of tres minutes this
836
	char *max_tres_run_mins_pu;   /* max number of tres minutes this
813
				       * qos can having running at one
837
				       * qos can having running at one
814
				       * time, currently this doesn't
838
				       * time, currently this doesn't
Lines 978-992 typedef struct { Link Here
978
} slurmdb_txn_rec_t;
1002
} slurmdb_txn_rec_t;
979
1003
980
/* Right now this is used in the slurmdb_qos_rec_t structure.  In the
1004
/* Right now this is used in the slurmdb_qos_rec_t structure.  In the
981
 * user_limit_list. */
1005
 * user_limit_list and acct_limit_list. */
982
typedef struct {
1006
typedef struct {
1007
	char *acct; /* If limits for an account this is the accounts name */
983
	uint32_t jobs;	/* count of active jobs */
1008
	uint32_t jobs;	/* count of active jobs */
984
	uint32_t submit_jobs; /* count of jobs pending or running */
1009
	uint32_t submit_jobs; /* count of jobs pending or running */
985
	uint64_t *tres; /* array of TRES allocated */
1010
	uint64_t *tres; /* array of TRES allocated */
986
	uint64_t *tres_run_mins; /* array of how many TRES mins are
1011
	uint64_t *tres_run_mins; /* array of how many TRES mins are
987
				  * allocated currently, currently this doesn't
1012
				  * allocated currently, currently this doesn't
988
				  * do anything and isn't set up. */
1013
				  * do anything and isn't set up. */
989
	uint32_t uid;
1014
	uint32_t uid; /* If limits for a user this is the users uid */
990
} slurmdb_used_limits_t;
1015
} slurmdb_used_limits_t;
991
1016
992
typedef struct {
1017
typedef struct {
(-)a/src/common/assoc_mgr.c (-5 / +66 lines)
Lines 414-434 static int _clear_used_assoc_info(slurmdb_assoc_rec_t *assoc) Link Here
414
	return SLURM_SUCCESS;
414
	return SLURM_SUCCESS;
415
}
415
}
416
416
417
static void _clear_qos_user_limit_info(slurmdb_qos_rec_t *qos_ptr)
417
static void _clear_qos_used_limit_list(List used_limit_list, uint32_t tres_cnt)
418
{
418
{
419
	slurmdb_used_limits_t *used_limits = NULL;
419
	slurmdb_used_limits_t *used_limits = NULL;
420
	ListIterator itr = NULL;
420
	ListIterator itr = NULL;
421
	int i;
421
	int i;
422
422
423
	if (!qos_ptr->usage->user_limit_list
423
	if (!used_limit_list || !list_count(used_limit_list))
424
	    || !list_count(qos_ptr->usage->user_limit_list))
425
		return;
424
		return;
426
425
427
	itr = list_iterator_create(qos_ptr->usage->user_limit_list);
426
	itr = list_iterator_create(used_limit_list);
428
	while ((used_limits = list_next(itr))) {
427
	while ((used_limits = list_next(itr))) {
429
		used_limits->jobs = 0;
428
		used_limits->jobs = 0;
430
		used_limits->submit_jobs = 0;
429
		used_limits->submit_jobs = 0;
431
		for (i=0; i<qos_ptr->usage->tres_cnt; i++) {
430
		for (i=0; i<tres_cnt; i++) {
432
			used_limits->tres[i] = 0;
431
			used_limits->tres[i] = 0;
433
			used_limits->tres_run_mins[i] = 0;
432
			used_limits->tres_run_mins[i] = 0;
434
		}
433
		}
Lines 438-443 static void _clear_qos_user_limit_info(slurmdb_qos_rec_t *qos_ptr) Link Here
438
	return;
437
	return;
439
}
438
}
440
439
440
441
442
static void _clear_qos_acct_limit_info(slurmdb_qos_rec_t *qos_ptr)
443
{
444
	_clear_qos_used_limit_list(qos_ptr->usage->acct_limit_list,
445
				   qos_ptr->usage->tres_cnt);
446
}
447
448
static void _clear_qos_user_limit_info(slurmdb_qos_rec_t *qos_ptr)
449
{
450
	_clear_qos_used_limit_list(qos_ptr->usage->user_limit_list,
451
				   qos_ptr->usage->tres_cnt);
452
}
453
441
static int _clear_used_qos_info(slurmdb_qos_rec_t *qos)
454
static int _clear_used_qos_info(slurmdb_qos_rec_t *qos)
442
{
455
{
443
	int i;
456
	int i;
Lines 456-461 static int _clear_used_qos_info(slurmdb_qos_rec_t *qos) Link Here
456
	 * else where since sometimes we call this and do not want
469
	 * else where since sometimes we call this and do not want
457
	 * shares reset */
470
	 * shares reset */
458
471
472
	_clear_qos_acct_limit_info(qos);
459
	_clear_qos_user_limit_info(qos);
473
	_clear_qos_user_limit_info(qos);
460
474
461
	return SLURM_SUCCESS;
475
	return SLURM_SUCCESS;
Lines 2512-2526 extern int assoc_mgr_fill_in_qos(void *db_conn, slurmdb_qos_rec_t *qos, Link Here
2512
2526
2513
	if (!qos->max_tres_mins_pj)
2527
	if (!qos->max_tres_mins_pj)
2514
		qos->max_tres_mins_pj = found_qos->max_tres_mins_pj;
2528
		qos->max_tres_mins_pj = found_qos->max_tres_mins_pj;
2529
	if (!qos->max_tres_run_mins_pa)
2530
		qos->max_tres_run_mins_pa = found_qos->max_tres_run_mins_pa;
2515
	if (!qos->max_tres_run_mins_pu)
2531
	if (!qos->max_tres_run_mins_pu)
2516
		qos->max_tres_run_mins_pu = found_qos->max_tres_run_mins_pu;
2532
		qos->max_tres_run_mins_pu = found_qos->max_tres_run_mins_pu;
2533
	if (!qos->max_tres_pa)
2534
		qos->max_tres_pa     = found_qos->max_tres_pa;
2517
	if (!qos->max_tres_pj)
2535
	if (!qos->max_tres_pj)
2518
		qos->max_tres_pj     = found_qos->max_tres_pj;
2536
		qos->max_tres_pj     = found_qos->max_tres_pj;
2519
	if (!qos->max_tres_pn)
2537
	if (!qos->max_tres_pn)
2520
		qos->max_tres_pn     = found_qos->max_tres_pn;
2538
		qos->max_tres_pn     = found_qos->max_tres_pn;
2521
	if (!qos->max_tres_pu)
2539
	if (!qos->max_tres_pu)
2522
		qos->max_tres_pu     = found_qos->max_tres_pu;
2540
		qos->max_tres_pu     = found_qos->max_tres_pu;
2541
	qos->max_jobs_pa     = found_qos->max_jobs_pa;
2523
	qos->max_jobs_pu     = found_qos->max_jobs_pu;
2542
	qos->max_jobs_pu     = found_qos->max_jobs_pu;
2543
	qos->max_submit_jobs_pa = found_qos->max_submit_jobs_pa;
2524
	qos->max_submit_jobs_pu = found_qos->max_submit_jobs_pu;
2544
	qos->max_submit_jobs_pu = found_qos->max_submit_jobs_pu;
2525
	qos->max_wall_pj     = found_qos->max_wall_pj;
2545
	qos->max_wall_pj     = found_qos->max_wall_pj;
2526
2546
Lines 2543-2548 extern int assoc_mgr_fill_in_qos(void *db_conn, slurmdb_qos_rec_t *qos, Link Here
2543
	   is really in existance here, if they really want it they can
2563
	   is really in existance here, if they really want it they can
2544
	   use the pointer that is returned. */
2564
	   use the pointer that is returned. */
2545
2565
2566
	/* if (!qos->usage->acct_limit_list) */
2567
	/* 	qos->usage->acct_limit_list = found_qos->usage->acct_limit_list; */
2568
2546
	/* qos->usage->grp_used_tres   = found_qos->usage->grp_used_tres; */
2569
	/* qos->usage->grp_used_tres   = found_qos->usage->grp_used_tres; */
2547
	/* qos->usage->grp_used_tres_run_mins  = */
2570
	/* qos->usage->grp_used_tres_run_mins  = */
2548
	/* 	found_qos->usage->grp_used_tres_run_mins; */
2571
	/* 	found_qos->usage->grp_used_tres_run_mins; */
Lines 4207-4212 extern int assoc_mgr_update_qos(slurmdb_update_object_t *update, bool locked) Link Here
4207
				rec->grp_wall = object->grp_wall;
4230
				rec->grp_wall = object->grp_wall;
4208
			}
4231
			}
4209
4232
4233
			if (object->max_tres_pa) {
4234
				update_jobs = true;
4235
				xfree(rec->max_tres_pa);
4236
				if (object->max_tres_pa[0]) {
4237
					rec->max_tres_pa = object->max_tres_pa;
4238
					object->max_tres_pa = NULL;
4239
				}
4240
				assoc_mgr_set_tres_cnt_array(
4241
					&rec->max_tres_pa_ctld,
4242
					rec->max_tres_pa, INFINITE64, 1);
4243
			}
4244
4210
			if (object->max_tres_pj) {
4245
			if (object->max_tres_pj) {
4211
				update_jobs = true;
4246
				update_jobs = true;
4212
				xfree(rec->max_tres_pj);
4247
				xfree(rec->max_tres_pj);
Lines 4255-4260 extern int assoc_mgr_update_qos(slurmdb_update_object_t *update, bool locked) Link Here
4255
					rec->max_tres_mins_pj, INFINITE64, 1);
4290
					rec->max_tres_mins_pj, INFINITE64, 1);
4256
			}
4291
			}
4257
4292
4293
			if (object->max_tres_run_mins_pa) {
4294
				xfree(rec->max_tres_run_mins_pa);
4295
				if (object->max_tres_run_mins_pa[0]) {
4296
					rec->max_tres_run_mins_pa =
4297
						object->max_tres_run_mins_pa;
4298
					object->max_tres_run_mins_pa = NULL;
4299
				}
4300
				assoc_mgr_set_tres_cnt_array(
4301
					&rec->max_tres_run_mins_pa_ctld,
4302
					rec->max_tres_run_mins_pa,
4303
					INFINITE64, 1);
4304
			}
4305
4258
			if (object->max_tres_run_mins_pu) {
4306
			if (object->max_tres_run_mins_pu) {
4259
				xfree(rec->max_tres_run_mins_pu);
4307
				xfree(rec->max_tres_run_mins_pu);
4260
				if (object->max_tres_run_mins_pu[0]) {
4308
				if (object->max_tres_run_mins_pu[0]) {
Lines 4268-4278 extern int assoc_mgr_update_qos(slurmdb_update_object_t *update, bool locked) Link Here
4268
					INFINITE64, 1);
4316
					INFINITE64, 1);
4269
			}
4317
			}
4270
4318
4319
			if (object->max_jobs_pa != NO_VAL)
4320
				rec->max_jobs_pa = object->max_jobs_pa;
4321
4271
			if (object->max_jobs_pu != NO_VAL)
4322
			if (object->max_jobs_pu != NO_VAL)
4272
				rec->max_jobs_pu = object->max_jobs_pu;
4323
				rec->max_jobs_pu = object->max_jobs_pu;
4324
4325
			if (object->max_submit_jobs_pa != NO_VAL)
4326
				rec->max_submit_jobs_pa =
4327
					object->max_submit_jobs_pa;
4328
4273
			if (object->max_submit_jobs_pu != NO_VAL)
4329
			if (object->max_submit_jobs_pu != NO_VAL)
4274
				rec->max_submit_jobs_pu =
4330
				rec->max_submit_jobs_pu =
4275
					object->max_submit_jobs_pu;
4331
					object->max_submit_jobs_pu;
4332
4276
			if (object->max_wall_pj != NO_VAL) {
4333
			if (object->max_wall_pj != NO_VAL) {
4277
				update_jobs = true;
4334
				update_jobs = true;
4278
				rec->max_wall_pj = object->max_wall_pj;
4335
				rec->max_wall_pj = object->max_wall_pj;
Lines 5883-5888 extern void assoc_mgr_set_qos_tres_cnt(slurmdb_qos_rec_t *qos) Link Here
5883
				     qos->grp_tres_mins, INFINITE64, 1);
5940
				     qos->grp_tres_mins, INFINITE64, 1);
5884
	assoc_mgr_set_tres_cnt_array(&qos->grp_tres_run_mins_ctld,
5941
	assoc_mgr_set_tres_cnt_array(&qos->grp_tres_run_mins_ctld,
5885
				     qos->grp_tres_run_mins, INFINITE64, 1);
5942
				     qos->grp_tres_run_mins, INFINITE64, 1);
5943
	assoc_mgr_set_tres_cnt_array(&qos->max_tres_pa_ctld,
5944
				     qos->max_tres_pa, INFINITE64, 1);
5886
	assoc_mgr_set_tres_cnt_array(&qos->max_tres_pj_ctld,
5945
	assoc_mgr_set_tres_cnt_array(&qos->max_tres_pj_ctld,
5887
				     qos->max_tres_pj, INFINITE64, 1);
5946
				     qos->max_tres_pj, INFINITE64, 1);
5888
	assoc_mgr_set_tres_cnt_array(&qos->max_tres_pn_ctld,
5947
	assoc_mgr_set_tres_cnt_array(&qos->max_tres_pn_ctld,
Lines 5891-5896 extern void assoc_mgr_set_qos_tres_cnt(slurmdb_qos_rec_t *qos) Link Here
5891
				     qos->max_tres_pu, INFINITE64, 1);
5950
				     qos->max_tres_pu, INFINITE64, 1);
5892
	assoc_mgr_set_tres_cnt_array(&qos->max_tres_mins_pj_ctld,
5951
	assoc_mgr_set_tres_cnt_array(&qos->max_tres_mins_pj_ctld,
5893
				     qos->max_tres_mins_pj, INFINITE64, 1);
5952
				     qos->max_tres_mins_pj, INFINITE64, 1);
5953
	assoc_mgr_set_tres_cnt_array(&qos->max_tres_run_mins_pa_ctld,
5954
				     qos->max_tres_run_mins_pa, INFINITE64, 1);
5894
	assoc_mgr_set_tres_cnt_array(&qos->max_tres_run_mins_pu_ctld,
5955
	assoc_mgr_set_tres_cnt_array(&qos->max_tres_run_mins_pu_ctld,
5895
				     qos->max_tres_run_mins_pu, INFINITE64, 1);
5956
				     qos->max_tres_run_mins_pu, INFINITE64, 1);
5896
	assoc_mgr_set_tres_cnt_array(&qos->min_tres_pj_ctld,
5957
	assoc_mgr_set_tres_cnt_array(&qos->min_tres_pj_ctld,
(-)a/src/common/slurm_protocol_common.h (-1 / +2 lines)
Lines 78-88 Link Here
78
 * done here with them since we have to support old version of archive
78
 * done here with them since we have to support old version of archive
79
 * files since they don't update once they are created.
79
 * files since they don't update once they are created.
80
 */
80
 */
81
#define SLURM_16_05_PROTOCOL_VERSION ((30 << 8) | 0)
81
#define SLURM_15_08_PROTOCOL_VERSION ((29 << 8) | 0)
82
#define SLURM_15_08_PROTOCOL_VERSION ((29 << 8) | 0)
82
#define SLURM_14_11_PROTOCOL_VERSION ((28 << 8) | 0)
83
#define SLURM_14_11_PROTOCOL_VERSION ((28 << 8) | 0)
83
#define SLURM_14_03_PROTOCOL_VERSION ((27 << 8) | 0)
84
#define SLURM_14_03_PROTOCOL_VERSION ((27 << 8) | 0)
84
85
85
#define SLURM_PROTOCOL_VERSION SLURM_15_08_PROTOCOL_VERSION
86
#define SLURM_PROTOCOL_VERSION SLURM_16_05_PROTOCOL_VERSION
86
#define SLURM_MIN_PROTOCOL_VERSION SLURM_14_03_PROTOCOL_VERSION
87
#define SLURM_MIN_PROTOCOL_VERSION SLURM_14_03_PROTOCOL_VERSION
87
88
88
#if 0
89
#if 0
(-)a/src/common/slurmdb_defs.c (+16 lines)
Lines 562-567 extern void slurmdb_destroy_qos_usage(void *object) Link Here
562
		(slurmdb_qos_usage_t *)object;
562
		(slurmdb_qos_usage_t *)object;
563
563
564
	if (usage) {
564
	if (usage) {
565
		FREE_NULL_LIST(usage->acct_limit_list);
565
		FREE_NULL_LIST(usage->job_list);
566
		FREE_NULL_LIST(usage->job_list);
566
		FREE_NULL_LIST(usage->user_limit_list);
567
		FREE_NULL_LIST(usage->user_limit_list);
567
		xfree(usage->grp_used_tres_run_secs);
568
		xfree(usage->grp_used_tres_run_secs);
Lines 752-759 extern void slurmdb_free_qos_rec_members(slurmdb_qos_rec_t *qos) Link Here
752
		xfree(qos->grp_tres_run_mins_ctld);
753
		xfree(qos->grp_tres_run_mins_ctld);
753
		xfree(qos->max_tres_mins_pj);
754
		xfree(qos->max_tres_mins_pj);
754
		xfree(qos->max_tres_mins_pj_ctld);
755
		xfree(qos->max_tres_mins_pj_ctld);
756
		xfree(qos->max_tres_run_mins_pa);
757
		xfree(qos->max_tres_run_mins_pa_ctld);
755
		xfree(qos->max_tres_run_mins_pu);
758
		xfree(qos->max_tres_run_mins_pu);
756
		xfree(qos->max_tres_run_mins_pu_ctld);
759
		xfree(qos->max_tres_run_mins_pu_ctld);
760
		xfree(qos->max_tres_pa);
761
		xfree(qos->max_tres_pa_ctld);
757
		xfree(qos->max_tres_pj);
762
		xfree(qos->max_tres_pj);
758
		xfree(qos->max_tres_pj_ctld);
763
		xfree(qos->max_tres_pj_ctld);
759
		xfree(qos->max_tres_pn);
764
		xfree(qos->max_tres_pn);
Lines 1120-1125 extern void slurmdb_destroy_used_limits(void *object) Link Here
1120
		(slurmdb_used_limits_t *)object;
1125
		(slurmdb_used_limits_t *)object;
1121
1126
1122
	if (slurmdb_used_limits) {
1127
	if (slurmdb_used_limits) {
1128
		xfree(slurmdb_used_limits->acct);
1123
		xfree(slurmdb_used_limits->tres);
1129
		xfree(slurmdb_used_limits->tres);
1124
		xfree(slurmdb_used_limits->tres_run_mins);
1130
		xfree(slurmdb_used_limits->tres_run_mins);
1125
		xfree(slurmdb_used_limits);
1131
		xfree(slurmdb_used_limits);
Lines 1356-1365 extern void slurmdb_init_qos_rec(slurmdb_qos_rec_t *qos, bool free_it, Link Here
1356
	qos->grp_wall = init_val;
1362
	qos->grp_wall = init_val;
1357
1363
1358
	/* qos->max_tres_mins_pj = NULL; */
1364
	/* qos->max_tres_mins_pj = NULL; */
1365
	/* qos->max_tres_run_mins_pa = NULL; */
1359
	/* qos->max_tres_run_mins_pu = NULL; */
1366
	/* qos->max_tres_run_mins_pu = NULL; */
1367
	/* qos->max_tres_pa = NULL; */
1360
	/* qos->max_tres_pj = NULL; */
1368
	/* qos->max_tres_pj = NULL; */
1361
	/* qos->max_tres_pu = NULL; */
1369
	/* qos->max_tres_pu = NULL; */
1370
	qos->max_jobs_pa = init_val;
1362
	qos->max_jobs_pu = init_val;
1371
	qos->max_jobs_pu = init_val;
1372
	qos->max_submit_jobs_pa = init_val;
1363
	qos->max_submit_jobs_pu = init_val;
1373
	qos->max_submit_jobs_pu = init_val;
1364
	qos->max_wall_pj = init_val;
1374
	qos->max_wall_pj = init_val;
1365
1375
Lines 2805-2820 extern void slurmdb_copy_qos_rec_limits(slurmdb_qos_rec_t *out, Link Here
2805
	out->grp_tres_run_mins = xstrdup(in->grp_tres_run_mins);
2815
	out->grp_tres_run_mins = xstrdup(in->grp_tres_run_mins);
2806
	out->grp_wall = in->grp_wall;
2816
	out->grp_wall = in->grp_wall;
2807
2817
2818
	out->max_jobs_pa = in->max_jobs_pa;
2808
	out->max_jobs_pu = in->max_jobs_pu;
2819
	out->max_jobs_pu = in->max_jobs_pu;
2820
	out->max_submit_jobs_pa = in->max_submit_jobs_pa;
2809
	out->max_submit_jobs_pu = in->max_submit_jobs_pu;
2821
	out->max_submit_jobs_pu = in->max_submit_jobs_pu;
2810
	xfree(out->max_tres_mins_pj);
2822
	xfree(out->max_tres_mins_pj);
2811
	out->max_tres_mins_pj =	xstrdup(in->max_tres_mins_pj);
2823
	out->max_tres_mins_pj =	xstrdup(in->max_tres_mins_pj);
2824
	xfree(out->max_tres_pa);
2825
	out->max_tres_pa = xstrdup(in->max_tres_pa);
2812
	xfree(out->max_tres_pj);
2826
	xfree(out->max_tres_pj);
2813
	out->max_tres_pj = xstrdup(in->max_tres_pj);
2827
	out->max_tres_pj = xstrdup(in->max_tres_pj);
2814
	xfree(out->max_tres_pn);
2828
	xfree(out->max_tres_pn);
2815
	out->max_tres_pn = xstrdup(in->max_tres_pn);
2829
	out->max_tres_pn = xstrdup(in->max_tres_pn);
2816
	xfree(out->max_tres_pu);
2830
	xfree(out->max_tres_pu);
2817
	out->max_tres_pu = xstrdup(in->max_tres_pu);
2831
	out->max_tres_pu = xstrdup(in->max_tres_pu);
2832
	xfree(out->max_tres_run_mins_pa);
2833
	out->max_tres_run_mins_pa = xstrdup(in->max_tres_run_mins_pa);
2818
	xfree(out->max_tres_run_mins_pu);
2834
	xfree(out->max_tres_run_mins_pu);
2819
	out->max_tres_run_mins_pu = xstrdup(in->max_tres_run_mins_pu);
2835
	out->max_tres_run_mins_pu = xstrdup(in->max_tres_run_mins_pu);
2820
	out->max_wall_pj = in->max_wall_pj;
2836
	out->max_wall_pj = in->max_wall_pj;
(-)a/src/common/slurmdb_pack.c (-102 / +451 lines)
Lines 288-307 extern void slurmdb_pack_used_limits(void *in, uint32_t tres_cnt, Link Here
288
{
288
{
289
	slurmdb_used_limits_t *object = (slurmdb_used_limits_t *)in;
289
	slurmdb_used_limits_t *object = (slurmdb_used_limits_t *)in;
290
290
291
	if (!object) {
291
	if (rpc_version >= SLURM_16_05_PROTOCOL_VERSION) {
292
		pack32(0, buffer);
292
		if (!object) {
293
		pack32(0, buffer);
293
			packnull(buffer);
294
		pack64_array(NULL, 0, buffer);
294
			pack32(0, buffer);
295
		pack64_array(NULL, 0, buffer);
295
			pack32(0, buffer);
296
		pack32(0, buffer);
296
			pack64_array(NULL, 0, buffer);
297
		return;
297
			pack64_array(NULL, 0, buffer);
298
	}
298
			pack32(0, buffer);
299
			return;
300
		}
301
302
		packstr(object->acct, buffer);
303
		pack32(object->jobs, buffer);
304
		pack32(object->submit_jobs, buffer);
305
		pack64_array(object->tres, tres_cnt, buffer);
306
		pack64_array(object->tres_run_mins, tres_cnt, buffer);
307
		pack32(object->uid, buffer);
308
	} else if (rpc_version >= SLURM_15_08_PROTOCOL_VERSION) {
309
		if (!object) {
310
			pack32(0, buffer);
311
			pack32(0, buffer);
312
			pack64_array(NULL, 0, buffer);
313
			pack64_array(NULL, 0, buffer);
314
			pack32(0, buffer);
315
			return;
316
		}
299
317
300
	pack32(object->jobs, buffer);
318
		pack32(object->jobs, buffer);
301
	pack32(object->submit_jobs, buffer);
319
		pack32(object->submit_jobs, buffer);
302
	pack64_array(object->tres, tres_cnt, buffer);
320
		pack64_array(object->tres, tres_cnt, buffer);
303
	pack64_array(object->tres_run_mins, tres_cnt, buffer);
321
		pack64_array(object->tres_run_mins, tres_cnt, buffer);
304
	pack32(object->uid, buffer);
322
		pack32(object->uid, buffer);
323
	}
305
}
324
}
306
325
307
extern int slurmdb_unpack_used_limits(void **object, uint32_t tres_cnt,
326
extern int slurmdb_unpack_used_limits(void **object, uint32_t tres_cnt,
Lines 313-328 extern int slurmdb_unpack_used_limits(void **object, uint32_t tres_cnt, Link Here
313
332
314
	*object = (void *)object_ptr;
333
	*object = (void *)object_ptr;
315
334
316
	safe_unpack32(&object_ptr->jobs, buffer);
335
	if (rpc_version >= SLURM_16_05_PROTOCOL_VERSION) {
317
	safe_unpack32(&object_ptr->submit_jobs, buffer);
336
		safe_unpackstr_xmalloc(&object_ptr->acct, &tmp32, buffer);
318
	safe_unpack64_array(&object_ptr->tres, &tmp32, buffer);
337
		safe_unpack32(&object_ptr->jobs, buffer);
319
	if (tmp32 != tres_cnt)
338
		safe_unpack32(&object_ptr->submit_jobs, buffer);
320
		goto unpack_error;
339
		safe_unpack64_array(&object_ptr->tres, &tmp32, buffer);
321
	safe_unpack64_array(&object_ptr->tres_run_mins, &tmp32, buffer);
340
		if (tmp32 != tres_cnt)
322
	if (tmp32 != tres_cnt)
341
			goto unpack_error;
323
		goto unpack_error;
342
		safe_unpack64_array(&object_ptr->tres_run_mins, &tmp32, buffer);
343
		if (tmp32 != tres_cnt)
344
			goto unpack_error;
345
346
		safe_unpack32(&object_ptr->uid, buffer);
347
	} else if (rpc_version >= SLURM_15_08_PROTOCOL_VERSION) {
348
		safe_unpack32(&object_ptr->jobs, buffer);
349
		safe_unpack32(&object_ptr->submit_jobs, buffer);
350
		safe_unpack64_array(&object_ptr->tres, &tmp32, buffer);
351
		if (tmp32 != tres_cnt)
352
			goto unpack_error;
353
		safe_unpack64_array(&object_ptr->tres_run_mins, &tmp32, buffer);
354
		if (tmp32 != tres_cnt)
355
			goto unpack_error;
324
356
325
	safe_unpack32(&object_ptr->uid, buffer);
357
		safe_unpack32(&object_ptr->uid, buffer);
358
	} else {
359
		error("%s: too old of a version %u", __func__, rpc_version);
360
		goto unpack_error;
361
	}
326
362
327
	return SLURM_SUCCESS;
363
	return SLURM_SUCCESS;
328
364
Lines 1645-1651 extern void slurmdb_pack_qos_rec(void *in, uint16_t rpc_version, Buf buffer) Link Here
1645
	char *tmp_info = NULL;
1681
	char *tmp_info = NULL;
1646
	uint64_t uint64_tmp;
1682
	uint64_t uint64_tmp;
1647
1683
1648
	if (rpc_version >= SLURM_15_08_PROTOCOL_VERSION) {
1684
	if (rpc_version >= SLURM_16_05_PROTOCOL_VERSION) {
1685
		if (!object) {
1686
			packnull(buffer);
1687
			pack32(0, buffer);
1688
1689
			pack32(QOS_FLAG_NOTSET, buffer);
1690
1691
			pack32(NO_VAL, buffer);
1692
			packnull(buffer);
1693
			packnull(buffer);
1694
			packnull(buffer);
1695
			pack32(NO_VAL, buffer);
1696
			pack32(NO_VAL, buffer);
1697
			pack32(NO_VAL, buffer);
1698
1699
			packnull(buffer);
1700
			packnull(buffer);
1701
			packnull(buffer);
1702
			packnull(buffer);
1703
			packnull(buffer);
1704
			packnull(buffer);
1705
			packnull(buffer);
1706
			pack32(NO_VAL, buffer);
1707
			pack32(NO_VAL, buffer);
1708
			pack32(NO_VAL, buffer);
1709
			pack32(NO_VAL, buffer);
1710
			pack32(NO_VAL, buffer);
1711
			packnull(buffer);
1712
1713
			packnull(buffer);
1714
1715
			pack_bit_str_hex(NULL, buffer);
1716
			pack32(NO_VAL, buffer);
1717
1718
			pack16(0, buffer);
1719
			pack32(0, buffer);
1720
1721
			packdouble(NO_VAL64, buffer);
1722
			packdouble(NO_VAL64, buffer);
1723
			return;
1724
		}
1725
		packstr(object->description, buffer);
1726
		pack32(object->id, buffer);
1727
1728
		pack32(object->flags, buffer);
1729
1730
		pack32(object->grace_time, buffer);
1731
		packstr(object->grp_tres_mins, buffer);
1732
		packstr(object->grp_tres_run_mins, buffer);
1733
		packstr(object->grp_tres, buffer);
1734
		pack32(object->grp_jobs, buffer);
1735
		pack32(object->grp_submit_jobs, buffer);
1736
		pack32(object->grp_wall, buffer);
1737
1738
		packstr(object->max_tres_mins_pj, buffer);
1739
		packstr(object->max_tres_run_mins_pa, buffer);
1740
		packstr(object->max_tres_run_mins_pu, buffer);
1741
		packstr(object->max_tres_pa, buffer);
1742
		packstr(object->max_tres_pj, buffer);
1743
		packstr(object->max_tres_pn, buffer);
1744
		packstr(object->max_tres_pu, buffer);
1745
		pack32(object->max_jobs_pa, buffer);
1746
		pack32(object->max_jobs_pu, buffer);
1747
		pack32(object->max_submit_jobs_pa, buffer);
1748
		pack32(object->max_submit_jobs_pu, buffer);
1749
		pack32(object->max_wall_pj, buffer);
1750
		packstr(object->min_tres_pj, buffer);
1751
1752
		packstr(object->name, buffer);
1753
1754
		pack_bit_str_hex(object->preempt_bitstr, buffer);
1755
1756
		if (object->preempt_list)
1757
			count = list_count(object->preempt_list);
1758
1759
		pack32(count, buffer);
1760
1761
		if (count && count != NO_VAL) {
1762
			itr = list_iterator_create(object->preempt_list);
1763
			while ((tmp_info = list_next(itr))) {
1764
				packstr(tmp_info, buffer);
1765
			}
1766
			list_iterator_destroy(itr);
1767
		}
1768
1769
		pack16(object->preempt_mode, buffer);
1770
		pack32(object->priority, buffer);
1771
1772
		packdouble(object->usage_factor, buffer);
1773
		packdouble(object->usage_thres, buffer);
1774
	} else if (rpc_version >= SLURM_15_08_PROTOCOL_VERSION) {
1649
		if (!object) {
1775
		if (!object) {
1650
			packnull(buffer);
1776
			packnull(buffer);
1651
			pack32(0, buffer);
1777
			pack32(0, buffer);
Lines 1980-1986 extern int slurmdb_unpack_qos_rec(void **object, uint16_t rpc_version, Link Here
1980
2106
1981
	slurmdb_init_qos_rec(object_ptr, 0, NO_VAL);
2107
	slurmdb_init_qos_rec(object_ptr, 0, NO_VAL);
1982
2108
1983
	if (rpc_version >= SLURM_15_08_PROTOCOL_VERSION) {
2109
	if (rpc_version >= SLURM_16_05_PROTOCOL_VERSION) {
2110
		safe_unpackstr_xmalloc(&object_ptr->description,
2111
				       &uint32_tmp, buffer);
2112
		safe_unpack32(&object_ptr->id, buffer);
2113
2114
		safe_unpack32(&object_ptr->flags, buffer);
2115
2116
		safe_unpack32(&object_ptr->grace_time, buffer);
2117
		safe_unpackstr_xmalloc(&object_ptr->grp_tres_mins,
2118
				       &uint32_tmp, buffer);
2119
		safe_unpackstr_xmalloc(&object_ptr->grp_tres_run_mins,
2120
				       &uint32_tmp, buffer);
2121
		safe_unpackstr_xmalloc(&object_ptr->grp_tres,
2122
				       &uint32_tmp, buffer);
2123
		safe_unpack32(&object_ptr->grp_jobs, buffer);
2124
		safe_unpack32(&object_ptr->grp_submit_jobs, buffer);
2125
		safe_unpack32(&object_ptr->grp_wall, buffer);
2126
2127
		safe_unpackstr_xmalloc(&object_ptr->max_tres_mins_pj,
2128
				       &uint32_tmp, buffer);
2129
		safe_unpackstr_xmalloc(&object_ptr->max_tres_run_mins_pa,
2130
				       &uint32_tmp, buffer);
2131
		safe_unpackstr_xmalloc(&object_ptr->max_tres_run_mins_pu,
2132
				       &uint32_tmp, buffer);
2133
		safe_unpackstr_xmalloc(&object_ptr->max_tres_pa,
2134
				       &uint32_tmp, buffer);
2135
		safe_unpackstr_xmalloc(&object_ptr->max_tres_pj,
2136
				       &uint32_tmp, buffer);
2137
		safe_unpackstr_xmalloc(&object_ptr->max_tres_pn,
2138
				       &uint32_tmp, buffer);
2139
		safe_unpackstr_xmalloc(&object_ptr->max_tres_pu,
2140
				       &uint32_tmp, buffer);
2141
		safe_unpack32(&object_ptr->max_jobs_pa, buffer);
2142
		safe_unpack32(&object_ptr->max_jobs_pu, buffer);
2143
		safe_unpack32(&object_ptr->max_submit_jobs_pa, buffer);
2144
		safe_unpack32(&object_ptr->max_submit_jobs_pu, buffer);
2145
		safe_unpack32(&object_ptr->max_wall_pj, buffer);
2146
		safe_unpackstr_xmalloc(&object_ptr->min_tres_pj,
2147
				       &uint32_tmp, buffer);
2148
2149
		safe_unpackstr_xmalloc(&object_ptr->name, &uint32_tmp, buffer);
2150
2151
		unpack_bit_str_hex(&object_ptr->preempt_bitstr, buffer);
2152
2153
		safe_unpack32(&count, buffer);
2154
		if (count != NO_VAL) {
2155
			object_ptr->preempt_list =
2156
				list_create(slurm_destroy_char);
2157
			for (i = 0; i < count; i++) {
2158
				safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp,
2159
						       buffer);
2160
				list_append(object_ptr->preempt_list,
2161
					    tmp_info);
2162
			}
2163
		}
2164
2165
		safe_unpack16(&object_ptr->preempt_mode, buffer);
2166
		safe_unpack32(&object_ptr->priority, buffer);
2167
2168
		safe_unpackdouble(&object_ptr->usage_factor, buffer);
2169
		safe_unpackdouble(&object_ptr->usage_thres, buffer);
2170
	} else if (rpc_version >= SLURM_15_08_PROTOCOL_VERSION) {
1984
		safe_unpackstr_xmalloc(&object_ptr->description,
2171
		safe_unpackstr_xmalloc(&object_ptr->description,
1985
				       &uint32_tmp, buffer);
2172
				       &uint32_tmp, buffer);
1986
		safe_unpack32(&object_ptr->id, buffer);
2173
		safe_unpack32(&object_ptr->id, buffer);
Lines 2332-2358 extern void slurmdb_pack_qos_usage(void *in, uint16_t rpc_version, Buf buffer) Link Here
2332
	ListIterator itr;
2519
	ListIterator itr;
2333
	void *used_limits;
2520
	void *used_limits;
2334
2521
2335
	pack32(usage->grp_used_jobs, buffer);
2522
	if (rpc_version >= SLURM_16_05_PROTOCOL_VERSION) {
2336
	pack32(usage->grp_used_submit_jobs, buffer);
2523
		pack32(usage->grp_used_jobs, buffer);
2337
	pack64_array(usage->grp_used_tres, usage->tres_cnt, buffer);
2524
		pack32(usage->grp_used_submit_jobs, buffer);
2338
	pack64_array(usage->grp_used_tres_run_secs, usage->tres_cnt, buffer);
2525
		pack64_array(usage->grp_used_tres, usage->tres_cnt, buffer);
2339
	packdouble(usage->grp_used_wall, buffer);
2526
		pack64_array(usage->grp_used_tres_run_secs,
2340
	packdouble(usage->norm_priority, buffer);
2527
			     usage->tres_cnt, buffer);
2341
	packlongdouble(usage->usage_raw, buffer);
2528
		packdouble(usage->grp_used_wall, buffer);
2342
	packlongdouble_array(usage->usage_tres_raw, usage->tres_cnt, buffer);
2529
		packdouble(usage->norm_priority, buffer);
2530
		packlongdouble(usage->usage_raw, buffer);
2531
		packlongdouble_array(usage->usage_tres_raw,
2532
				     usage->tres_cnt, buffer);
2533
2534
		if (!usage->user_limit_list ||
2535
		    !(count = list_count(usage->user_limit_list)))
2536
			count = NO_VAL;
2343
2537
2344
	if (!usage->user_limit_list ||
2538
		/* We have to pack anything that is verified by
2345
	    !(count = list_count(usage->user_limit_list)))
2539
		 * tres_cnt after this.  It is used in the unpack,
2346
		count = NO_VAL;
2540
		 * that is the reason it isn't alpha.
2541
		 */
2542
		pack32(count, buffer);
2543
		if (count != NO_VAL) {
2544
			itr = list_iterator_create(usage->user_limit_list);
2545
			while ((used_limits = list_next(itr)))
2546
				slurmdb_pack_used_limits(
2547
					used_limits, usage->tres_cnt,
2548
					rpc_version, buffer);
2549
			list_iterator_destroy(itr);
2550
		}
2551
		if (!usage->acct_limit_list ||
2552
		    !(count = list_count(usage->acct_limit_list)))
2553
			count = NO_VAL;
2347
2554
2348
	pack32(count, buffer);
2555
		pack32(count, buffer);
2349
	if (count != NO_VAL) {
2556
		if (count != NO_VAL) {
2350
		itr = list_iterator_create(usage->user_limit_list);
2557
			itr = list_iterator_create(usage->acct_limit_list);
2351
		while ((used_limits = list_next(itr)))
2558
			while ((used_limits = list_next(itr)))
2352
			slurmdb_pack_used_limits(used_limits, usage->tres_cnt,
2559
				slurmdb_pack_used_limits(
2353
						 rpc_version, buffer);
2560
					used_limits, usage->tres_cnt,
2354
		list_iterator_destroy(itr);
2561
					rpc_version, buffer);
2562
			list_iterator_destroy(itr);
2563
		}
2564
	} else if (rpc_version >= SLURM_15_08_PROTOCOL_VERSION) {
2565
		pack32(usage->grp_used_jobs, buffer);
2566
		pack32(usage->grp_used_submit_jobs, buffer);
2567
		pack64_array(usage->grp_used_tres, usage->tres_cnt, buffer);
2568
		pack64_array(usage->grp_used_tres_run_secs,
2569
			     usage->tres_cnt, buffer);
2570
		packdouble(usage->grp_used_wall, buffer);
2571
		packdouble(usage->norm_priority, buffer);
2572
		packlongdouble(usage->usage_raw, buffer);
2573
		packlongdouble_array(usage->usage_tres_raw,
2574
				     usage->tres_cnt, buffer);
2575
2576
		if (!usage->user_limit_list ||
2577
		    !(count = list_count(usage->user_limit_list)))
2578
			count = NO_VAL;
2579
2580
		pack32(count, buffer);
2581
		if (count != NO_VAL) {
2582
			itr = list_iterator_create(usage->user_limit_list);
2583
			while ((used_limits = list_next(itr)))
2584
				slurmdb_pack_used_limits(
2585
					used_limits, usage->tres_cnt,
2586
					rpc_version, buffer);
2587
			list_iterator_destroy(itr);
2588
		}
2589
	} else {
2590
		error("%s: version too old %u", __func__, rpc_version);
2591
		return;
2355
	}
2592
	}
2593
2356
}
2594
}
2357
2595
2358
extern int slurmdb_unpack_qos_usage(void **object, uint16_t rpc_version,
2596
extern int slurmdb_unpack_qos_usage(void **object, uint16_t rpc_version,
Lines 2366-2395 extern int slurmdb_unpack_qos_usage(void **object, uint16_t rpc_version, Link Here
2366
2604
2367
	*object = object_ptr;
2605
	*object = object_ptr;
2368
2606
2369
	safe_unpack32(&object_ptr->grp_used_jobs, buffer);
2607
	if (rpc_version >= SLURM_16_05_PROTOCOL_VERSION) {
2370
	safe_unpack32(&object_ptr->grp_used_submit_jobs, buffer);
2608
		safe_unpack32(&object_ptr->grp_used_jobs, buffer);
2371
	safe_unpack64_array(&object_ptr->grp_used_tres,
2609
		safe_unpack32(&object_ptr->grp_used_submit_jobs, buffer);
2372
			    &object_ptr->tres_cnt, buffer);
2610
		safe_unpack64_array(&object_ptr->grp_used_tres,
2373
	safe_unpack64_array(&object_ptr->grp_used_tres_run_secs,
2611
				    &object_ptr->tres_cnt, buffer);
2374
			    &object_ptr->tres_cnt, buffer);
2612
		safe_unpack64_array(&object_ptr->grp_used_tres_run_secs,
2375
	safe_unpackdouble(&object_ptr->grp_used_wall, buffer);
2613
				    &object_ptr->tres_cnt, buffer);
2376
	safe_unpackdouble(&object_ptr->norm_priority, buffer);
2614
		safe_unpackdouble(&object_ptr->grp_used_wall, buffer);
2377
	safe_unpacklongdouble(&object_ptr->usage_raw, buffer);
2615
		safe_unpackdouble(&object_ptr->norm_priority, buffer);
2378
	safe_unpacklongdouble_array(&object_ptr->usage_tres_raw,
2616
		safe_unpacklongdouble(&object_ptr->usage_raw, buffer);
2379
				    &count, buffer);
2617
		safe_unpacklongdouble_array(&object_ptr->usage_tres_raw,
2618
					    &count, buffer);
2380
2619
2381
	safe_unpack32(&count, buffer);
2620
		safe_unpack32(&count, buffer);
2382
	if (count != NO_VAL) {
2621
		if (count != NO_VAL) {
2383
		object_ptr->user_limit_list =
2622
			object_ptr->user_limit_list =
2384
			list_create(slurmdb_destroy_used_limits);
2623
				list_create(slurmdb_destroy_used_limits);
2385
		for (i = 0; i < count; i++) {
2624
			for (i = 0; i < count; i++) {
2386
			if (slurmdb_unpack_used_limits(&used_limits,
2625
				if (slurmdb_unpack_used_limits(
2387
						       object_ptr->tres_cnt,
2626
					    &used_limits,
2388
						       rpc_version, buffer)
2627
					    object_ptr->tres_cnt,
2389
			    != SLURM_SUCCESS)
2628
					    rpc_version, buffer)
2390
				goto unpack_error;
2629
				    != SLURM_SUCCESS)
2391
			list_append(object_ptr->user_limit_list, used_limits);
2630
					goto unpack_error;
2631
				list_append(object_ptr->user_limit_list,
2632
					    used_limits);
2633
			}
2634
		}
2635
2636
		safe_unpack32(&count, buffer);
2637
		if (count != NO_VAL) {
2638
			object_ptr->acct_limit_list =
2639
				list_create(slurmdb_destroy_used_limits);
2640
			for (i = 0; i < count; i++) {
2641
				if (slurmdb_unpack_used_limits(
2642
					    &used_limits,
2643
					    object_ptr->tres_cnt,
2644
					    rpc_version, buffer)
2645
				    != SLURM_SUCCESS)
2646
					goto unpack_error;
2647
				list_append(object_ptr->acct_limit_list,
2648
					    used_limits);
2649
			}
2650
		}
2651
	} else if (rpc_version >= SLURM_15_08_PROTOCOL_VERSION) {
2652
		safe_unpack32(&object_ptr->grp_used_jobs, buffer);
2653
		safe_unpack32(&object_ptr->grp_used_submit_jobs, buffer);
2654
		safe_unpack64_array(&object_ptr->grp_used_tres,
2655
				    &object_ptr->tres_cnt, buffer);
2656
		safe_unpack64_array(&object_ptr->grp_used_tres_run_secs,
2657
				    &object_ptr->tres_cnt, buffer);
2658
		safe_unpackdouble(&object_ptr->grp_used_wall, buffer);
2659
		safe_unpackdouble(&object_ptr->norm_priority, buffer);
2660
		safe_unpacklongdouble(&object_ptr->usage_raw, buffer);
2661
		safe_unpacklongdouble_array(&object_ptr->usage_tres_raw,
2662
					    &count, buffer);
2663
2664
		safe_unpack32(&count, buffer);
2665
		if (count != NO_VAL) {
2666
			object_ptr->user_limit_list =
2667
				list_create(slurmdb_destroy_used_limits);
2668
			for (i = 0; i < count; i++) {
2669
				if (slurmdb_unpack_used_limits(
2670
					    &used_limits,
2671
					    object_ptr->tres_cnt,
2672
					    rpc_version, buffer)
2673
				    != SLURM_SUCCESS)
2674
					goto unpack_error;
2675
				list_append(object_ptr->user_limit_list,
2676
					    used_limits);
2677
			}
2392
		}
2678
		}
2679
	} else {
2680
		error("%s: version too old %u", __func__, rpc_version);
2681
		goto unpack_error;
2393
	}
2682
	}
2394
2683
2395
	return SLURM_SUCCESS;
2684
	return SLURM_SUCCESS;
Lines 2408-2435 extern void slurmdb_pack_qos_rec_with_usage(void *in, uint16_t rpc_version, Link Here
2408
2697
2409
	slurmdb_pack_qos_rec(in, rpc_version, buffer);
2698
	slurmdb_pack_qos_rec(in, rpc_version, buffer);
2410
2699
2411
	pack64_array(object->grp_tres_mins_ctld,
2700
	if (rpc_version >= SLURM_16_05_PROTOCOL_VERSION) {
2412
		     object->usage->tres_cnt, buffer);
2701
		pack64_array(object->grp_tres_mins_ctld,
2413
	pack64_array(object->grp_tres_run_mins_ctld,
2702
			     object->usage->tres_cnt, buffer);
2414
		     object->usage->tres_cnt, buffer);
2703
		pack64_array(object->grp_tres_run_mins_ctld,
2415
	pack64_array(object->grp_tres_ctld,
2704
			     object->usage->tres_cnt, buffer);
2416
		     object->usage->tres_cnt, buffer);
2705
		pack64_array(object->grp_tres_ctld,
2417
2706
			     object->usage->tres_cnt, buffer);
2418
	pack64_array(object->max_tres_mins_pj_ctld,
2707
2419
		     object->usage->tres_cnt, buffer);
2708
		pack64_array(object->max_tres_mins_pj_ctld,
2420
	pack64_array(object->max_tres_run_mins_pu_ctld,
2709
			     object->usage->tres_cnt, buffer);
2421
		     object->usage->tres_cnt, buffer);
2710
		pack64_array(object->max_tres_run_mins_pa_ctld,
2422
	pack64_array(object->max_tres_pj_ctld,
2711
			     object->usage->tres_cnt, buffer);
2423
		     object->usage->tres_cnt, buffer);
2712
		pack64_array(object->max_tres_run_mins_pu_ctld,
2424
	pack64_array(object->max_tres_pn_ctld,
2713
			     object->usage->tres_cnt, buffer);
2425
		     object->usage->tres_cnt, buffer);
2714
		pack64_array(object->max_tres_pa_ctld,
2426
	pack64_array(object->max_tres_pu_ctld,
2715
			     object->usage->tres_cnt, buffer);
2427
		     object->usage->tres_cnt, buffer);
2716
		pack64_array(object->max_tres_pj_ctld,
2428
	pack64_array(object->min_tres_pj_ctld,
2717
			     object->usage->tres_cnt, buffer);
2429
		     object->usage->tres_cnt, buffer);
2718
		pack64_array(object->max_tres_pn_ctld,
2719
			     object->usage->tres_cnt, buffer);
2720
		pack64_array(object->max_tres_pu_ctld,
2721
			     object->usage->tres_cnt, buffer);
2722
		pack64_array(object->min_tres_pj_ctld,
2723
			     object->usage->tres_cnt, buffer);
2724
	} else if (rpc_version >= SLURM_15_08_PROTOCOL_VERSION) {
2725
		pack64_array(object->grp_tres_mins_ctld,
2726
			     object->usage->tres_cnt, buffer);
2727
		pack64_array(object->grp_tres_run_mins_ctld,
2728
			     object->usage->tres_cnt, buffer);
2729
		pack64_array(object->grp_tres_ctld,
2730
			     object->usage->tres_cnt, buffer);
2731
2732
		pack64_array(object->max_tres_mins_pj_ctld,
2733
			     object->usage->tres_cnt, buffer);
2734
		pack64_array(object->max_tres_run_mins_pu_ctld,
2735
			     object->usage->tres_cnt, buffer);
2736
		pack64_array(object->max_tres_pj_ctld,
2737
			     object->usage->tres_cnt, buffer);
2738
		pack64_array(object->max_tres_pn_ctld,
2739
			     object->usage->tres_cnt, buffer);
2740
		pack64_array(object->max_tres_pu_ctld,
2741
			     object->usage->tres_cnt, buffer);
2742
		pack64_array(object->min_tres_pj_ctld,
2743
			     object->usage->tres_cnt, buffer);
2744
2745
	} else {
2746
		error("%s: version too old %u", __func__, rpc_version);
2747
		return;
2748
	}
2430
2749
2431
	slurmdb_pack_qos_usage(object->usage,
2750
	slurmdb_pack_qos_usage(object->usage,
2432
			       rpc_version, buffer);
2751
			       rpc_version, buffer);
2752
2433
}
2753
}
2434
2754
2435
extern int slurmdb_unpack_qos_rec_with_usage(void **object,
2755
extern int slurmdb_unpack_qos_rec_with_usage(void **object,
Lines 2446-2470 extern int slurmdb_unpack_qos_rec_with_usage(void **object, Link Here
2446
2766
2447
	object_ptr = *object;
2767
	object_ptr = *object;
2448
2768
2449
	safe_unpack64_array(&object_ptr->grp_tres_mins_ctld,
2769
	if (rpc_version >= SLURM_16_05_PROTOCOL_VERSION) {
2450
			    &uint32_tmp, buffer);
2770
		safe_unpack64_array(&object_ptr->grp_tres_mins_ctld,
2451
	safe_unpack64_array(&object_ptr->grp_tres_run_mins_ctld,
2771
				    &uint32_tmp, buffer);
2452
			    &uint32_tmp, buffer);
2772
		safe_unpack64_array(&object_ptr->grp_tres_run_mins_ctld,
2453
	safe_unpack64_array(&object_ptr->grp_tres_ctld,
2773
				    &uint32_tmp, buffer);
2454
			    &uint32_tmp, buffer);
2774
		safe_unpack64_array(&object_ptr->grp_tres_ctld,
2455
2775
				    &uint32_tmp, buffer);
2456
	safe_unpack64_array(&object_ptr->max_tres_mins_pj_ctld,
2776
2457
			    &uint32_tmp, buffer);
2777
		safe_unpack64_array(&object_ptr->max_tres_mins_pj_ctld,
2458
	safe_unpack64_array(&object_ptr->max_tres_run_mins_pu_ctld,
2778
				    &uint32_tmp, buffer);
2459
			    &uint32_tmp, buffer);
2779
		safe_unpack64_array(&object_ptr->max_tres_run_mins_pa_ctld,
2460
	safe_unpack64_array(&object_ptr->max_tres_pj_ctld,
2780
				    &uint32_tmp, buffer);
2461
			    &uint32_tmp, buffer);
2781
		safe_unpack64_array(&object_ptr->max_tres_run_mins_pu_ctld,
2462
	safe_unpack64_array(&object_ptr->max_tres_pn_ctld,
2782
				    &uint32_tmp, buffer);
2463
			    &uint32_tmp, buffer);
2783
		safe_unpack64_array(&object_ptr->max_tres_pa_ctld,
2464
	safe_unpack64_array(&object_ptr->max_tres_pu_ctld,
2784
				    &uint32_tmp, buffer);
2465
			    &uint32_tmp, buffer);
2785
		safe_unpack64_array(&object_ptr->max_tres_pj_ctld,
2466
	safe_unpack64_array(&object_ptr->min_tres_pj_ctld,
2786
				    &uint32_tmp, buffer);
2467
			    &uint32_tmp, buffer);
2787
		safe_unpack64_array(&object_ptr->max_tres_pn_ctld,
2788
				    &uint32_tmp, buffer);
2789
		safe_unpack64_array(&object_ptr->max_tres_pu_ctld,
2790
				    &uint32_tmp, buffer);
2791
		safe_unpack64_array(&object_ptr->min_tres_pj_ctld,
2792
				    &uint32_tmp, buffer);
2793
	} else if (rpc_version >= SLURM_15_08_PROTOCOL_VERSION) {
2794
		safe_unpack64_array(&object_ptr->grp_tres_mins_ctld,
2795
				    &uint32_tmp, buffer);
2796
		safe_unpack64_array(&object_ptr->grp_tres_run_mins_ctld,
2797
				    &uint32_tmp, buffer);
2798
		safe_unpack64_array(&object_ptr->grp_tres_ctld,
2799
				    &uint32_tmp, buffer);
2800
2801
		safe_unpack64_array(&object_ptr->max_tres_mins_pj_ctld,
2802
				    &uint32_tmp, buffer);
2803
		safe_unpack64_array(&object_ptr->max_tres_run_mins_pu_ctld,
2804
				    &uint32_tmp, buffer);
2805
		safe_unpack64_array(&object_ptr->max_tres_pj_ctld,
2806
				    &uint32_tmp, buffer);
2807
		safe_unpack64_array(&object_ptr->max_tres_pn_ctld,
2808
				    &uint32_tmp, buffer);
2809
		safe_unpack64_array(&object_ptr->max_tres_pu_ctld,
2810
				    &uint32_tmp, buffer);
2811
		safe_unpack64_array(&object_ptr->min_tres_pj_ctld,
2812
				    &uint32_tmp, buffer);
2813
	} else {
2814
		error("%s: version too old %u", __func__, rpc_version);
2815
		goto unpack_error;
2816
	}
2468
2817
2469
	rc = slurmdb_unpack_qos_usage((void **)&object_ptr->usage,
2818
	rc = slurmdb_unpack_qos_usage((void **)&object_ptr->usage,
2470
				      rpc_version, buffer);
2819
				      rpc_version, buffer);
(-)a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c (+8 lines)
Lines 553-564 static int _as_mysql_acct_check_tables(mysql_conn_t *mysql_conn) Link Here
553
		{ "description", "text" },
553
		{ "description", "text" },
554
		{ "flags", "int unsigned default 0" },
554
		{ "flags", "int unsigned default 0" },
555
		{ "grace_time", "int unsigned default NULL" },
555
		{ "grace_time", "int unsigned default NULL" },
556
		{ "max_jobs_pa", "int default NULL" },
556
		{ "max_jobs_per_user", "int default NULL" },
557
		{ "max_jobs_per_user", "int default NULL" },
558
		{ "max_submit_jobs_pa", "int default NULL" },
557
		{ "max_submit_jobs_per_user", "int default NULL" },
559
		{ "max_submit_jobs_per_user", "int default NULL" },
560
		{ "max_tres_pa", "text not null default ''" },
558
		{ "max_tres_pj", "text not null default ''" },
561
		{ "max_tres_pj", "text not null default ''" },
559
		{ "max_tres_pn", "text not null default ''" },
562
		{ "max_tres_pn", "text not null default ''" },
560
		{ "max_tres_pu", "text not null default ''" },
563
		{ "max_tres_pu", "text not null default ''" },
561
		{ "max_tres_mins_pj", "text not null default ''" },
564
		{ "max_tres_mins_pj", "text not null default ''" },
565
		{ "max_tres_run_mins_pa", "text not null default ''" },
562
		{ "max_tres_run_mins_pu", "text not null default ''" },
566
		{ "max_tres_run_mins_pu", "text not null default ''" },
563
		{ "min_tres_pj", "text not null default ''" },
567
		{ "min_tres_pj", "text not null default ''" },
564
		{ "max_wall_duration_per_job", "int default NULL" },
568
		{ "max_wall_duration_per_job", "int default NULL" },
Lines 2009-2020 extern int remove_common(mysql_conn_t *mysql_conn, Link Here
2009
			"update %s set "
2013
			"update %s set "
2010
			"mod_time=%ld, deleted=1, "
2014
			"mod_time=%ld, deleted=1, "
2011
			"grace_time=DEFAULT, "
2015
			"grace_time=DEFAULT, "
2016
			"max_jobs_pa=DEFAULT, "
2012
			"max_jobs_per_user=DEFAULT, "
2017
			"max_jobs_per_user=DEFAULT, "
2018
			"max_submit_jobs_pa=DEFAULT, "
2013
			"max_submit_jobs_per_user=DEFAULT, "
2019
			"max_submit_jobs_per_user=DEFAULT, "
2020
			"max_tres_pa=DEFAULT, "
2014
			"max_tres_pj=DEFAULT, "
2021
			"max_tres_pj=DEFAULT, "
2015
			"max_tres_pn=DEFAULT, "
2022
			"max_tres_pn=DEFAULT, "
2016
			"max_tres_pu=DEFAULT, "
2023
			"max_tres_pu=DEFAULT, "
2017
			"max_tres_mins_pj=DEFAULT, "
2024
			"max_tres_mins_pj=DEFAULT, "
2025
			"max_tres_run_mins_pa=DEFAULT, "
2018
			"max_tres_run_mins_pu=DEFAULT, "
2026
			"max_tres_run_mins_pu=DEFAULT, "
2019
			"min_tres_pj=DEFAULT, "
2027
			"min_tres_pj=DEFAULT, "
2020
			"max_wall_duration_per_job=DEFAULT, "
2028
			"max_wall_duration_per_job=DEFAULT, "
(-)a/src/plugins/accounting_storage/mysql/as_mysql_qos.c (+91 lines)
Lines 47-53 static char *mqos_req_inx[] = { Link Here
47
	"grp_tres_run_mins",
47
	"grp_tres_run_mins",
48
	"grp_tres",
48
	"grp_tres",
49
	"max_tres_mins_pj",
49
	"max_tres_mins_pj",
50
	"max_tres_run_mins_pa",
50
	"max_tres_run_mins_pu",
51
	"max_tres_run_mins_pu",
52
	"max_tres_pa",
51
	"max_tres_pj",
53
	"max_tres_pj",
52
	"max_tres_pn",
54
	"max_tres_pn",
53
	"max_tres_pu",
55
	"max_tres_pu",
Lines 62-68 enum { Link Here
62
	MQOS_GTRM,
64
	MQOS_GTRM,
63
	MQOS_GT,
65
	MQOS_GT,
64
	MQOS_MTMPJ,
66
	MQOS_MTMPJ,
67
	MQOS_MTRMA,
65
	MQOS_MTRM,
68
	MQOS_MTRM,
69
	MQOS_MTPA,
66
	MQOS_MTPJ,
70
	MQOS_MTPJ,
67
	MQOS_MTPN,
71
	MQOS_MTPN,
68
	MQOS_MTPU,
72
	MQOS_MTPU,
Lines 136-143 static int _setup_qos_limits(slurmdb_qos_rec_t *qos, Link Here
136
			qos->grp_submit_jobs = INFINITE;
140
			qos->grp_submit_jobs = INFINITE;
137
		if (qos->grp_wall == NO_VAL)
141
		if (qos->grp_wall == NO_VAL)
138
			qos->grp_wall = INFINITE;
142
			qos->grp_wall = INFINITE;
143
		if (qos->max_jobs_pa == NO_VAL)
144
			qos->max_jobs_pa = INFINITE;
139
		if (qos->max_jobs_pu == NO_VAL)
145
		if (qos->max_jobs_pu == NO_VAL)
140
			qos->max_jobs_pu = INFINITE;
146
			qos->max_jobs_pu = INFINITE;
147
		if (qos->max_submit_jobs_pa == NO_VAL)
148
			qos->max_submit_jobs_pa = INFINITE;
141
		if (qos->max_submit_jobs_pu == NO_VAL)
149
		if (qos->max_submit_jobs_pu == NO_VAL)
142
			qos->max_submit_jobs_pu = INFINITE;
150
			qos->max_submit_jobs_pu = INFINITE;
143
		if (qos->max_wall_pj == NO_VAL)
151
		if (qos->max_wall_pj == NO_VAL)
Lines 225-230 static int _setup_qos_limits(slurmdb_qos_rec_t *qos, Link Here
225
		xstrfmtcat(*extra, ", grp_wall=%u", qos->grp_wall);
233
		xstrfmtcat(*extra, ", grp_wall=%u", qos->grp_wall);
226
	}
234
	}
227
235
236
	if (qos->max_jobs_pa == INFINITE) {
237
		xstrcat(*cols, ", max_jobs_pa");
238
		xstrcat(*vals, ", NULL");
239
		xstrcat(*extra, ", max_jobs_pa=NULL");
240
	} else if ((qos->max_jobs_pa != NO_VAL)
241
		   && ((int32_t)qos->max_jobs_pa >= 0)) {
242
		xstrcat(*cols, ", max_jobs_pa");
243
		xstrfmtcat(*vals, ", %u", qos->max_jobs_pa);
244
		xstrfmtcat(*extra, ", max_jobs_pa=%u", qos->max_jobs_pa);
245
	}
246
228
	if (qos->max_jobs_pu == INFINITE) {
247
	if (qos->max_jobs_pu == INFINITE) {
229
		xstrcat(*cols, ", max_jobs_per_user");
248
		xstrcat(*cols, ", max_jobs_per_user");
230
		xstrcat(*vals, ", NULL");
249
		xstrcat(*vals, ", NULL");
Lines 236-241 static int _setup_qos_limits(slurmdb_qos_rec_t *qos, Link Here
236
		xstrfmtcat(*extra, ", max_jobs_per_user=%u", qos->max_jobs_pu);
255
		xstrfmtcat(*extra, ", max_jobs_per_user=%u", qos->max_jobs_pu);
237
	}
256
	}
238
257
258
	if (qos->max_submit_jobs_pa == INFINITE) {
259
		xstrcat(*cols, ", max_submit_jobs_pa");
260
		xstrcat(*vals, ", NULL");
261
		xstrcat(*extra, ", max_submit_jobs_pa=NULL");
262
	} else if ((qos->max_submit_jobs_pa != NO_VAL)
263
		   && ((int32_t)qos->max_submit_jobs_pa >= 0)) {
264
		xstrcat(*cols, ", max_submit_jobs_pa");
265
		xstrfmtcat(*vals, ", %u", qos->max_submit_jobs_pa);
266
		xstrfmtcat(*extra, ", max_submit_jobs_pa=%u",
267
			   qos->max_submit_jobs_pa);
268
	}
269
239
	if (qos->max_submit_jobs_pu == INFINITE) {
270
	if (qos->max_submit_jobs_pu == INFINITE) {
240
		xstrcat(*cols, ", max_submit_jobs_per_user");
271
		xstrcat(*cols, ", max_submit_jobs_per_user");
241
		xstrcat(*vals, ", NULL");
272
		xstrcat(*vals, ", NULL");
Lines 405-410 static int _setup_qos_limits(slurmdb_qos_rec_t *qos, Link Here
405
			   qos->grp_tres_run_mins);
436
			   qos->grp_tres_run_mins);
406
	}
437
	}
407
438
439
	if (qos->max_tres_pa) {
440
		if (!for_add) {
441
			xstrcat(*extra, "");
442
			goto end_modify;
443
		}
444
		xstrcat(*cols, ", max_tres_pa");
445
		slurmdb_combine_tres_strings(
446
			&qos->max_tres_pa, NULL, tres_str_flags);
447
		xstrfmtcat(*vals, ", '%s'", qos->max_tres_pa);
448
		xstrfmtcat(*extra, ", max_tres_pa='%s'", qos->max_tres_pa);
449
	}
450
408
	if (qos->max_tres_pj) {
451
	if (qos->max_tres_pj) {
409
		if (!for_add) {
452
		if (!for_add) {
410
			xstrcat(*extra, "");
453
			xstrcat(*extra, "");
Lines 454-459 static int _setup_qos_limits(slurmdb_qos_rec_t *qos, Link Here
454
			   qos->max_tres_mins_pj);
497
			   qos->max_tres_mins_pj);
455
	}
498
	}
456
499
500
	if (qos->max_tres_run_mins_pa) {
501
		if (!for_add) {
502
			xstrcat(*extra, "");
503
			goto end_modify;
504
		}
505
		xstrcat(*cols, ", max_tres_run_mins_pa");
506
		slurmdb_combine_tres_strings(
507
			&qos->max_tres_run_mins_pa, NULL, tres_str_flags);
508
		xstrfmtcat(*vals, ", '%s'", qos->max_tres_run_mins_pa);
509
		xstrfmtcat(*extra, ", max_tres_run_mins_pa='%s'",
510
			   qos->max_tres_run_mins_pa);
511
	}
512
457
	if (qos->max_tres_run_mins_pu) {
513
	if (qos->max_tres_run_mins_pu) {
458
		if (!for_add) {
514
		if (!for_add) {
459
			xstrcat(*extra, "");
515
			xstrcat(*extra, "");
Lines 761-766 extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid, Link Here
761
		qos_rec->grp_submit_jobs = qos->grp_submit_jobs;
817
		qos_rec->grp_submit_jobs = qos->grp_submit_jobs;
762
		qos_rec->grp_wall = qos->grp_wall;
818
		qos_rec->grp_wall = qos->grp_wall;
763
819
820
		mod_tres_str(&qos_rec->max_tres_pa,
821
			     qos->max_tres_pa, row[MQOS_MTPA],
822
			     NULL, "max_tres_pa", &vals, qos_rec->id, 0);
764
		mod_tres_str(&qos_rec->max_tres_pj,
823
		mod_tres_str(&qos_rec->max_tres_pj,
765
			     qos->max_tres_pj, row[MQOS_MTPJ],
824
			     qos->max_tres_pj, row[MQOS_MTPJ],
766
			     NULL, "max_tres_pj", &vals, qos_rec->id, 0);
825
			     NULL, "max_tres_pj", &vals, qos_rec->id, 0);
Lines 773-784 extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid, Link Here
773
		mod_tres_str(&qos_rec->max_tres_mins_pj,
832
		mod_tres_str(&qos_rec->max_tres_mins_pj,
774
			     qos->max_tres_mins_pj, row[MQOS_MTMPJ],
833
			     qos->max_tres_mins_pj, row[MQOS_MTMPJ],
775
			     NULL, "max_tres_mins_pj", &vals, qos_rec->id, 0);
834
			     NULL, "max_tres_mins_pj", &vals, qos_rec->id, 0);
835
		mod_tres_str(&qos_rec->max_tres_run_mins_pa,
836
			     qos->max_tres_run_mins_pa, row[MQOS_MTRM],
837
			     NULL, "max_tres_run_mins_pa", &vals,
838
			     qos_rec->id, 0);
776
		mod_tres_str(&qos_rec->max_tres_run_mins_pu,
839
		mod_tres_str(&qos_rec->max_tres_run_mins_pu,
777
			     qos->max_tres_run_mins_pu, row[MQOS_MTRM],
840
			     qos->max_tres_run_mins_pu, row[MQOS_MTRM],
778
			     NULL, "max_tres_run_mins_pu", &vals,
841
			     NULL, "max_tres_run_mins_pu", &vals,
779
			     qos_rec->id, 0);
842
			     qos_rec->id, 0);
780
843
844
		qos_rec->max_jobs_pa  = qos->max_jobs_pa;
781
		qos_rec->max_jobs_pu  = qos->max_jobs_pu;
845
		qos_rec->max_jobs_pu  = qos->max_jobs_pu;
846
		qos_rec->max_submit_jobs_pa  = qos->max_submit_jobs_pa;
782
		qos_rec->max_submit_jobs_pu  = qos->max_submit_jobs_pu;
847
		qos_rec->max_submit_jobs_pu  = qos->max_submit_jobs_pu;
783
		qos_rec->max_wall_pj = qos->max_wall_pj;
848
		qos_rec->max_wall_pj = qos->max_wall_pj;
784
849
Lines 1076-1086 extern List as_mysql_get_qos(mysql_conn_t *mysql_conn, uid_t uid, Link Here
1076
		"grp_submit_jobs",
1141
		"grp_submit_jobs",
1077
		"grp_wall",
1142
		"grp_wall",
1078
		"max_tres_mins_pj",
1143
		"max_tres_mins_pj",
1144
		"max_tres_run_mins_pa",
1079
		"max_tres_run_mins_pu",
1145
		"max_tres_run_mins_pu",
1146
		"max_tres_pa",
1080
		"max_tres_pj",
1147
		"max_tres_pj",
1081
		"max_tres_pn",
1148
		"max_tres_pn",
1082
		"max_tres_pu",
1149
		"max_tres_pu",
1150
		"max_jobs_pa",
1083
		"max_jobs_per_user",
1151
		"max_jobs_per_user",
1152
		"max_submit_jobs_pa",
1084
		"max_submit_jobs_per_user",
1153
		"max_submit_jobs_per_user",
1085
		"max_wall_duration_per_job",
1154
		"max_wall_duration_per_job",
1086
		"substr(preempt, 1, length(preempt) - 1)",
1155
		"substr(preempt, 1, length(preempt) - 1)",
Lines 1103-1113 extern List as_mysql_get_qos(mysql_conn_t *mysql_conn, uid_t uid, Link Here
1103
		QOS_REQ_GSJ,
1172
		QOS_REQ_GSJ,
1104
		QOS_REQ_GW,
1173
		QOS_REQ_GW,
1105
		QOS_REQ_MTMPJ,
1174
		QOS_REQ_MTMPJ,
1175
		QOS_REQ_MTRMA,
1106
		QOS_REQ_MTRM,
1176
		QOS_REQ_MTRM,
1177
		QOS_REQ_MTPA,
1107
		QOS_REQ_MTPJ,
1178
		QOS_REQ_MTPJ,
1108
		QOS_REQ_MTPN,
1179
		QOS_REQ_MTPN,
1109
		QOS_REQ_MTPU,
1180
		QOS_REQ_MTPU,
1181
		QOS_REQ_MJPA,
1110
		QOS_REQ_MJPU,
1182
		QOS_REQ_MJPU,
1183
		QOS_REQ_MSJPA,
1111
		QOS_REQ_MSJPU,
1184
		QOS_REQ_MSJPU,
1112
		QOS_REQ_MWPJ,
1185
		QOS_REQ_MWPJ,
1113
		QOS_REQ_PREE,
1186
		QOS_REQ_PREE,
Lines 1242-1257 empty: Link Here
1242
		else
1315
		else
1243
			qos->grp_wall = INFINITE;
1316
			qos->grp_wall = INFINITE;
1244
1317
1318
		if (row[QOS_REQ_MJPA])
1319
			qos->max_jobs_pa = slurm_atoul(row[QOS_REQ_MJPA]);
1320
		else
1321
			qos->max_jobs_pa = INFINITE;
1322
1245
		if (row[QOS_REQ_MJPU])
1323
		if (row[QOS_REQ_MJPU])
1246
			qos->max_jobs_pu = slurm_atoul(row[QOS_REQ_MJPU]);
1324
			qos->max_jobs_pu = slurm_atoul(row[QOS_REQ_MJPU]);
1247
		else
1325
		else
1248
			qos->max_jobs_pu = INFINITE;
1326
			qos->max_jobs_pu = INFINITE;
1327
1328
		if (row[QOS_REQ_MSJPA])
1329
			qos->max_submit_jobs_pa =
1330
				slurm_atoul(row[QOS_REQ_MSJPA]);
1331
		else
1332
			qos->max_submit_jobs_pa = INFINITE;
1333
1249
		if (row[QOS_REQ_MSJPU])
1334
		if (row[QOS_REQ_MSJPU])
1250
			qos->max_submit_jobs_pu =
1335
			qos->max_submit_jobs_pu =
1251
				slurm_atoul(row[QOS_REQ_MSJPU]);
1336
				slurm_atoul(row[QOS_REQ_MSJPU]);
1252
		else
1337
		else
1253
			qos->max_submit_jobs_pu = INFINITE;
1338
			qos->max_submit_jobs_pu = INFINITE;
1254
1339
1340
		if (row[QOS_REQ_MTPA][0])
1341
			qos->max_tres_pa = xstrdup(row[QOS_REQ_MTPA]);
1342
1255
		if (row[QOS_REQ_MTPJ][0])
1343
		if (row[QOS_REQ_MTPJ][0])
1256
			qos->max_tres_pj = xstrdup(row[QOS_REQ_MTPJ]);
1344
			qos->max_tres_pj = xstrdup(row[QOS_REQ_MTPJ]);
1257
1345
Lines 1264-1269 empty: Link Here
1264
		if (row[QOS_REQ_MTMPJ][0])
1352
		if (row[QOS_REQ_MTMPJ][0])
1265
			qos->max_tres_mins_pj = xstrdup(row[QOS_REQ_MTMPJ]);
1353
			qos->max_tres_mins_pj = xstrdup(row[QOS_REQ_MTMPJ]);
1266
1354
1355
		if (row[QOS_REQ_MTRMA][0])
1356
			qos->max_tres_run_mins_pa = xstrdup(row[QOS_REQ_MTRMA]);
1357
1267
		if (row[QOS_REQ_MTRM][0])
1358
		if (row[QOS_REQ_MTRM][0])
1268
			qos->max_tres_run_mins_pu = xstrdup(row[QOS_REQ_MTRM]);
1359
			qos->max_tres_run_mins_pu = xstrdup(row[QOS_REQ_MTRM]);
1269
1360
(-)a/src/sacctmgr/common.c (-25 / +82 lines)
Lines 426-431 static print_field_t *_get_print_field(char *object) Link Here
426
		field->name = xstrdup("MaxTRESMins");
426
		field->name = xstrdup("MaxTRESMins");
427
		field->len = 13;
427
		field->len = 13;
428
		field->print_routine = sacctmgr_print_tres;
428
		field->print_routine = sacctmgr_print_tres;
429
	} else if (!strncasecmp("MaxTRESRunMinsPerAccount", object,
430
				MAX(command_len, 18)) ||
431
		   !strncasecmp("MaxTRESRunMinsPA", object,
432
				MAX(command_len, 15))) {
433
		field->type = PRINT_MAXTRMA;
434
		field->name = xstrdup("MaxTRESRunMinsPA");
435
		field->len = 15;
436
		field->print_routine = sacctmgr_print_tres;
429
	} else if (!strncasecmp("MaxTRESRunMinsPerUser", object,
437
	} else if (!strncasecmp("MaxTRESRunMinsPerUser", object,
430
				MAX(command_len, 8)) ||
438
				MAX(command_len, 8)) ||
431
		   !strncasecmp("MaxTRESRunMinsPU", object,
439
		   !strncasecmp("MaxTRESRunMinsPU", object,
Lines 434-439 static print_field_t *_get_print_field(char *object) Link Here
434
		field->name = xstrdup("MaxTRESRunMinsPU");
442
		field->name = xstrdup("MaxTRESRunMinsPU");
435
		field->len = 15;
443
		field->len = 15;
436
		field->print_routine = sacctmgr_print_tres;
444
		field->print_routine = sacctmgr_print_tres;
445
	} else if (!strncasecmp("MaxTRESPerAccount", object,
446
				MAX(command_len, 11)) ||
447
		   !strncasecmp("MaxTRESPA", object,
448
				MAX(command_len, 9))) {
449
		field->type = PRINT_MAXTA;
450
		field->name = xstrdup("MaxTRESPA");
451
		field->len = 13;
452
		field->print_routine = sacctmgr_print_tres;
437
	} else if (!strncasecmp("MaxTRESPerUser", object,
453
	} else if (!strncasecmp("MaxTRESPerUser", object,
438
				MAX(command_len, 11))) {
454
				MAX(command_len, 11))) {
439
		field->type = PRINT_MAXTU;
455
		field->type = PRINT_MAXTU;
Lines 445-450 static print_field_t *_get_print_field(char *object) Link Here
445
		field->name = xstrdup("MaxJobs");
461
		field->name = xstrdup("MaxJobs");
446
		field->len = 7;
462
		field->len = 7;
447
		field->print_routine = print_fields_uint;
463
		field->print_routine = print_fields_uint;
464
	} else if (!strncasecmp("MaxJobsPerAccount", object,
465
				MAX(command_len, 11)) ||
466
		   !strncasecmp("MaxJobsPA", object,
467
				MAX(command_len, 9))) {
468
		field->type = PRINT_MAXJA;
469
		field->name = xstrdup("MaxJobsPA");
470
		field->len = 9;
471
		field->print_routine = print_fields_uint;
448
	} else if (!strncasecmp("MaxJobsPerUser", object,
472
	} else if (!strncasecmp("MaxJobsPerUser", object,
449
				MAX(command_len, 8)) ||
473
				MAX(command_len, 8)) ||
450
		   !strncasecmp("MaxJobsPU", object,
474
		   !strncasecmp("MaxJobsPU", object,
Lines 472-477 static print_field_t *_get_print_field(char *object) Link Here
472
		field->name = xstrdup("MaxSubmit");
496
		field->name = xstrdup("MaxSubmit");
473
		field->len = 9;
497
		field->len = 9;
474
		field->print_routine = print_fields_uint;
498
		field->print_routine = print_fields_uint;
499
	} else if (!strncasecmp("MaxSubmitJobsPerAccount", object,
500
				MAX(command_len, 17)) ||
501
		   !strncasecmp("MaxSubmitJobsPA", object,
502
				MAX(command_len, 15))) {
503
		field->type = PRINT_MAXSA;
504
		field->name = xstrdup("MaxSubmitPA");
505
		field->len = 11;
506
		field->print_routine = print_fields_uint;
475
	} else if (!strncasecmp("MaxSubmitJobsPerUser", object,
507
	} else if (!strncasecmp("MaxSubmitJobsPerUser", object,
476
				MAX(command_len, 10)) ||
508
				MAX(command_len, 10)) ||
477
		   !strncasecmp("MaxSubmitJobsPU", object,
509
		   !strncasecmp("MaxSubmitJobsPU", object,
Lines 1748-1879 extern void sacctmgr_print_qos_limits(slurmdb_qos_rec_t *qos) Link Here
1748
1780
1749
	if (qos->flags && (qos->flags != QOS_FLAG_NOTSET)) {
1781
	if (qos->flags && (qos->flags != QOS_FLAG_NOTSET)) {
1750
		char *tmp_char = slurmdb_qos_flags_str(qos->flags);
1782
		char *tmp_char = slurmdb_qos_flags_str(qos->flags);
1751
		printf("  Flags          = %s\n", tmp_char);
1783
		printf("  Flags                    = %s\n", tmp_char);
1752
		xfree(tmp_char);
1784
		xfree(tmp_char);
1753
	}
1785
	}
1754
1786
1755
	if (qos->grace_time == INFINITE)
1787
	if (qos->grace_time == INFINITE)
1756
		printf("  GraceTime      = NONE\n");
1788
		printf("  GraceTime                = NONE\n");
1757
	else if (qos->grace_time != NO_VAL)
1789
	else if (qos->grace_time != NO_VAL)
1758
		printf("  GraceTime      = %d\n", qos->grace_time);
1790
		printf("  GraceTime                = %d\n", qos->grace_time);
1759
1791
1760
	if (qos->grp_jobs == INFINITE)
1792
	if (qos->grp_jobs == INFINITE)
1761
		printf("  GrpJobs        = NONE\n");
1793
		printf("  GrpJobs                  = NONE\n");
1762
	else if (qos->grp_jobs != NO_VAL)
1794
	else if (qos->grp_jobs != NO_VAL)
1763
		printf("  GrpJobs        = %u\n", qos->grp_jobs);
1795
		printf("  GrpJobs                  = %u\n", qos->grp_jobs);
1764
1796
1765
	if (qos->grp_submit_jobs == INFINITE)
1797
	if (qos->grp_submit_jobs == INFINITE)
1766
		printf("  GrpSubmitJobs  = NONE\n");
1798
		printf("  GrpSubmitJobs            = NONE\n");
1767
	else if (qos->grp_submit_jobs != NO_VAL)
1799
	else if (qos->grp_submit_jobs != NO_VAL)
1768
		printf("  GrpSubmitJobs  = %u\n",
1800
		printf("  GrpSubmitJobs            = %u\n",
1769
		       qos->grp_submit_jobs);
1801
		       qos->grp_submit_jobs);
1770
1802
1771
	if (qos->grp_tres) {
1803
	if (qos->grp_tres) {
1772
		sacctmgr_initialize_g_tres_list();
1804
		sacctmgr_initialize_g_tres_list();
1773
		tmp_char = slurmdb_make_tres_string_from_simple(
1805
		tmp_char = slurmdb_make_tres_string_from_simple(
1774
			qos->grp_tres, g_tres_list);
1806
			qos->grp_tres, g_tres_list);
1775
		printf("  GrpTRES       = %s\n", tmp_char);
1807
		printf("  GrpTRES                  = %s\n", tmp_char);
1776
		xfree(tmp_char);
1808
		xfree(tmp_char);
1777
	}
1809
	}
1778
	if (qos->grp_tres_mins) {
1810
	if (qos->grp_tres_mins) {
1779
		sacctmgr_initialize_g_tres_list();
1811
		sacctmgr_initialize_g_tres_list();
1780
		tmp_char = slurmdb_make_tres_string_from_simple(
1812
		tmp_char = slurmdb_make_tres_string_from_simple(
1781
			qos->grp_tres_mins, g_tres_list);
1813
			qos->grp_tres_mins, g_tres_list);
1782
		printf("  GrpTRESMins   = %s\n", tmp_char);
1814
		printf("  GrpTRESMins              = %s\n", tmp_char);
1783
		xfree(tmp_char);
1815
		xfree(tmp_char);
1784
	}
1816
	}
1785
	if (qos->grp_tres_run_mins) {
1817
	if (qos->grp_tres_run_mins) {
1786
		sacctmgr_initialize_g_tres_list();
1818
		sacctmgr_initialize_g_tres_list();
1787
		tmp_char = slurmdb_make_tres_string_from_simple(
1819
		tmp_char = slurmdb_make_tres_string_from_simple(
1788
			qos->grp_tres_run_mins, g_tres_list);
1820
			qos->grp_tres_run_mins, g_tres_list);
1789
		printf("  GrpTRESRunMins= %s\n", tmp_char);
1821
		printf("  GrpTRESRunMins           = %s\n", tmp_char);
1790
		xfree(tmp_char);
1822
		xfree(tmp_char);
1791
	}
1823
	}
1792
1824
1793
	if (qos->grp_wall == INFINITE)
1825
	if (qos->grp_wall == INFINITE)
1794
		printf("  GrpWall        = NONE\n");
1826
		printf("  GrpWall                  = NONE\n");
1795
	else if (qos->grp_wall != NO_VAL) {
1827
	else if (qos->grp_wall != NO_VAL) {
1796
		char time_buf[32];
1828
		char time_buf[32];
1797
		mins2time_str((time_t) qos->grp_wall,
1829
		mins2time_str((time_t) qos->grp_wall,
1798
			      time_buf, sizeof(time_buf));
1830
			      time_buf, sizeof(time_buf));
1799
		printf("  GrpWall        = %s\n", time_buf);
1831
		printf("  GrpWall                  = %s\n", time_buf);
1800
	}
1832
	}
1801
1833
1834
	if (qos->max_jobs_pa == INFINITE)
1835
		printf("  MaxJobsPerAccount        = NONE\n");
1836
	else if (qos->max_jobs_pa != NO_VAL)
1837
		printf("  MaxJobsPerAccount        = %u\n",
1838
		       qos->max_jobs_pa);
1802
	if (qos->max_jobs_pu == INFINITE)
1839
	if (qos->max_jobs_pu == INFINITE)
1803
		printf("  MaxJobsPerUser = NONE\n");
1840
		printf("  MaxJobsPerUser = NONE\n");
1804
	else if (qos->max_jobs_pu != NO_VAL)
1841
	else if (qos->max_jobs_pu != NO_VAL)
1805
		printf("  MaxJobsPerUser = %u\n",
1842
		printf("  MaxJobsPerUser = %u\n",
1806
		       qos->max_jobs_pu);
1843
		       qos->max_jobs_pu);
1807
1844
1845
	if (qos->max_submit_jobs_pa == INFINITE)
1846
		printf("  MaxSubmitJobsPerAccount  = NONE\n");
1847
	else if (qos->max_submit_jobs_pa != NO_VAL)
1848
		printf("  MaxSubmitJobsPerAccount  = %u\n",
1849
		       qos->max_submit_jobs_pa);
1850
1808
	if (qos->max_submit_jobs_pu == INFINITE)
1851
	if (qos->max_submit_jobs_pu == INFINITE)
1809
		printf("  MaxSubmitJobs  = NONE\n");
1852
		printf("  MaxSubmitJobsPerUser     = NONE\n");
1810
	else if (qos->max_submit_jobs_pu != NO_VAL)
1853
	else if (qos->max_submit_jobs_pu != NO_VAL)
1811
		printf("  MaxSubmitJobs  = %u\n",
1854
		printf("  MaxSubmitJobsPerUser     = %u\n",
1812
		       qos->max_submit_jobs_pu);
1855
		       qos->max_submit_jobs_pu);
1813
1856
1857
	if (qos->max_tres_pa) {
1858
		sacctmgr_initialize_g_tres_list();
1859
		tmp_char = slurmdb_make_tres_string_from_simple(
1860
			qos->max_tres_pa, g_tres_list);
1861
		printf("  MaxTRESPerAccount        = %s\n", tmp_char);
1862
		xfree(tmp_char);
1863
	}
1814
	if (qos->max_tres_pj) {
1864
	if (qos->max_tres_pj) {
1815
		sacctmgr_initialize_g_tres_list();
1865
		sacctmgr_initialize_g_tres_list();
1816
		tmp_char = slurmdb_make_tres_string_from_simple(
1866
		tmp_char = slurmdb_make_tres_string_from_simple(
1817
			qos->max_tres_pj, g_tres_list);
1867
			qos->max_tres_pj, g_tres_list);
1818
		printf("  MaxTRESPerJob = %s\n", tmp_char);
1868
		printf("  MaxTRESPerJob            = %s\n", tmp_char);
1819
		xfree(tmp_char);
1869
		xfree(tmp_char);
1820
	}
1870
	}
1821
	if (qos->max_tres_pn) {
1871
	if (qos->max_tres_pn) {
1822
		sacctmgr_initialize_g_tres_list();
1872
		sacctmgr_initialize_g_tres_list();
1823
		tmp_char = slurmdb_make_tres_string_from_simple(
1873
		tmp_char = slurmdb_make_tres_string_from_simple(
1824
			qos->max_tres_pn, g_tres_list);
1874
			qos->max_tres_pn, g_tres_list);
1825
		printf("  MaxTRESPerNode= %s\n", tmp_char);
1875
		printf("  MaxTRESPerNode           = %s\n", tmp_char);
1826
		xfree(tmp_char);
1876
		xfree(tmp_char);
1827
	}
1877
	}
1828
	if (qos->max_tres_pu) {
1878
	if (qos->max_tres_pu) {
1829
		sacctmgr_initialize_g_tres_list();
1879
		sacctmgr_initialize_g_tres_list();
1830
		tmp_char = slurmdb_make_tres_string_from_simple(
1880
		tmp_char = slurmdb_make_tres_string_from_simple(
1831
			qos->max_tres_pu, g_tres_list);
1881
			qos->max_tres_pu, g_tres_list);
1832
		printf("  MaxTRESPerUser= %s\n", tmp_char);
1882
		printf("  MaxTRESPerUser           = %s\n", tmp_char);
1833
		xfree(tmp_char);
1883
		xfree(tmp_char);
1834
	}
1884
	}
1835
	if (qos->max_tres_mins_pj) {
1885
	if (qos->max_tres_mins_pj) {
1836
		sacctmgr_initialize_g_tres_list();
1886
		sacctmgr_initialize_g_tres_list();
1837
		tmp_char = slurmdb_make_tres_string_from_simple(
1887
		tmp_char = slurmdb_make_tres_string_from_simple(
1838
			qos->max_tres_mins_pj, g_tres_list);
1888
			qos->max_tres_mins_pj, g_tres_list);
1839
		printf("  MaxTRESMins   = %s\n", tmp_char);
1889
		printf("  MaxTRESMins              = %s\n", tmp_char);
1890
		xfree(tmp_char);
1891
	}
1892
	if (qos->max_tres_run_mins_pa) {
1893
		sacctmgr_initialize_g_tres_list();
1894
		tmp_char = slurmdb_make_tres_string_from_simple(
1895
			qos->max_tres_run_mins_pa, g_tres_list);
1896
		printf("  MaxTRESRUNMinsPerAccount = %s\n", tmp_char);
1840
		xfree(tmp_char);
1897
		xfree(tmp_char);
1841
	}
1898
	}
1842
	if (qos->max_tres_run_mins_pu) {
1899
	if (qos->max_tres_run_mins_pu) {
1843
		sacctmgr_initialize_g_tres_list();
1900
		sacctmgr_initialize_g_tres_list();
1844
		tmp_char = slurmdb_make_tres_string_from_simple(
1901
		tmp_char = slurmdb_make_tres_string_from_simple(
1845
			qos->max_tres_run_mins_pu, g_tres_list);
1902
			qos->max_tres_run_mins_pu, g_tres_list);
1846
		printf("  MaxTRESRUNMins= %s\n", tmp_char);
1903
		printf("  MaxTRESRUNMinsPerUser    = %s\n", tmp_char);
1847
		xfree(tmp_char);
1904
		xfree(tmp_char);
1848
	}
1905
	}
1849
1906
1850
	if (qos->max_wall_pj == INFINITE)
1907
	if (qos->max_wall_pj == INFINITE)
1851
		printf("  MaxWall        = NONE\n");
1908
		printf("  MaxWall                  = NONE\n");
1852
	else if (qos->max_wall_pj != NO_VAL) {
1909
	else if (qos->max_wall_pj != NO_VAL) {
1853
		char time_buf[32];
1910
		char time_buf[32];
1854
		mins2time_str((time_t) qos->max_wall_pj,
1911
		mins2time_str((time_t) qos->max_wall_pj,
1855
			      time_buf, sizeof(time_buf));
1912
			      time_buf, sizeof(time_buf));
1856
		printf("  MaxWall        = %s\n", time_buf);
1913
		printf("  MaxWall                  = %s\n", time_buf);
1857
	}
1914
	}
1858
1915
1859
	if (qos->preempt_list) {
1916
	if (qos->preempt_list) {
1860
		char *temp_char = get_qos_complete_str(g_qos_list,
1917
		char *temp_char = get_qos_complete_str(g_qos_list,
1861
						       qos->preempt_list);
1918
						       qos->preempt_list);
1862
		if (temp_char) {
1919
		if (temp_char) {
1863
			printf("  Preempt        = %s\n", temp_char);
1920
			printf("  Preempt          = %s\n", temp_char);
1864
			xfree(temp_char);
1921
			xfree(temp_char);
1865
		}
1922
		}
1866
	}
1923
	}
1867
1924
1868
	if (qos->preempt_mode && (qos->preempt_mode != (uint16_t)NO_VAL)) {
1925
	if (qos->preempt_mode && (qos->preempt_mode != (uint16_t)NO_VAL)) {
1869
		printf("  PreemptMode    = %s\n",
1926
		printf("  PreemptMode              = %s\n",
1870
		       preempt_mode_string(qos->preempt_mode));
1927
		       preempt_mode_string(qos->preempt_mode));
1871
	}
1928
	}
1872
1929
1873
	if (qos->priority == INFINITE)
1930
	if (qos->priority == INFINITE)
1874
		printf("  Priority       = NONE\n");
1931
		printf("  Priority                 = NONE\n");
1875
	else if (qos->priority != NO_VAL)
1932
	else if (qos->priority != NO_VAL)
1876
		printf("  Priority       = %d\n", qos->priority);
1933
		printf("  Priority                 = %d\n", qos->priority);
1877
1934
1878
}
1935
}
1879
1936
(-)a/src/sacctmgr/qos_functions.c (-3 / +63 lines)
Lines 456-467 static int _set_rec(int *start, int argc, char *argv[], Link Here
456
					tres_flags);
456
					tres_flags);
457
				xfree(tmp_char);
457
				xfree(tmp_char);
458
			}
458
			}
459
		} else if (!strncasecmp (argv[i], "MaxJobsPerAccount",
460
					 MAX(command_len, 11)) ||
461
			   !strncasecmp (argv[i], "MaxJobsPA",
462
					 MAX(command_len, 9))) {
463
			if (get_uint(argv[i]+end, &qos->max_jobs_pa,
464
			    "MaxJobsPA") == SLURM_SUCCESS)
465
				set = 1;
459
		} else if (!strncasecmp (argv[i], "MaxJobsPerUser",
466
		} else if (!strncasecmp (argv[i], "MaxJobsPerUser",
460
					 MAX(command_len, 4)) ||
467
					 MAX(command_len, 4)) ||
461
			   !strncasecmp (argv[i], "MaxJobsPU",
468
			   !strncasecmp (argv[i], "MaxJobsPU",
462
					 MAX(command_len, 4))) {
469
					 MAX(command_len, 4))) {
463
			if (get_uint(argv[i]+end, &qos->max_jobs_pu,
470
			if (get_uint(argv[i]+end, &qos->max_jobs_pu,
464
			    "MaxJobs") == SLURM_SUCCESS)
471
			    "MaxJobsPU") == SLURM_SUCCESS)
465
				set = 1;
472
				set = 1;
466
		} else if (!strncasecmp (argv[i], "MaxNodesPerJob",
473
		} else if (!strncasecmp (argv[i], "MaxNodesPerJob",
467
					 MAX(command_len, 4))) {
474
					 MAX(command_len, 4))) {
Lines 489-501 static int _set_rec(int *start, int argc, char *argv[], Link Here
489
					tres_flags);
496
					tres_flags);
490
				xfree(tmp_char);
497
				xfree(tmp_char);
491
			}
498
			}
499
		} else if (!strncasecmp (argv[i], "MaxSubmitJobsPerAccount",
500
					 MAX(command_len, 17)) ||
501
			   !strncasecmp (argv[i], "MaxSubmitJobsPA",
502
					 MAX(command_len, 15))) {
503
			if (get_uint(argv[i]+end, &qos->max_submit_jobs_pa,
504
			    "MaxSubmitJobsPA") == SLURM_SUCCESS)
505
				set = 1;
492
		} else if (!strncasecmp (argv[i], "MaxSubmitJobsPerUser",
506
		} else if (!strncasecmp (argv[i], "MaxSubmitJobsPerUser",
493
					 MAX(command_len, 4)) ||
507
					 MAX(command_len, 4)) ||
494
			   !strncasecmp (argv[i], "MaxSubmitJobsPU",
508
			   !strncasecmp (argv[i], "MaxSubmitJobsPU",
495
					 MAX(command_len, 4))) {
509
					 MAX(command_len, 4))) {
496
			if (get_uint(argv[i]+end, &qos->max_submit_jobs_pu,
510
			if (get_uint(argv[i]+end, &qos->max_submit_jobs_pu,
497
			    "MaxSubmitJobs") == SLURM_SUCCESS)
511
			    "MaxSubmitJobsPU") == SLURM_SUCCESS)
512
				set = 1;
513
		} else if (!strncasecmp(argv[i], "MaxTRESPerAccount",
514
					MAX(command_len, 11)) ||
515
			   !strncasecmp(argv[i], "MaxTRESPA",
516
					MAX(command_len, 9))) {
517
			sacctmgr_initialize_g_tres_list();
518
519
			if ((tmp_char = slurmdb_format_tres_str(
520
				     argv[i]+end, g_tres_list, 1))) {
521
				slurmdb_combine_tres_strings(
522
					&qos->max_tres_pa, tmp_char,
523
					tres_flags);
498
				set = 1;
524
				set = 1;
525
				xfree(tmp_char);
526
			}
499
		} else if (!strncasecmp(argv[i], "MaxTRESPerJob",
527
		} else if (!strncasecmp(argv[i], "MaxTRESPerJob",
500
					MAX(command_len, 7))) {
528
					MAX(command_len, 7))) {
501
			sacctmgr_initialize_g_tres_list();
529
			sacctmgr_initialize_g_tres_list();
Lines 546-552 static int _set_rec(int *start, int argc, char *argv[], Link Here
546
				set = 1;
574
				set = 1;
547
				xfree(tmp_char);
575
				xfree(tmp_char);
548
			}
576
			}
549
		} else if (!strncasecmp(argv[i], "MaxTRESRunMins",
577
		} else if (!strncasecmp(argv[i], "MaxTRESRunMinsPA",
578
					MAX(command_len, 16))) {
579
			sacctmgr_initialize_g_tres_list();
580
581
			if ((tmp_char = slurmdb_format_tres_str(
582
				     argv[i]+end, g_tres_list, 1))) {
583
				slurmdb_combine_tres_strings(
584
					&qos->max_tres_run_mins_pa, tmp_char,
585
					tres_flags);
586
				set = 1;
587
				xfree(tmp_char);
588
			}
589
		} else if (!strncasecmp(argv[i], "MaxTRESRunMinsPU",
550
					MAX(command_len, 8))) {
590
					MAX(command_len, 8))) {
551
			sacctmgr_initialize_g_tres_list();
591
			sacctmgr_initialize_g_tres_list();
552
592
Lines 1056-1066 extern int sacctmgr_list_qos(int argc, char *argv[]) Link Here
1056
					field, qos->max_tres_run_mins_pu,
1096
					field, qos->max_tres_run_mins_pu,
1057
					(curr_inx == field_count));
1097
					(curr_inx == field_count));
1058
				break;
1098
				break;
1099
			case PRINT_MAXTRMA:
1100
				field->print_routine(
1101
					field, qos->max_tres_run_mins_pa,
1102
					(curr_inx == field_count));
1103
				break;
1059
			case PRINT_MAXT:
1104
			case PRINT_MAXT:
1060
				field->print_routine(
1105
				field->print_routine(
1061
					field, qos->max_tres_pj,
1106
					field, qos->max_tres_pj,
1062
					(curr_inx == field_count));
1107
					(curr_inx == field_count));
1063
				break;
1108
				break;
1109
			case PRINT_MAXTA:
1110
				field->print_routine(
1111
					field, qos->max_tres_pa,
1112
					(curr_inx == field_count));
1113
				break;
1064
			case PRINT_MAXTN:
1114
			case PRINT_MAXTN:
1065
				field->print_routine(
1115
				field->print_routine(
1066
					field, qos->max_tres_pn,
1116
					field, qos->max_tres_pn,
Lines 1076-1081 extern int sacctmgr_list_qos(int argc, char *argv[]) Link Here
1076
						     qos->max_jobs_pu,
1126
						     qos->max_jobs_pu,
1077
						     (curr_inx == field_count));
1127
						     (curr_inx == field_count));
1078
				break;
1128
				break;
1129
			case PRINT_MAXJA:
1130
				field->print_routine(field,
1131
						     qos->max_jobs_pa,
1132
						     (curr_inx == field_count));
1133
				break;
1079
			case PRINT_MAXN:
1134
			case PRINT_MAXN:
1080
				field->print_routine(
1135
				field->print_routine(
1081
					field,
1136
					field,
Lines 1095-1100 extern int sacctmgr_list_qos(int argc, char *argv[]) Link Here
1095
						     qos->max_submit_jobs_pu,
1150
						     qos->max_submit_jobs_pu,
1096
						     (curr_inx == field_count));
1151
						     (curr_inx == field_count));
1097
				break;
1152
				break;
1153
			case PRINT_MAXSA:
1154
				field->print_routine(field,
1155
						     qos->max_submit_jobs_pa,
1156
						     (curr_inx == field_count));
1157
				break;
1098
			case PRINT_MAXW:
1158
			case PRINT_MAXW:
1099
				field->print_routine(
1159
				field->print_routine(
1100
					field,
1160
					field,
(-)a/src/sacctmgr/sacctmgr.h (+4 lines)
Lines 122-134 typedef enum { Link Here
122
	PRINT_MAXCU,
122
	PRINT_MAXCU,
123
	PRINT_MAXTM,
123
	PRINT_MAXTM,
124
	PRINT_MAXTRM,
124
	PRINT_MAXTRM,
125
	PRINT_MAXTRMA,
125
	PRINT_MAXT,
126
	PRINT_MAXT,
127
	PRINT_MAXTA,
126
	PRINT_MAXTN,
128
	PRINT_MAXTN,
127
	PRINT_MAXTU,
129
	PRINT_MAXTU,
128
	PRINT_MAXJ,
130
	PRINT_MAXJ,
131
	PRINT_MAXJA,
129
	PRINT_MAXN,
132
	PRINT_MAXN,
130
	PRINT_MAXNU,
133
	PRINT_MAXNU,
131
	PRINT_MAXS,
134
	PRINT_MAXS,
135
	PRINT_MAXSA,
132
	PRINT_MAXW,
136
	PRINT_MAXW,
133
	PRINT_MINC,
137
	PRINT_MINC,
134
	PRINT_MINT,
138
	PRINT_MINT,
(-)a/src/scontrol/info_assoc_mgr.c (-19 / +99 lines)
Lines 82-87 endit: Link Here
82
	printf("%s", new_line_char);
82
	printf("%s", new_line_char);
83
}
83
}
84
84
85
static int _print_used_acct_limit(slurmdb_used_limits_t *used_limit,
86
				  slurmdb_qos_rec_t *qos_rec)
87
{
88
	char *new_line_char = one_liner ? " " : "\n        ";
89
90
	printf("%s", one_liner ? " " : "      ");
91
	printf("Account %s%s", used_limit->acct, new_line_char);
92
93
	printf("MaxJobsPA=");
94
	if (qos_rec->max_jobs_pa != INFINITE)
95
		printf("%u", qos_rec->max_jobs_pa);
96
	else
97
		printf("N");
98
	printf("(%u)%s", used_limit->jobs, new_line_char);
99
100
	printf("MaxSubmitJobsPA=");
101
	if (qos_rec->max_submit_jobs_pa != INFINITE)
102
		printf("%u", qos_rec->max_submit_jobs_pa);
103
	else
104
		printf("N");
105
	printf("(%u)%s", used_limit->submit_jobs, new_line_char);
106
107
	_print_tres_line("MaxTRESPA",
108
			 qos_rec->max_tres_pa_ctld,
109
			 used_limit->tres, 0, 1);
110
111
	/* MaxTRESRunMinsPA doesn't do anything yet, if/when it does
112
	 * change the last param in the print_tres_line to 0. */
113
114
	/* printf("%s", one_liner ? "" : "    "); */
115
	/* _print_tres_line("MaxTRESRunMinsPA", */
116
	/* 		 qos_rec->max_tres_run_mins_pa_ctld, */
117
	/* 		 used_limit->tres_run_mins, 60, 1); */
118
119
120
	return SLURM_SUCCESS;
121
}
122
123
static int _print_used_user_limit(slurmdb_used_limits_t *used_limit,
124
				  slurmdb_qos_rec_t *qos_rec)
125
{
126
	char *new_line_char = one_liner ? " " : "\n        ";
127
128
	printf("%s", one_liner ? " " : "      ");
129
	printf("User %d%s", used_limit->uid, new_line_char);
130
131
	printf("MaxJobsPU=");
132
	if (qos_rec->max_jobs_pu != INFINITE)
133
		printf("%u", qos_rec->max_jobs_pu);
134
	else
135
		printf("N");
136
	printf("(%u)%s", used_limit->jobs, new_line_char);
137
138
	printf("MaxSubmitJobsPU=");
139
	if (qos_rec->max_submit_jobs_pu != INFINITE)
140
		printf("%u", qos_rec->max_submit_jobs_pu);
141
	else
142
		printf("N");
143
	printf("(%u)%s", used_limit->submit_jobs, new_line_char);
144
145
	_print_tres_line("MaxTRESPU",
146
			 qos_rec->max_tres_pu_ctld,
147
			 used_limit->tres, 0, 1);
148
149
	/* MaxTRESRunMinsPU doesn't do anything yet, if/when it does
150
	 * change the last param in the print_tres_line to 0. */
151
152
	/* printf("%s", one_liner ? "" : "    "); */
153
	/* _print_tres_line("MaxTRESRunMinsPU", */
154
	/* 		 qos_rec->max_tres_run_mins_pu_ctld, */
155
	/* 		 used_limit->tres_run_mins, 60, 1); */
156
157
	return SLURM_SUCCESS;
158
}
159
85
static void _print_assoc_mgr_info(const char *name, assoc_mgr_info_msg_t *msg)
160
static void _print_assoc_mgr_info(const char *name, assoc_mgr_info_msg_t *msg)
86
{
161
{
87
	ListIterator itr;
162
	ListIterator itr;
Lines 316-335 static void _print_assoc_mgr_info(const char *name, assoc_mgr_info_msg_t *msg) Link Here
316
					 qos_rec->usage->
391
					 qos_rec->usage->
317
					 grp_used_tres_run_secs, 60, 0);
392
					 grp_used_tres_run_secs, 60, 0);
318
393
319
			if (qos_rec->max_jobs_pu != INFINITE)
320
				printf("MaxJobsPU=%u(%u) ",
321
				       qos_rec->max_jobs_pu,
322
				       qos_rec->usage->grp_used_jobs);
323
			else
324
				printf("MaxJobs= ");
325
326
			if (qos_rec->max_submit_jobs_pu != INFINITE)
327
				printf("MaxSubmitJobs=%u(%u) ",
328
				       qos_rec->max_submit_jobs_pu,
329
				       qos_rec->usage->grp_used_submit_jobs);
330
			else
331
				printf("MaxSubmitJobs= ");
332
333
			if (qos_rec->max_wall_pj != INFINITE)
394
			if (qos_rec->max_wall_pj != INFINITE)
334
				printf("MaxWallPJ=%u",
395
				printf("MaxWallPJ=%u",
335
				       qos_rec->max_wall_pj);
396
				       qos_rec->max_wall_pj);
Lines 347-368 static void _print_assoc_mgr_info(const char *name, assoc_mgr_info_msg_t *msg) Link Here
347
					 qos_rec->max_tres_pn_ctld,
408
					 qos_rec->max_tres_pn_ctld,
348
					 NULL, 0, 0);
409
					 NULL, 0, 0);
349
410
350
			_print_tres_line("MaxTRESPU",
351
					 qos_rec->max_tres_pu_ctld,
352
					 NULL, 0, 0);
353
354
			_print_tres_line("MaxTRESMinsPJ",
411
			_print_tres_line("MaxTRESMinsPJ",
355
					 qos_rec->max_tres_mins_pj_ctld,
412
					 qos_rec->max_tres_mins_pj_ctld,
356
					 NULL, 0, 0);
413
					 NULL, 0, 0);
357
414
358
			/* Doesn't do anything yet */
415
			/* Doesn't do anything yet */
416
			/* _print_tres_line("MaxTRESRunMinsPA", */
417
			/* 		 qos_rec->max_tres_mins_pa_ctld, */
418
			/* 		 NULL, 0); */
419
359
			/* _print_tres_line("MaxTRESRunMinsPU", */
420
			/* _print_tres_line("MaxTRESRunMinsPU", */
360
			/* 		 qos_rec->max_tres_mins_pu_ctld, */
421
			/* 		 qos_rec->max_tres_mins_pu_ctld, */
361
			/* 		 NULL, 0); */
422
			/* 		 NULL, 0); */
362
423
363
			_print_tres_line("MinTRESPJ",
424
			_print_tres_line("MinTRESPJ",
364
					 qos_rec->min_tres_pj_ctld,
425
					 qos_rec->min_tres_pj_ctld,
365
					 NULL, 0, 1);
426
					 NULL, 0,
427
					 (qos_rec->usage->acct_limit_list ||
428
					  qos_rec->usage->user_limit_list) ?
429
					 0 : 1);
430
431
			if (qos_rec->usage->acct_limit_list) {
432
				printf("Account Limits%s",
433
				       one_liner ? "" : "\n");
434
				list_for_each(qos_rec->usage->acct_limit_list,
435
					      (ListForF)_print_used_acct_limit,
436
					      qos_rec);
437
			}
438
			if (qos_rec->usage->user_limit_list) {
439
				printf("%sUser Limits%s",
440
				       one_liner ? "" : "    ",
441
				       one_liner ? "" : "\n");
442
				list_for_each(qos_rec->usage->user_limit_list,
443
					      (ListForF)_print_used_user_limit,
444
					      qos_rec);
445
			}
366
		}
446
		}
367
	}
447
	}
368
}
448
}
(-)a/src/slurmctld/acct_policy.c (-20 / +287 lines)
Lines 84-89 static int _get_tres_state_reason(int tres_pos, int unk_reason) Link Here
84
			return WAIT_QOS_MAX_CPU_PER_JOB;
84
			return WAIT_QOS_MAX_CPU_PER_JOB;
85
		case WAIT_QOS_MAX_UNK_PER_NODE:
85
		case WAIT_QOS_MAX_UNK_PER_NODE:
86
			return WAIT_QOS_MAX_CPU_PER_NODE;
86
			return WAIT_QOS_MAX_CPU_PER_NODE;
87
		case WAIT_QOS_MAX_UNK_PER_ACCT:
88
			return WAIT_QOS_MAX_CPU_PER_ACCT;
87
		case WAIT_QOS_MAX_UNK_PER_USER:
89
		case WAIT_QOS_MAX_UNK_PER_USER:
88
			return WAIT_QOS_MAX_CPU_PER_USER;
90
			return WAIT_QOS_MAX_CPU_PER_USER;
89
		case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
91
		case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
Lines 117-122 static int _get_tres_state_reason(int tres_pos, int unk_reason) Link Here
117
			return WAIT_QOS_MAX_MEM_PER_JOB;
119
			return WAIT_QOS_MAX_MEM_PER_JOB;
118
		case WAIT_QOS_MAX_UNK_PER_NODE:
120
		case WAIT_QOS_MAX_UNK_PER_NODE:
119
			return WAIT_QOS_MAX_MEM_PER_NODE;
121
			return WAIT_QOS_MAX_MEM_PER_NODE;
122
		case WAIT_QOS_MAX_UNK_PER_ACCT:
123
			return WAIT_QOS_MAX_MEM_PER_ACCT;
120
		case WAIT_QOS_MAX_UNK_PER_USER:
124
		case WAIT_QOS_MAX_UNK_PER_USER:
121
			return WAIT_QOS_MAX_MEM_PER_USER;
125
			return WAIT_QOS_MAX_MEM_PER_USER;
122
		case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
126
		case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
Lines 150-155 static int _get_tres_state_reason(int tres_pos, int unk_reason) Link Here
150
			return WAIT_QOS_MAX_ENERGY_PER_JOB;
154
			return WAIT_QOS_MAX_ENERGY_PER_JOB;
151
		case WAIT_QOS_MAX_UNK_PER_NODE:
155
		case WAIT_QOS_MAX_UNK_PER_NODE:
152
			return WAIT_QOS_MAX_ENERGY_PER_NODE;
156
			return WAIT_QOS_MAX_ENERGY_PER_NODE;
157
		case WAIT_QOS_MAX_UNK_PER_ACCT:
158
			return WAIT_QOS_MAX_ENERGY_PER_ACCT;
153
		case WAIT_QOS_MAX_UNK_PER_USER:
159
		case WAIT_QOS_MAX_UNK_PER_USER:
154
			return WAIT_QOS_MAX_ENERGY_PER_USER;
160
			return WAIT_QOS_MAX_ENERGY_PER_USER;
155
		case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
161
		case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
Lines 181-186 static int _get_tres_state_reason(int tres_pos, int unk_reason) Link Here
181
			return WAIT_QOS_GRP_NODE_RUN_MIN;
187
			return WAIT_QOS_GRP_NODE_RUN_MIN;
182
		case WAIT_QOS_MAX_UNK_PER_JOB:
188
		case WAIT_QOS_MAX_UNK_PER_JOB:
183
			return WAIT_QOS_MAX_NODE_PER_JOB;
189
			return WAIT_QOS_MAX_NODE_PER_JOB;
190
		case WAIT_QOS_MAX_UNK_PER_ACCT:
191
			return WAIT_QOS_MAX_NODE_PER_ACCT;
184
		case WAIT_QOS_MAX_UNK_PER_USER:
192
		case WAIT_QOS_MAX_UNK_PER_USER:
185
			return WAIT_QOS_MAX_NODE_PER_USER;
193
			return WAIT_QOS_MAX_NODE_PER_USER;
186
		case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
194
		case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
Lines 215-220 static int _get_tres_state_reason(int tres_pos, int unk_reason) Link Here
215
				return WAIT_QOS_MAX_GRES_PER_JOB;
223
				return WAIT_QOS_MAX_GRES_PER_JOB;
216
			case WAIT_QOS_MAX_UNK_PER_NODE:
224
			case WAIT_QOS_MAX_UNK_PER_NODE:
217
				return WAIT_QOS_MAX_GRES_PER_NODE;
225
				return WAIT_QOS_MAX_GRES_PER_NODE;
226
			case WAIT_QOS_MAX_UNK_PER_ACCT:
227
				return WAIT_QOS_MAX_GRES_PER_ACCT;
218
			case WAIT_QOS_MAX_UNK_PER_USER:
228
			case WAIT_QOS_MAX_UNK_PER_USER:
219
				return WAIT_QOS_MAX_GRES_PER_USER;
229
				return WAIT_QOS_MAX_GRES_PER_USER;
220
			case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
230
			case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
Lines 246-251 static int _get_tres_state_reason(int tres_pos, int unk_reason) Link Here
246
				return WAIT_QOS_GRP_LIC_RUN_MIN;
256
				return WAIT_QOS_GRP_LIC_RUN_MIN;
247
			case WAIT_QOS_MAX_UNK_PER_JOB:
257
			case WAIT_QOS_MAX_UNK_PER_JOB:
248
				return WAIT_QOS_MAX_LIC_PER_JOB;
258
				return WAIT_QOS_MAX_LIC_PER_JOB;
259
			case WAIT_QOS_MAX_UNK_PER_ACCT:
260
				return WAIT_QOS_MAX_LIC_PER_ACCT;
249
			case WAIT_QOS_MAX_UNK_PER_USER:
261
			case WAIT_QOS_MAX_UNK_PER_USER:
250
				return WAIT_QOS_MAX_LIC_PER_USER;
262
				return WAIT_QOS_MAX_LIC_PER_USER;
251
			case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
263
			case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
Lines 278-283 static int _get_tres_state_reason(int tres_pos, int unk_reason) Link Here
278
				return WAIT_QOS_MAX_BB_PER_JOB;
290
				return WAIT_QOS_MAX_BB_PER_JOB;
279
			case WAIT_QOS_MAX_UNK_PER_NODE:
291
			case WAIT_QOS_MAX_UNK_PER_NODE:
280
				return WAIT_QOS_MAX_BB_PER_NODE;
292
				return WAIT_QOS_MAX_BB_PER_NODE;
293
			case WAIT_QOS_MAX_UNK_PER_ACCT:
294
				return WAIT_QOS_MAX_BB_PER_ACCT;
281
			case WAIT_QOS_MAX_UNK_PER_USER:
295
			case WAIT_QOS_MAX_UNK_PER_USER:
282
				return WAIT_QOS_MAX_BB_PER_USER;
296
				return WAIT_QOS_MAX_BB_PER_USER;
283
			case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
297
			case WAIT_QOS_MAX_UNK_MINS_PER_JOB:
Lines 333-338 static void _set_qos_order(struct job_record *job_ptr, Link Here
333
	return;
347
	return;
334
}
348
}
335
349
350
static int _find_used_limits_for_acct(void *x, void *key)
351
{
352
	slurmdb_used_limits_t *used_limits = (slurmdb_used_limits_t *)x;
353
	char *account = (char *)key;
354
355
	if (!xstrcmp(account, used_limits->acct))
356
		return 1;
357
358
	return 0;
359
}
360
336
static int _find_used_limits_for_user(void *x, void *key)
361
static int _find_used_limits_for_user(void *x, void *key)
337
{
362
{
338
	slurmdb_used_limits_t *used_limits = (slurmdb_used_limits_t *)x;
363
	slurmdb_used_limits_t *used_limits = (slurmdb_used_limits_t *)x;
Lines 379-390 static void _qos_adjust_limit_usage(int type, struct job_record *job_ptr, Link Here
379
				    uint64_t *used_tres_run_secs,
404
				    uint64_t *used_tres_run_secs,
380
				    uint32_t job_cnt)
405
				    uint32_t job_cnt)
381
{
406
{
382
	slurmdb_used_limits_t *used_limits = NULL;
407
	slurmdb_used_limits_t *used_limits = NULL, *used_limits_a = NULL;
408
	slurmdb_assoc_rec_t *assoc_ptr = job_ptr->assoc_ptr;
383
	int i;
409
	int i;
384
410
385
	if (!qos_ptr)
411
	if (!qos_ptr || !assoc_ptr)
386
		return;
412
		return;
387
413
414
	if (!qos_ptr->usage->acct_limit_list)
415
		qos_ptr->usage->acct_limit_list =
416
			list_create(slurmdb_destroy_used_limits);
417
418
	if (!(used_limits_a = list_find_first(qos_ptr->usage->acct_limit_list,
419
					    _find_used_limits_for_acct,
420
					    assoc_ptr->acct))) {
421
		used_limits_a = xmalloc(sizeof(slurmdb_used_limits_t));
422
		used_limits_a->acct = xstrdup(assoc_ptr->acct);
423
424
		i = sizeof(uint64_t) * slurmctld_tres_cnt;
425
		used_limits_a->tres = xmalloc(i);
426
		used_limits_a->tres_run_mins = xmalloc(i);
427
428
		list_append(qos_ptr->usage->acct_limit_list, used_limits_a);
429
	}
430
388
	if (!qos_ptr->usage->user_limit_list)
431
	if (!qos_ptr->usage->user_limit_list)
389
		qos_ptr->usage->user_limit_list =
432
		qos_ptr->usage->user_limit_list =
390
			list_create(slurmdb_destroy_used_limits);
433
			list_create(slurmdb_destroy_used_limits);
Lines 405-410 static void _qos_adjust_limit_usage(int type, struct job_record *job_ptr, Link Here
405
	case ACCT_POLICY_ADD_SUBMIT:
448
	case ACCT_POLICY_ADD_SUBMIT:
406
		qos_ptr->usage->grp_used_submit_jobs += job_cnt;
449
		qos_ptr->usage->grp_used_submit_jobs += job_cnt;
407
		used_limits->submit_jobs += job_cnt;
450
		used_limits->submit_jobs += job_cnt;
451
		used_limits_a->submit_jobs += job_cnt;
408
		break;
452
		break;
409
	case ACCT_POLICY_REM_SUBMIT:
453
	case ACCT_POLICY_REM_SUBMIT:
410
		if (qos_ptr->usage->grp_used_submit_jobs)
454
		if (qos_ptr->usage->grp_used_submit_jobs)
Lines 421-431 static void _qos_adjust_limit_usage(int type, struct job_record *job_ptr, Link Here
421
			       "used_submit_jobs underflow for "
465
			       "used_submit_jobs underflow for "
422
			       "qos %s user %d",
466
			       "qos %s user %d",
423
			       qos_ptr->name, used_limits->uid);
467
			       qos_ptr->name, used_limits->uid);
468
469
		if (used_limits_a->submit_jobs)
470
			used_limits_a->submit_jobs -= job_cnt;
471
		else
472
			debug2("acct_policy_remove_job_submit: "
473
			       "used_submit_jobs underflow for "
474
			       "qos %s account %s",
475
			       qos_ptr->name, used_limits_a->acct);
424
		break;
476
		break;
425
	case ACCT_POLICY_JOB_BEGIN:
477
	case ACCT_POLICY_JOB_BEGIN:
426
		qos_ptr->usage->grp_used_jobs++;
478
		qos_ptr->usage->grp_used_jobs++;
427
		for (i=0; i<slurmctld_tres_cnt; i++) {
479
		for (i=0; i<slurmctld_tres_cnt; i++) {
428
			used_limits->tres[i] += job_ptr->tres_alloc_cnt[i];
480
			used_limits->tres[i] += job_ptr->tres_alloc_cnt[i];
481
			used_limits_a->tres[i] += job_ptr->tres_alloc_cnt[i];
429
482
430
			qos_ptr->usage->grp_used_tres[i] +=
483
			qos_ptr->usage->grp_used_tres[i] +=
431
				job_ptr->tres_alloc_cnt[i];
484
				job_ptr->tres_alloc_cnt[i];
Lines 442-447 static void _qos_adjust_limit_usage(int type, struct job_record *job_ptr, Link Here
442
		}
495
		}
443
496
444
		used_limits->jobs++;
497
		used_limits->jobs++;
498
		used_limits_a->jobs++;
445
		break;
499
		break;
446
	case ACCT_POLICY_JOB_FINI:
500
	case ACCT_POLICY_JOB_FINI:
447
		qos_ptr->usage->grp_used_jobs--;
501
		qos_ptr->usage->grp_used_jobs--;
Lines 474-488 static void _qos_adjust_limit_usage(int type, struct job_record *job_ptr, Link Here
474
			} else
528
			} else
475
				used_limits->tres[i] -=
529
				used_limits->tres[i] -=
476
					job_ptr->tres_alloc_cnt[i];
530
					job_ptr->tres_alloc_cnt[i];
531
532
			if (job_ptr->tres_alloc_cnt[i] >
533
			    used_limits_a->tres[i]) {
534
				used_limits_a->tres[i] = 0;
535
				debug2("acct_policy_job_fini: "
536
				       "used_limits->tres(%s) "
537
				       "underflow for qos %s account %s",
538
				       assoc_mgr_tres_name_array[i],
539
				       qos_ptr->name, used_limits_a->acct);
540
			} else
541
				used_limits_a->tres[i] -=
542
					job_ptr->tres_alloc_cnt[i];
477
		}
543
		}
478
544
479
		used_limits->jobs--;
545
		if (used_limits->jobs)
480
		if ((int32_t)used_limits->jobs < 0) {
546
			used_limits->jobs--;
481
			used_limits->jobs = 0;
547
		else
482
			debug2("acct_policy_job_fini: used_jobs "
548
			debug2("acct_policy_job_fini: used_jobs "
483
			       "underflow for qos %s user %d",
549
			       "underflow for qos %s user %d",
484
			       qos_ptr->name, used_limits->uid);
550
			       qos_ptr->name, used_limits->uid);
485
		}
551
552
		if (used_limits_a->jobs)
553
			used_limits_a->jobs--;
554
		else
555
			debug2("acct_policy_job_fini: used_jobs "
556
			       "underflow for qos %s account %s",
557
			       qos_ptr->name, used_limits_a->acct);
486
558
487
		break;
559
		break;
488
	default:
560
	default:
Lines 963-968 static int _validate_tres_usage_limits_for_qos( Link Here
963
}
1035
}
964
1036
965
static int _qos_policy_validate(job_desc_msg_t *job_desc,
1037
static int _qos_policy_validate(job_desc_msg_t *job_desc,
1038
				slurmdb_assoc_rec_t *assoc_ptr,
966
				struct part_record *part_ptr,
1039
				struct part_record *part_ptr,
967
				slurmdb_qos_rec_t *qos_ptr,
1040
				slurmdb_qos_rec_t *qos_ptr,
968
				slurmdb_qos_rec_t *qos_out_ptr,
1041
				slurmdb_qos_rec_t *qos_out_ptr,
Lines 985-990 static int _qos_policy_validate(job_desc_msg_t *job_desc, Link Here
985
1058
986
	if (!_validate_tres_limits_for_qos(&tres_pos,
1059
	if (!_validate_tres_limits_for_qos(&tres_pos,
987
					   job_desc->tres_req_cnt, 0,
1060
					   job_desc->tres_req_cnt, 0,
1061
					   NULL,
1062
					   qos_ptr->max_tres_pa_ctld,
1063
					   NULL,
1064
					   qos_out_ptr->max_tres_pa_ctld,
1065
					   acct_policy_limit_set->tres,
1066
					   strict_checking, 1)) {
1067
		if (job_desc->tres_req_cnt[tres_pos] >
1068
		    qos_ptr->max_tres_pa_ctld[tres_pos]) {
1069
			if (reason)
1070
				*reason = _get_tres_state_reason(
1071
					tres_pos, WAIT_QOS_MAX_UNK_PER_ACCT);
1072
1073
			debug2("job submit for user %s(%u): "
1074
			       "min tres(%s) request %"PRIu64" exceeds "
1075
			       "per-acct max tres limit %"PRIu64" for qos '%s'",
1076
			       user_name,
1077
			       job_desc->user_id,
1078
			       assoc_mgr_tres_name_array[tres_pos],
1079
			       job_desc->tres_req_cnt[tres_pos],
1080
			       qos_ptr->max_tres_pa_ctld[tres_pos],
1081
			       qos_ptr->name);
1082
			rc = false;
1083
			goto end_it;
1084
		}
1085
	}
1086
1087
	if (!_validate_tres_limits_for_qos(&tres_pos,
1088
					   job_desc->tres_req_cnt, 0,
988
					   qos_ptr->grp_tres_ctld,
1089
					   qos_ptr->grp_tres_ctld,
989
					   qos_ptr->max_tres_pu_ctld,
1090
					   qos_ptr->max_tres_pu_ctld,
990
					   qos_out_ptr->grp_tres_ctld,
1091
					   qos_out_ptr->grp_tres_ctld,
Lines 1190-1195 static int _qos_policy_validate(job_desc_msg_t *job_desc, Link Here
1190
	 * qos_ptr->max_jobs.
1291
	 * qos_ptr->max_jobs.
1191
	 */
1292
	 */
1192
1293
1294
	if ((qos_out_ptr->max_submit_jobs_pa == INFINITE) &&
1295
	    (qos_ptr->max_submit_jobs_pa != INFINITE)) {
1296
		slurmdb_used_limits_t *used_limits = NULL;
1297
1298
		if (qos_ptr->usage->user_limit_list)
1299
			used_limits = list_find_first(
1300
				qos_ptr->usage->acct_limit_list,
1301
				_find_used_limits_for_acct,
1302
				assoc_ptr->acct);
1303
1304
		qos_out_ptr->max_submit_jobs_pa = qos_ptr->max_submit_jobs_pa;
1305
1306
		if ((!used_limits &&
1307
		     qos_ptr->max_submit_jobs_pa == 0) ||
1308
		    (used_limits &&
1309
		     ((used_limits->submit_jobs + job_cnt) >
1310
		      qos_ptr->max_submit_jobs_pa))) {
1311
			if (reason)
1312
				*reason = WAIT_QOS_MAX_SUB_JOB_PER_ACCT;
1313
			debug2("job submit for account %s: "
1314
			       "qos max submit job limit exceeded %u",
1315
			       assoc_ptr->acct,
1316
			       qos_ptr->max_submit_jobs_pa);
1317
			rc = false;
1318
			goto end_it;
1319
		}
1320
	}
1321
1193
	if ((qos_out_ptr->max_submit_jobs_pu == INFINITE) &&
1322
	if ((qos_out_ptr->max_submit_jobs_pu == INFINITE) &&
1194
	    (qos_ptr->max_submit_jobs_pu != INFINITE)) {
1323
	    (qos_ptr->max_submit_jobs_pu != INFINITE)) {
1195
		slurmdb_used_limits_t *used_limits = NULL;
1324
		slurmdb_used_limits_t *used_limits = NULL;
Lines 1249-1265 end_it: Link Here
1249
}
1378
}
1250
1379
1251
static int _qos_job_runnable_pre_select(struct job_record *job_ptr,
1380
static int _qos_job_runnable_pre_select(struct job_record *job_ptr,
1252
					 slurmdb_qos_rec_t *qos_ptr,
1381
					slurmdb_qos_rec_t *qos_ptr,
1253
					 slurmdb_qos_rec_t *qos_out_ptr)
1382
					slurmdb_qos_rec_t *qos_out_ptr)
1254
{
1383
{
1255
	uint32_t wall_mins;
1384
	uint32_t wall_mins;
1256
	uint32_t time_limit = NO_VAL;
1385
	uint32_t time_limit = NO_VAL;
1257
	int rc = true;
1386
	int rc = true;
1258
	slurmdb_used_limits_t *used_limits = NULL;
1387
	slurmdb_used_limits_t *used_limits = NULL, *used_limits_a = NULL;
1259
	bool free_used_limits = false;
1388
	bool free_used_limits = false, free_used_limits_a = false;
1260
	bool safe_limits = false;
1389
	bool safe_limits = false;
1390
	slurmdb_assoc_rec_t *assoc_ptr = job_ptr->assoc_ptr;
1261
1391
1262
	if (!qos_ptr || !qos_out_ptr)
1392
	if (!qos_ptr || !qos_out_ptr || !assoc_ptr)
1263
		return rc;
1393
		return rc;
1264
1394
1265
	/* check to see if we should be using safe limits, if so we
1395
	/* check to see if we should be using safe limits, if so we
Lines 1271-1276 static int _qos_job_runnable_pre_select(struct job_record *job_ptr, Link Here
1271
	wall_mins = qos_ptr->usage->grp_used_wall / 60;
1401
	wall_mins = qos_ptr->usage->grp_used_wall / 60;
1272
1402
1273
	/*
1403
	/*
1404
	 * Try to get the used limits for the account or initialise a local
1405
	 * nullified one if not available.
1406
	 */
1407
	if (!qos_ptr->usage->acct_limit_list ||
1408
	    !(used_limits_a = list_find_first(qos_ptr->usage->acct_limit_list,
1409
					      _find_used_limits_for_acct,
1410
					      assoc_ptr->acct))) {
1411
		used_limits_a = xmalloc(sizeof(slurmdb_used_limits_t));
1412
		used_limits_a->acct = assoc_ptr->acct; /* Just point to
1413
							  it, don't copy. */
1414
		free_used_limits_a = true;
1415
	}
1416
1417
	/*
1274
	 * Try to get the used limits for the user or initialise a local
1418
	 * Try to get the used limits for the user or initialise a local
1275
	 * nullified one if not available.
1419
	 * nullified one if not available.
1276
	 */
1420
	 */
Lines 1364-1371 static int _qos_job_runnable_pre_select(struct job_record *job_ptr, Link Here
1364
1508
1365
	/* we don't need to check min_tres_pj here */
1509
	/* we don't need to check min_tres_pj here */
1366
1510
1511
	/* we don't need to check max_tres_pa here */
1512
1367
	/* we don't need to check max_tres_pu here */
1513
	/* we don't need to check max_tres_pu here */
1368
1514
1515
	if ((qos_out_ptr->max_jobs_pa == INFINITE)
1516
	    && (qos_ptr->max_jobs_pa != INFINITE)) {
1517
1518
		qos_out_ptr->max_jobs_pa = qos_ptr->max_jobs_pa;
1519
1520
		if (used_limits_a->jobs >= qos_ptr->max_jobs_pa) {
1521
			xfree(job_ptr->state_desc);
1522
			job_ptr->state_reason =
1523
				WAIT_QOS_MAX_JOB_PER_ACCT;
1524
			debug2("job %u being held, "
1525
			       "the job is at or exceeds "
1526
			       "max jobs per-acct (%s) limit "
1527
			       "%u with %u for QOS %s",
1528
			       job_ptr->job_id,
1529
			       used_limits_a->acct,
1530
			       qos_ptr->max_jobs_pa,
1531
			       used_limits_a->jobs, qos_ptr->name);
1532
			rc = false;
1533
			goto end_it;
1534
		}
1535
	}
1536
1369
	if ((qos_out_ptr->max_jobs_pu == INFINITE)
1537
	if ((qos_out_ptr->max_jobs_pu == INFINITE)
1370
	    && (qos_ptr->max_jobs_pu != INFINITE)) {
1538
	    && (qos_ptr->max_jobs_pu != INFINITE)) {
1371
1539
Lines 1387-1392 static int _qos_job_runnable_pre_select(struct job_record *job_ptr, Link Here
1387
		}
1555
		}
1388
	}
1556
	}
1389
1557
1558
	/* we don't need to check submit_jobs_pa here */
1559
1390
	/* we don't need to check submit_jobs_pu here */
1560
	/* we don't need to check submit_jobs_pu here */
1391
1561
1392
	/* if the qos limits have changed since job
1562
	/* if the qos limits have changed since job
Lines 1423-1428 end_it: Link Here
1423
	if (free_used_limits)
1593
	if (free_used_limits)
1424
		xfree(used_limits);
1594
		xfree(used_limits);
1425
1595
1596
	if (free_used_limits_a)
1597
		xfree(used_limits_a);
1598
1426
	return rc;
1599
	return rc;
1427
}
1600
}
1428
1601
Lines 1434-1446 static int _qos_job_runnable_post_select(struct job_record *job_ptr, Link Here
1434
{
1607
{
1435
	uint64_t tres_usage_mins[slurmctld_tres_cnt];
1608
	uint64_t tres_usage_mins[slurmctld_tres_cnt];
1436
	uint64_t tres_run_mins[slurmctld_tres_cnt];
1609
	uint64_t tres_run_mins[slurmctld_tres_cnt];
1437
	slurmdb_used_limits_t *used_limits = NULL;
1610
	slurmdb_used_limits_t *used_limits = NULL, *used_limits_a = NULL;
1438
	bool free_used_limits = false;
1611
	bool free_used_limits = false, free_used_limits_a = false;
1439
	bool safe_limits = false;
1612
	bool safe_limits = false;
1440
	int rc = true;
1613
	int rc = true;
1441
	int i, tres_pos = 0;
1614
	int i, tres_pos = 0;
1615
	slurmdb_assoc_rec_t *assoc_ptr = job_ptr->assoc_ptr;
1442
1616
1443
	if (!qos_ptr || !qos_out_ptr)
1617
	if (!qos_ptr || !qos_out_ptr || !assoc_ptr)
1444
		return rc;
1618
		return rc;
1445
1619
1446
	/* check to see if we should be using safe limits, if so we
1620
	/* check to see if we should be using safe limits, if so we
Lines 1460-1465 static int _qos_job_runnable_post_select(struct job_record *job_ptr, Link Here
1460
	}
1634
	}
1461
1635
1462
	/*
1636
	/*
1637
	 * Try to get the used limits for the account or initialise a local
1638
	 * nullified one if not available.
1639
	 */
1640
	if (!qos_ptr->usage->acct_limit_list ||
1641
	    !(used_limits_a = list_find_first(qos_ptr->usage->acct_limit_list,
1642
					      _find_used_limits_for_acct,
1643
					      assoc_ptr->acct))) {
1644
		used_limits_a = xmalloc(sizeof(slurmdb_used_limits_t));
1645
		used_limits_a->acct = assoc_ptr->acct; /* Just point to
1646
							  it, don't copy. */
1647
		free_used_limits_a = true;
1648
	}
1649
1650
1651
	/*
1463
	 * Try to get the used limits for the user or initialize a local
1652
	 * Try to get the used limits for the user or initialize a local
1464
	 * nullified one if not available.
1653
	 * nullified one if not available.
1465
	 */
1654
	 */
Lines 1750-1755 static int _qos_job_runnable_post_select(struct job_record *job_ptr, Link Here
1750
1939
1751
	i = _validate_tres_usage_limits_for_qos(
1940
	i = _validate_tres_usage_limits_for_qos(
1752
		&tres_pos,
1941
		&tres_pos,
1942
		qos_ptr->max_tres_pa_ctld, qos_out_ptr->max_tres_pa_ctld,
1943
		tres_req_cnt, used_limits_a->tres,
1944
		NULL, job_ptr->limit_set.tres, 1);
1945
	switch (i) {
1946
	case 1:
1947
		/* not possible because the curr_usage sent in is NULL */
1948
		break;
1949
	case 2:
1950
		/* Hold the job if it exceeds the per-acct
1951
		 * TRES limit for the given QOS
1952
		 */
1953
		xfree(job_ptr->state_desc);
1954
		job_ptr->state_reason = _get_tres_state_reason(
1955
			tres_pos, WAIT_QOS_MAX_UNK_PER_ACCT);
1956
		debug2("job %u is being held, "
1957
		       "QOS %s min tres(%s) "
1958
		       "request %"PRIu64" exceeds "
1959
		       "max tres per account (%s) limit %"PRIu64,
1960
		       job_ptr->job_id,
1961
		       qos_ptr->name,
1962
		       assoc_mgr_tres_name_array[tres_pos],
1963
		       tres_req_cnt[tres_pos],
1964
		       used_limits_a->acct,
1965
		       qos_ptr->max_tres_pa_ctld[tres_pos]);
1966
		rc = false;
1967
		goto end_it;
1968
		break;
1969
	case 3:
1970
		/* Hold the job if the user has exceeded
1971
		 * the QOS per-user TRES limit with their
1972
		 * current usage */
1973
		xfree(job_ptr->state_desc);
1974
		job_ptr->state_reason = _get_tres_state_reason(
1975
			tres_pos, WAIT_QOS_MAX_UNK_PER_ACCT);
1976
		debug2("job %u being held, "
1977
		       "if allowed the job request will exceed "
1978
		       "QOS %s max tres(%s) per account (%s) limit "
1979
		       "%"PRIu64" with already used %"PRIu64" + "
1980
		       "requested %"PRIu64,
1981
		       job_ptr->job_id,
1982
		       qos_ptr->name,
1983
		       assoc_mgr_tres_name_array[tres_pos],
1984
		       used_limits_a->acct,
1985
		       qos_ptr->max_tres_pa_ctld[tres_pos],
1986
		       used_limits_a->tres[tres_pos],
1987
		       tres_req_cnt[tres_pos]);
1988
		rc = false;
1989
		goto end_it;
1990
	default:
1991
		/* all good */
1992
		break;
1993
	}
1994
1995
	i = _validate_tres_usage_limits_for_qos(
1996
		&tres_pos,
1753
		qos_ptr->max_tres_pu_ctld, qos_out_ptr->max_tres_pu_ctld,
1997
		qos_ptr->max_tres_pu_ctld, qos_out_ptr->max_tres_pu_ctld,
1754
		tres_req_cnt, used_limits->tres,
1998
		tres_req_cnt, used_limits->tres,
1755
		NULL, job_ptr->limit_set.tres, 1);
1999
		NULL, job_ptr->limit_set.tres, 1);
Lines 1801-1809 static int _qos_job_runnable_post_select(struct job_record *job_ptr, Link Here
1801
		break;
2045
		break;
1802
	}
2046
	}
1803
2047
2048
	/* We do not need to check max_jobs_pa here */
2049
1804
	/* We do not need to check max_jobs_pu here */
2050
	/* We do not need to check max_jobs_pu here */
1805
2051
1806
end_it:
2052
end_it:
2053
	/* we don't need to check submit_jobs_pa here */
2054
1807
	/* we don't need to check submit_jobs_pu here */
2055
	/* we don't need to check submit_jobs_pu here */
1808
2056
1809
	/* we don't need to check max_wall_pj here */
2057
	/* we don't need to check max_wall_pj here */
Lines 1811-1816 end_it: Link Here
1811
	if (free_used_limits)
2059
	if (free_used_limits)
1812
		xfree(used_limits);
2060
		xfree(used_limits);
1813
2061
2062
	if (free_used_limits_a)
2063
		xfree(used_limits_a);
2064
1814
	return rc;
2065
	return rc;
1815
}
2066
}
1816
2067
Lines 2079-2090 extern bool acct_policy_validate(job_desc_msg_t *job_desc, Link Here
2079
				qos_ptr_2->flags & QOS_FLAG_DENY_LIMIT;
2330
				qos_ptr_2->flags & QOS_FLAG_DENY_LIMIT;
2080
2331
2081
		if (!(rc = _qos_policy_validate(
2332
		if (!(rc = _qos_policy_validate(
2082
			      job_desc, part_ptr, qos_ptr_1, &qos_rec,
2333
			      job_desc, assoc_ptr, part_ptr,
2334
			      qos_ptr_1, &qos_rec,
2083
			      reason, acct_policy_limit_set, update_call,
2335
			      reason, acct_policy_limit_set, update_call,
2084
			      user_name, job_cnt, strict_checking)))
2336
			      user_name, job_cnt, strict_checking)))
2085
			goto end_it;
2337
			goto end_it;
2086
		if (!(rc = _qos_policy_validate(
2338
		if (!(rc = _qos_policy_validate(
2087
			      job_desc, part_ptr, qos_ptr_2, &qos_rec,
2339
			      job_desc, assoc_ptr,
2340
			      part_ptr, qos_ptr_2, &qos_rec,
2088
			      reason, acct_policy_limit_set, update_call,
2341
			      reason, acct_policy_limit_set, update_call,
2089
			      user_name, job_cnt, strict_checking)))
2342
			      user_name, job_cnt, strict_checking)))
2090
			goto end_it;
2343
			goto end_it;
Lines 2217-2223 extern bool acct_policy_validate(job_desc_msg_t *job_desc, Link Here
2217
		 * assoc_ptr->max_jobs.
2470
		 * assoc_ptr->max_jobs.
2218
		 */
2471
		 */
2219
2472
2220
		if ((qos_rec.max_submit_jobs_pu == INFINITE) &&
2473
		if ((qos_rec.max_submit_jobs_pa == INFINITE) &&
2474
		    (qos_rec.max_submit_jobs_pu == INFINITE) &&
2221
		    (assoc_ptr->max_submit_jobs != INFINITE) &&
2475
		    (assoc_ptr->max_submit_jobs != INFINITE) &&
2222
		    ((assoc_ptr->usage->used_submit_jobs + job_cnt)
2476
		    ((assoc_ptr->usage->used_submit_jobs + job_cnt)
2223
		     > assoc_ptr->max_submit_jobs)) {
2477
		     > assoc_ptr->max_submit_jobs)) {
Lines 2457-2463 extern bool acct_policy_job_runnable_pre_select(struct job_record *job_ptr) Link Here
2457
2711
2458
		/* we don't need to check max_cpus_pj here */
2712
		/* we don't need to check max_cpus_pj here */
2459
2713
2460
		if ((qos_rec.max_jobs_pu == INFINITE) &&
2714
		if ((qos_rec.max_jobs_pa == INFINITE) &&
2715
		    (qos_rec.max_jobs_pu == INFINITE) &&
2461
		    (assoc_ptr->max_jobs != INFINITE) &&
2716
		    (assoc_ptr->max_jobs != INFINITE) &&
2462
		    (assoc_ptr->usage->used_jobs >= assoc_ptr->max_jobs)) {
2717
		    (assoc_ptr->usage->used_jobs >= assoc_ptr->max_jobs)) {
2463
			xfree(job_ptr->state_desc);
2718
			xfree(job_ptr->state_desc);
Lines 2926-2935 extern uint32_t acct_policy_get_max_nodes(struct job_record *job_ptr, Link Here
2926
			qos_ptr_1->max_tres_pj_ctld[TRES_ARRAY_NODE];
3181
			qos_ptr_1->max_tres_pj_ctld[TRES_ARRAY_NODE];
2927
		uint64_t max_nodes_pu =
3182
		uint64_t max_nodes_pu =
2928
			qos_ptr_1->max_tres_pu_ctld[TRES_ARRAY_NODE];
3183
			qos_ptr_1->max_tres_pu_ctld[TRES_ARRAY_NODE];
3184
		uint64_t max_nodes_pa =
3185
			qos_ptr_1->max_tres_pa_ctld[TRES_ARRAY_NODE];
2929
3186
2930
		grp_nodes = qos_ptr_1->grp_tres_ctld[TRES_ARRAY_NODE];
3187
		grp_nodes = qos_ptr_1->grp_tres_ctld[TRES_ARRAY_NODE];
2931
3188
2932
		if (qos_ptr_2) {
3189
		if (qos_ptr_2) {
3190
			if (max_nodes_pa == INFINITE64)
3191
				max_nodes_pa = qos_ptr_2->max_tres_pa_ctld[
3192
					TRES_ARRAY_NODE];
2933
			if (max_nodes_pj == INFINITE64)
3193
			if (max_nodes_pj == INFINITE64)
2934
				max_nodes_pj = qos_ptr_2->max_tres_pj_ctld[
3194
				max_nodes_pj = qos_ptr_2->max_tres_pj_ctld[
2935
					TRES_ARRAY_NODE];
3195
					TRES_ARRAY_NODE];
Lines 2941-2950 extern uint32_t acct_policy_get_max_nodes(struct job_record *job_ptr, Link Here
2941
					TRES_ARRAY_NODE];
3201
					TRES_ARRAY_NODE];
2942
		}
3202
		}
2943
3203
2944
		if (max_nodes_pj < max_nodes_pu) {
3204
		if (max_nodes_pa < max_nodes_limit) {
3205
			max_nodes_limit = max_nodes_pa;
3206
			*wait_reason = WAIT_QOS_MAX_NODE_PER_ACCT;
3207
		}
3208
3209
		if (max_nodes_pj < max_nodes_limit) {
2945
			max_nodes_limit = max_nodes_pj;
3210
			max_nodes_limit = max_nodes_pj;
2946
			*wait_reason = WAIT_QOS_MAX_NODE_PER_JOB;
3211
			*wait_reason = WAIT_QOS_MAX_NODE_PER_JOB;
2947
		} else if (max_nodes_pu != INFINITE64) {
3212
		}
3213
3214
		if (max_nodes_pu < max_nodes_limit) {
2948
			max_nodes_limit = max_nodes_pu;
3215
			max_nodes_limit = max_nodes_pu;
2949
			*wait_reason = WAIT_QOS_MAX_NODE_PER_USER;
3216
			*wait_reason = WAIT_QOS_MAX_NODE_PER_USER;
2950
		}
3217
		}

Return to ticket 2242