save works

This commit is contained in:
Rongsong Shen 2025-12-22 18:24:43 +08:00
parent c1e42b1ee2
commit cd0bca3138
8 changed files with 127 additions and 6 deletions

View file

@ -3,6 +3,7 @@
#define _DECISION_H_ 1
#include "xce/types.h"
#include <stdint.h>
typedef enum {
XCE_DECISION_NONE = 0,
@ -13,9 +14,13 @@ typedef enum {
typedef struct {
xce_decision_op_t op;
uint64_t jobid;
union {
xce_job_alloc_t* alloc;
} u;
} xce_decision_t;
extern xce_decision_t* make_pend_decision(uint64_t);
extern xce_decision_t* make_dispatch_decision(xce_job_alloc_t*);
#endif

View file

@ -5,6 +5,7 @@
#include <stdint.h>
#include <stdlib.h>
#include "decision.h"
#include "sched/types.h"
typedef void* plugin_data_t;
@ -14,6 +15,7 @@ typedef int (*plugin_update_config_hook_t)(void*, xce_conf4sched_t*);
typedef int (*plugin_update_queue_hook_t)(void*, xce_sched_queue_t*);
typedef int (*plugin_update_job_hook_t)(void*, xce_sched_job_t*);
typedef int (*plugin_update_worker_hook_t)(void*, xce_sched_worker_t*);
typedef int (*plugin_commit_decision_hook_t)(void*, xce_decision_t*);
/* initialize function of plugin */
typedef int (*plugin_init_fn_t)(void*);
@ -27,13 +29,14 @@ typedef int (*plugin_begin_session_fn_t)(void*);
typedef int (*plugin_end_session_fn_t)(void*);
/* allocation function of job */
typedef xce_job_alloc_t* (*plugin_job_allocate_fn_t)(void*, int64_t*);
typedef xce_job_alloc_t* (*plugin_job_allocate_fn_t)(void*, int64_t);
typedef struct {
plugin_update_config_hook_t config_hook;
plugin_update_queue_hook_t queue_hook;
plugin_update_job_hook_t job_hook;
plugin_update_worker_hook_t worker_hook;
plugin_update_config_hook_t config_hook;
plugin_update_queue_hook_t queue_hook;
plugin_update_job_hook_t job_hook;
plugin_update_worker_hook_t worker_hook;
plugin_commit_decision_hook_t commit_hook;
} plugin_hooks_t;
typedef struct {
@ -59,5 +62,6 @@ extern int plugin_begin_session(void*);
extern int plugin_end_session(void*);
extern int register_fcfs(void*);
extern int register_default_allocator(void*);
#endif

View file

@ -45,6 +45,7 @@ typedef struct {
xce_sched_queue_t* queue;
xce_sched_user_t* user;
xce_sched_project_t* project;
void* allocator;
uint32_t mintasks;
uint32_t maxtasks;
xce_job_alloc_t* allocs;

View file

@ -80,5 +80,6 @@ extern int sched_add_worker(xce_scheduler_t*, xce_sched_worker_t*);
extern int sched_add_project(xce_scheduler_t*, xce_sched_project_t*);
extern int sched_job_is_ready(xce_sched_job_t*);
extern int sched_queue_is_ready(xce_sched_queue_t*);
extern int sched_commit_decision(xce_scheduler_t*, xce_decision_t*);
#endif