forked from lei.chen/myxce
Wire up 6 previously-stubbed message handlers in the scheduler:
resource dataset, resval dataset, job update notify, queue update
notify, resval update notify, and job rusage notify. Remove the
unreachable pushmsg branch (vtask_entry rewrites all pushmsg to
datamsg before the handler fires).
Changes by component:
- helper.h/helper.c: add xce_notify_event_name() for symbolic log names
- scheduler.h: add 5 new xce_sched_op_t values and matching union fields
- plugin.h/plugin.c: add plugin_job_rusage_hook_t and plugin_job_rusage_update()
- schedobj.c: add sched_update_existing_queue() with NULL/-ENOENT guards
- scheduler.c: wire 5 new dequeue cases; add sched_update_existing_job()
and static sched_op_name(); emit WARN log on handler failure
- handler.c: implement sched_handle_resources/resvals (dataset) and
sched_handle_sched_update_{job,queue,resvals}/job_rusage (notify);
remove dead sched_handle_jobpush/workerpush and pushmsg branch;
update TRACE logs to use symbolic name helpers
- test.c: 5 new unit tests covering notify event names, enum values,
and queue update NULL guard (15/15 pass)
88 lines
3.3 KiB
C
88 lines
3.3 KiB
C
#if !defined(_PLUGIN_H_)
|
|
|
|
#define _PLUGIN_H_ 1
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "decision.h"
|
|
#include "resreq.h"
|
|
#include "sched/types.h"
|
|
|
|
typedef void* plugin_data_t;
|
|
|
|
/* hooker of plugin, the first parameter should be xce_sched_plugin_t */
|
|
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_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_job_t*);
|
|
typedef int (*plugin_prepare_allocation_hook_t)(void*, xce_sched_ctx_t*);
|
|
typedef int (*plugin_job_rusage_hook_t)(void*, xce_sched_job_t*,
|
|
xce_job_rusages_t*);
|
|
|
|
/* initialize function of plugin */
|
|
typedef int (*plugin_init_fn_t)(void*);
|
|
|
|
typedef void (*plugin_fini_fn_t)(void*);
|
|
|
|
/* plugin function to elect job to be scheduler */
|
|
typedef void* (*plugin_job_election_fn_t)(void*);
|
|
|
|
/* plugin callback when a job has been elected */
|
|
|
|
typedef int (*plugin_begin_session_fn_t)(void*);
|
|
|
|
typedef int (*plugin_end_session_fn_t)(void*);
|
|
|
|
/* allocation function of job */
|
|
typedef int (*plugin_job_allocate_fn_t)(void*, xce_sched_ctx_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_job_state_change_hook_t jstate_hook;
|
|
plugin_update_worker_hook_t worker_hook;
|
|
plugin_commit_decision_hook_t commit_hook;
|
|
plugin_job_election_hook_t job_election_hook;
|
|
plugin_prepare_allocation_hook_t prepare_allocation_hook;
|
|
plugin_job_rusage_hook_t rusage_hook;
|
|
} plugin_hooks_t;
|
|
|
|
typedef struct {
|
|
char* name;
|
|
void* sched;
|
|
uint32_t plugin_id;
|
|
plugin_init_fn_t init_fn;
|
|
plugin_fini_fn_t fini_fn;
|
|
plugin_begin_session_fn_t begin_session_fn;
|
|
plugin_end_session_fn_t end_session_fn;
|
|
plugin_job_election_fn_t job_elect_fn;
|
|
plugin_job_allocate_fn_t job_alloc_fn;
|
|
plugin_hooks_t hooks;
|
|
plugin_data_t data;
|
|
} xce_sched_plugin_t;
|
|
|
|
extern int plugin_register(void*, void*);
|
|
extern void plugin_unregister(void*);
|
|
extern int plugin_config_update(void*, xce_conf4sched_t*);
|
|
extern int plugin_queue_update(void*, xce_sched_queue_t*);
|
|
extern int plugin_job_update(void*, xce_sched_job_t*);
|
|
extern int plugin_worker_update(void*, xce_sched_worker_t*);
|
|
extern int plugin_job_state_change(void*, xce_sched_job_t*, uint32_t);
|
|
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_job_t*);
|
|
extern int plugin_job_rusage_update(void*, xce_sched_job_t*, xce_job_rusages_t*);
|
|
extern int register_fcfs(void*);
|
|
extern int register_limit(void*);
|
|
extern int register_seqjob_allocator(void*);
|
|
extern int register_parjob_allocator(void*);
|
|
|
|
#endif
|