- make new scheduler work for sequence jobs

This commit is contained in:
Rongsong Shen 2026-02-12 11:19:47 +08:00
parent e7ab1c16db
commit 6cf9aa0979
10 changed files with 461 additions and 319 deletions

View file

@ -7,6 +7,7 @@
#include "decision.h"
#include "sched/types.h"
#include "resreq.h"
typedef void* plugin_data_t;
@ -18,7 +19,7 @@ typedef int (*plugin_update_worker_hook_t)(void*, xce_sched_worker_t*);
typedef int (*plugin_job_state_change_hook_t)(void*, xce_sched_job_t*,
uint32_t);
typedef int (*plugin_commit_decision_hook_t)(void*, xce_decision_t*);
typedef int (*plugin_job_election_hook_t)(void*, xce_sched_ctx_t*);
typedef int (*plugin_job_election_hook_t)(void*, xce_sched_job_t*);
typedef int (*plugin_prepare_allocation_hook_t)(void*, xce_sched_ctx_t*);
/* initialize function of plugin */
@ -74,7 +75,7 @@ extern int plugin_begin_session(void*);
extern int plugin_end_session(void*);
extern int plugin_commit_decision(void*, xce_decision_t*);
extern int plugin_prepare_allocation(void*, xce_sched_ctx_t*);
extern int plugin_job_election(void*, xce_sched_ctx_t*);
extern int plugin_job_election(void*, xce_sched_job_t*);
extern int register_fcfs(void*);
extern int register_limit(void*);
extern int register_seqjob_allocator(void*);

View file

@ -27,22 +27,29 @@ typedef struct {
float value;
} request_res_t;
struct xce_sched_obj_;
typedef struct xce_sched_obj_ xce_sched_obj_t;
typedef struct {
char* user;
char* queue;
char* project;
xce_sched_obj_t* owner;
xce_primary_resreq_t* resreq;
xce_pendreason_t* reason;
} xce_primary_schedobj_t;
typedef struct {
char* user;
char* queue;
char* project;
xce_sched_obj_t* owner;
xce_compound_resreq_t* resreq;
xce_pendreason_t* reason;
} xce_compound_schedobj_t;
typedef struct {
struct xce_sched_obj_ {
xce_resreq_tag_t tag;
uint64_t configver;
char* user;
char* queue;
char* project;
xlist_t glimits;
zarray_t hlimits;
union {
xce_primary_schedobj_t* primary;
xce_compound_schedobj_t* compound;
@ -50,7 +57,7 @@ typedef struct {
} u;
xce_job_alloc_t* alloc;
xce_pendreason_t* reason;
} xce_sched_obj_t;
};
typedef struct {
char* name;
@ -97,20 +104,20 @@ typedef struct {
} xce_sched_worker_t;
typedef struct {
xce_sched_job_t* job;
xce_sched_worker_t* worker;
xce_sched_obj_t* schedobj;
xce_job_alloc_t* alloc;
void* sched;
xce_sched_worker_t* worker;
xce_sched_obj_t* schedobj;
xce_primary_resreq_t* primary;
int nhosts;
int nslots;
struct {
xvec_t* shared;
zarray_t hosts;
} uncomitted;
xvec_idval_t unmeet;
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_job_alloc_t* alloc;
xce_pendreason_t* reason;
} xce_sched_ctx_t;
typedef struct {
@ -129,9 +136,11 @@ extern void kill_sched_worker(void*);
extern void kill_sched_user(void*);
extern void kill_sched_project(void*);
extern void kill_sched_resval(xce_val_t*);
extern int sched_ctx_init(xce_sched_ctx_t*, xce_sched_job_t*);
extern void sched_ctx_fini(xce_sched_ctx_t*);
extern int sched_ctx_get_uncomit_shared(xvec_t**, xce_sched_ctx_t*);
extern int sched_ctx_get_uncomit_host(xvec_t**, xce_sched_ctx_t*, int);
extern int sched_ctx_init(xce_sched_ctx_t*, void*, xce_sched_obj_t*);
extern void sched_ctx_fini(xce_sched_ctx_t*);
extern void sched_ctx_set_primary(xce_sched_ctx_t*, xce_primary_resreq_t*);
extern int sched_ctx_get_uncomit_shared(xvec_t**, xce_sched_ctx_t*);
extern int sched_ctx_get_uncomit_host(xvec_t**, xce_sched_ctx_t*, int);
extern void reset_sched_obj(xce_sched_obj_t*);
#endif

View file

@ -58,6 +58,7 @@ typedef struct {
xcecli_ctx_t apictx;
uint64_t nextid;
xce_conf4sched_t* config;
uint64_t configver;
kvmgr_t plugins;
void* seqjob_allocator;
void* parjob_allocator;
@ -118,14 +119,13 @@ extern int sched_collect_workers(xce_scheduler_t*, xlist_t*,
extern int sched_charge_account(xce_scheduler_t*, xce_job_account_t*);
extern int sched_uncharge_account(xce_scheduler_t*, xce_job_account_t*);
extern int sched_commit_job_alloc(xce_scheduler_t*, xce_sched_job_t*);
extern uint64_t sched_get_id(xce_scheduler_t*);
extern xce_alloc_t** sched_make_allocs(xce_scheduler_t*, char*, int, int*,
float*, int*);
extern int sched_try_alloc_on_hosts(xce_worker_group_t*, va_list);
extern int sched_ctx_fill_shared_requests(xce_scheduler_t*, xce_sched_ctx_t*);
extern int sched_ctx_fill_host_requests(xce_scheduler_t*, xce_sched_ctx_t*);
extern int get_resvals(zarray_t*, int, int*, float*);
extern int put_resvals(zarray_t*, int, int*, float*);
extern uint64_t sched_get_id(xce_scheduler_t*);
extern xce_alloc_t** sched_make_allocs(xce_scheduler_t*, char*, int, int*,
float*, int*);
extern int sched_try_alloc_on_hosts(xce_worker_group_t*, va_list);
extern int get_resvals(zarray_t*, int, int*, float*);
extern int put_resvals(zarray_t*, int, int*, float*);
extern request_res_t* make_resource_request(char*, float);
extern int sched_fill_limit_requests(xce_scheduler_t*, xvec_idval_t*, xlist_t*);
#endif