support limit

This commit is contained in:
Rongsong Shen 2026-01-12 15:20:51 +08:00
parent bef32ace38
commit ecf1916d78
33 changed files with 3036 additions and 243 deletions

View file

@ -8,11 +8,21 @@
#include "kvmgr.h"
#include "typemap.h"
#include "xce/types.h"
#include "xlist.h"
#include "zarray.h"
/* FIXME: improve later */
typedef void* host_selection_t;
typedef struct {
int nres_shared;
int* idxs_shared;
float* vals_shared;
int nres_host;
int* idxs_host;
float* vals_host;
} xce_sched_alloc_req_t;
typedef enum {
RESREQ_OP_SIMPLE
= 0, /* simple just a list of resources and require values */
@ -25,13 +35,14 @@ typedef enum {
/* simple resource allocation just have numeric resource values */
typedef struct {
host_selection_t* selection;
int nres_shared;
int* idxs_shared;
float* vals_shared;
int nres_host;
int* idxs_host;
float* vals_host;
char* res;
float value;
} request_res_t;
typedef struct {
host_selection_t selection;
xlist_t res_shared;
xlist_t res_host;
} resreq_simple_t;
typedef struct {
@ -65,7 +76,6 @@ typedef struct {
time_t queue_time;
time_t start_time;
unsigned int state;
unsigned int starting : 1;
int32_t priority;
xce_sched_queue_t* queue;
xce_sched_user_t* user;
@ -84,6 +94,24 @@ typedef struct {
zarray_t resInUse;
} xce_sched_worker_t;
typedef struct {
xce_sched_job_t* job;
xce_sched_worker_t* worker;
resreq_t* resreq;
xce_job_alloc_t* alloc;
xce_pendreason_t* reason;
xlist_t extra_res_requests;
xlist_t extra_host_res_requests;
xlist_t limits; /* non per host limits */
xlist_t limits_host; /* PER HOST limits */
xce_sched_alloc_req_t alloc_req;
} xce_sched_ctx_t;
typedef struct {
void* id;
xlist_t members;
} xce_worker_group_t;
extern xce_sched_job_t* make_sched_job(void*, xce_job_t*);
extern xce_sched_queue_t* make_sched_queue(void*, xce_queue_t*);
extern xce_sched_worker_t* make_sched_worker(void*, xce_worker_t*);