skip to content
==> include/mesh/jobs/sched.h <==
1/* @ajax/mesh-jobs-sched: the fleet scheduler's model as the jobs' dispatcher reads it (jobs.rs
2 * `SchedCx`): every member (index = id, with the owner policy's busy marks), each program's needs
3 * from the desired state, the measured performance per (program, member), and the weights. The fleet
4 * thread refreshes it every second and hands it to the node (mj_node_set_sched) as an mj_sched, whose
5 * judge is F4's `sched::filter` and `score_terms` (@ajax/mesh-sched-score). */
6#ifndef MESH_JOBS_SCHED_H
7#define MESH_JOBS_SCHED_H
8
9#include "mesh/jobs/select.h"
10#include "mesh/sched_member.h"
11#include "mesh/sched_needs.h"
12#include "mesh/sched_weights.h"
13
14#include <stddef.h>
15
16typedef struct {
17    msm_member *members; /* index = member id */
18    size_t nmembers;
19    char **need_names;   /* program -> needs */
20    mesh_needs *needs;
21    size_t nneeds;
22    msm_perfs perf;      /* (program, member) -> measured performance */
23    msw_weights w;
24} mjs_cx;
25
26void mjs_cx_free(mjs_cx *cx);
27/* The needs of program name in cx (NULL if none). */
28const mesh_needs *mjs_needs(const mjs_cx *cx, const char *name);
29/* An mj_sched over cx, which it takes (for mj_node_set_sched, or mj_select). */
30mj_sched *mjs_sched(mjs_cx cx);
31
32#endif