@roomi-fields/grillhouse 0.43.2 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +32 -0
- package/cadre/templates/projet/.claude/settings.json +5 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +11 -17
- package/cadre/templates/projet/.github/workflows/nuit.yml +3 -3
- package/cadre/templates/projet/CLAUDE.md +15 -2
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/cadre/templates/projet/package.json +1 -1
- package/charte.md +3 -2
- package/dist/temporal/circuit/client.d.ts +7 -0
- package/dist/temporal/circuit/client.js +12 -2
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/commande.js +5 -1
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/installation.d.ts +21 -1
- package/dist/temporal/installation.js +207 -16
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/tickets/activites.js +3 -1
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/docs/ARCHITECTURE.md +238 -77
- package/docs/INTERFACE.md +30 -15
- package/package.json +2 -2
- package/scripts/activites.mjs +59 -43
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-de-la-machine.mjs +312 -0
- package/scripts/avancement.mjs +38 -31
- package/scripts/bilan.mjs +30 -5
- package/scripts/circuit.mjs +10 -7
- package/scripts/codes-de-sortie.mjs +1 -1
- package/scripts/coeurs-dedies.mjs +427 -0
- package/scripts/composants-affectes.mjs +3 -1
- package/scripts/consommation-des-passes.mjs +382 -0
- package/scripts/consommation.mjs +45 -0
- package/scripts/copies-finies.mjs +2 -2
- package/scripts/depart-du-ticket.mjs +7 -5
- package/scripts/disque-des-copies.mjs +1 -1
- package/scripts/echantillonneur-de-la-passe.mjs +103 -0
- package/scripts/enveloppe/enveloppe.mjs +3 -13
- package/scripts/enveloppe/lancer.sh +1 -1
- package/scripts/enveloppe/travail-de-la-copie.mjs +3 -2
- package/scripts/grillhouse-maj.mjs +8 -4
- package/scripts/integration/file.mjs +10 -4
- package/scripts/jointure.d.ts +20 -9
- package/scripts/langages/cargo/commandes.mjs +8 -8
- package/scripts/langages/python/commandes.mjs +7 -6
- package/scripts/langages/typescript/tests-de-nuit.mjs +17 -4
- package/scripts/langages/typescript/tests.mjs +15 -6
- package/scripts/langages/typescript/verifier.mjs +23 -17
- package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -7
- package/scripts/langages.d.mts +2 -0
- package/scripts/langages.mjs +79 -0
- package/scripts/mesure/base-de-passe.mjs +1 -1
- package/scripts/migrations/0.44.0-node-26-seul.mjs +47 -0
- package/scripts/migrations/0.44.0-seuil-des-codes-de-tickets.mjs +47 -0
- package/scripts/migrations.mjs +4 -0
- package/scripts/passe-de-la-machine.mjs +456 -31
- package/scripts/places-de-la-machine.mjs +508 -61
- package/scripts/plafond-de-la-machine.d.mts +47 -2
- package/scripts/plafond-de-la-machine.mjs +197 -5
- package/scripts/preparation.mjs +1 -0
- package/scripts/regles-des-places.d.mts +40 -0
- package/scripts/regles-des-places.mjs +91 -0
- package/scripts/retirer-les-copies-finies.mjs +1 -1
- package/scripts/seances.mjs +4 -3
- package/scripts/services-du-noyau.mjs +3 -3
- package/scripts/sortie.mjs +3 -2
- package/scripts/sous-commandes.mjs +6 -7
- package/scripts/tableau.mjs +121 -112
- package/scripts/ticket-du-circuit.mjs +5 -1
- package/scripts/verrous/verrou.mjs +3 -3
- package/scripts/verrou-de-machine.mjs +0 -829
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
// The types of the
|
|
2
|
-
// activities of the workflow of the machine (src/temporal/places/activites.ts) import
|
|
1
|
+
// The types of the settings of the machine (./plafond-de-la-machine.mjs): the ceiling of the places,
|
|
2
|
+
// which the activities of the workflow of the machine (src/temporal/places/activites.ts) import, and
|
|
3
|
+
// the budget of the machine and the part of a pass.
|
|
4
|
+
import type { PartDeLaPasse } from './regles-des-places.mjs';
|
|
3
5
|
|
|
4
6
|
export const VARIABLE_PLACES: 'GRILLHOUSE_PLACES';
|
|
7
|
+
export const VARIABLE_RESERVE_COEURS: 'GRILLHOUSE_RESERVE_COEURS';
|
|
8
|
+
export const VARIABLE_RESERVE_MEMOIRE: 'GRILLHOUSE_RESERVE_MEMOIRE_GO';
|
|
5
9
|
/** The file of the poste that holds the ceiling, under `~/.config/grillhouse/`. */
|
|
6
10
|
export const FICHIER_DE_LA_MACHINE: 'machine.env';
|
|
7
11
|
/** The ceiling of the places of the machine when nothing names another. */
|
|
8
12
|
export const PLAFOND_PAR_DEFAUT: 3;
|
|
13
|
+
/** The cores the reserve of the user keeps when nothing names another. */
|
|
14
|
+
export const RESERVE_COEURS_PAR_DEFAUT: 4;
|
|
15
|
+
/** The memory the reserve of the user keeps when nothing names another, in GB. */
|
|
16
|
+
export const RESERVE_MEMOIRE_GO_PAR_DEFAUT: 4;
|
|
17
|
+
/** The cores a default part holds at least. */
|
|
18
|
+
export const MIN_COEURS_DE_LA_PART: 4;
|
|
9
19
|
|
|
10
20
|
/**
|
|
11
21
|
* The ceiling of the places under <env>: GRILLHOUSE_PLACES of the environment, else of the file of
|
|
@@ -16,3 +26,38 @@ export function plafondDe(
|
|
|
16
26
|
env?: Record<string, string | undefined>,
|
|
17
27
|
o?: { lire?: (f: string) => string | null }
|
|
18
28
|
): number;
|
|
29
|
+
|
|
30
|
+
/** The reserve of the user under <env>: the cores and the memory (bytes) no pass takes; throws
|
|
31
|
+
* naming the variable whose value is not a whole number ≥ 0. */
|
|
32
|
+
export function reserveDe(
|
|
33
|
+
env?: Record<string, string | undefined>,
|
|
34
|
+
o?: { lire?: (f: string) => string | null }
|
|
35
|
+
): PartDeLaPasse;
|
|
36
|
+
|
|
37
|
+
/** The budget of the machine: its hardware less the reserve; throws naming the variable of a
|
|
38
|
+
* reserve that leaves no core or no memory. */
|
|
39
|
+
export function budgetDe(
|
|
40
|
+
materiel: { coeurs: number; memoireTotale: number },
|
|
41
|
+
reserve: PartDeLaPasse
|
|
42
|
+
): PartDeLaPasse;
|
|
43
|
+
|
|
44
|
+
/** The part of a pass when its project declares none. */
|
|
45
|
+
export function partParDefautDe(budget: PartDeLaPasse): PartDeLaPasse;
|
|
46
|
+
|
|
47
|
+
/** The part of a pass: the declared one, its missing values from the default, within the budget. */
|
|
48
|
+
export function partDe(o: {
|
|
49
|
+
declaree: { coeurs?: number; memoire?: number } | null;
|
|
50
|
+
budget: PartDeLaPasse;
|
|
51
|
+
}): PartDeLaPasse;
|
|
52
|
+
|
|
53
|
+
/** The part a project declares in `grillhouse.part` of its package.json, or the fault naming it. */
|
|
54
|
+
export function partDeclareeDe(pkg: { grillhouse?: unknown } | null | undefined): {
|
|
55
|
+
declaree: { coeurs?: number; memoire?: number } | null;
|
|
56
|
+
faute: string | null;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** The hardware of this machine: its cores and its total memory (bytes). */
|
|
60
|
+
export function materielDeLaMachine(): { coeurs: number; memoireTotale: number };
|
|
61
|
+
|
|
62
|
+
/** The budget of this machine under <env>. */
|
|
63
|
+
export function budgetDeLaMachine(env?: Record<string, string | undefined>): PartDeLaPasse;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// The
|
|
1
|
+
// The settings of the poste for the machine (scripts/places-de-la-machine.mjs), configurations of
|
|
2
2
|
// the poste read again at each judgement, as Buildkite reads the number of its agents from its
|
|
3
|
-
// configuration and Nomad its `client.reserved`: the workflow of the machine reads
|
|
4
|
-
// activity (src/temporal/places/activites.ts), the board and the number of workers
|
|
5
|
-
// by this same function, so that a ceiling changed counts without restarting anything.
|
|
3
|
+
// configuration and Nomad its `client.reserved`: the workflow of the machine reads the ceiling of
|
|
4
|
+
// the places by an activity (src/temporal/places/activites.ts), the board and the number of workers
|
|
5
|
+
// of the tests by this same function, so that a ceiling changed counts without restarting anything.
|
|
6
6
|
//
|
|
7
7
|
// - The file of the poste `machine.env`, under the frame's directory of configuration
|
|
8
8
|
// (`~/.config/grillhouse/`, scripts/fichier-du-poste.mjs), holds `GRILLHOUSE_PLACES=<n>`, as
|
|
@@ -10,14 +10,42 @@
|
|
|
10
10
|
// - The environment wins, as for every file of the poste: GRILLHOUSE_PLACES set (a trial machine,
|
|
11
11
|
// a test) is read instead of the file. Without either, PLAFOND_PAR_DEFAUT, 3.
|
|
12
12
|
// - A value that is not a positive integer is refused by its name and its place.
|
|
13
|
+
//
|
|
14
|
+
// The budget of the machine and the part of a pass (functions with the hardware and the settings
|
|
15
|
+
// as input, nothing read from the machine), as Slurm reserves the cores and the memory of a job
|
|
16
|
+
// and Bazel bounds `--local_resources`:
|
|
17
|
+
// - The reserve of the user, the share of the machine no pass takes: GRILLHOUSE_RESERVE_COEURS
|
|
18
|
+
// (by default min(4, max(0, cores − 4)): 0 on 4 cores or fewer, 2 on 6, 4 from 8) and GRILLHOUSE_RESERVE_MEMOIRE_GO (4 GB), the environment first, then
|
|
19
|
+
// `machine.env`; zero is admitted, a value that is not a whole number ≥ 0 is refused by its name.
|
|
20
|
+
// - The budget is the cores and the memory of the machine less the reserve; a reserve that leaves
|
|
21
|
+
// no core or no memory is refused by its name.
|
|
22
|
+
// - The part of a pass is its cores and its memory: the default part has MIN_COEURS_DE_LA_PART
|
|
23
|
+
// cores at least (a third of the budget when that is more), its memory in proportion; a part a project
|
|
24
|
+
// declares (`grillhouse.part` of its `package.json`) replaces it; a part larger than the budget
|
|
25
|
+
// is the budget (one pass at a time), and never under one core.
|
|
26
|
+
import { readFileSync } from 'node:fs';
|
|
27
|
+
import { cpus, totalmem } from 'node:os';
|
|
13
28
|
import path from 'node:path';
|
|
14
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
avecLeFichierDuPoste,
|
|
31
|
+
configurationDuPoste,
|
|
32
|
+
variablesDuTexte,
|
|
33
|
+
} from './fichier-du-poste.mjs';
|
|
15
34
|
|
|
35
|
+
const GO = 1024 ** 3;
|
|
16
36
|
export const VARIABLE_PLACES = 'GRILLHOUSE_PLACES';
|
|
37
|
+
export const VARIABLE_RESERVE_COEURS = 'GRILLHOUSE_RESERVE_COEURS';
|
|
38
|
+
export const VARIABLE_RESERVE_MEMOIRE = 'GRILLHOUSE_RESERVE_MEMOIRE_GO';
|
|
17
39
|
/** The file of the poste that holds the ceiling, under `~/.config/grillhouse/`. */
|
|
18
40
|
export const FICHIER_DE_LA_MACHINE = 'machine.env';
|
|
19
41
|
/** The ceiling of the places of the machine when nothing names another. */
|
|
20
42
|
export const PLAFOND_PAR_DEFAUT = 3;
|
|
43
|
+
/** The cores the reserve of the user keeps when nothing names another. */
|
|
44
|
+
export const RESERVE_COEURS_PAR_DEFAUT = 4;
|
|
45
|
+
/** The memory the reserve of the user keeps when nothing names another, in GB. */
|
|
46
|
+
export const RESERVE_MEMOIRE_GO_PAR_DEFAUT = 4;
|
|
47
|
+
/** The cores a default part holds at least. */
|
|
48
|
+
export const MIN_COEURS_DE_LA_PART = 4;
|
|
21
49
|
|
|
22
50
|
/**
|
|
23
51
|
* The ceiling of the places under <env>: GRILLHOUSE_PLACES of the environment, else of the file
|
|
@@ -43,3 +71,167 @@ export function plafondDe(env = process.env, o = {}) {
|
|
|
43
71
|
}
|
|
44
72
|
return Number(v);
|
|
45
73
|
}
|
|
74
|
+
|
|
75
|
+
// The text of the file `machine.env` of the poste under <env>, null when it does not read.
|
|
76
|
+
function fichierDuPoste(env) {
|
|
77
|
+
const dossier = configurationDuPoste(env);
|
|
78
|
+
if (dossier === null) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
return readFileSync(path.join(dossier, FICHIER_DE_LA_MACHINE), 'utf8');
|
|
83
|
+
} catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// The value of <nom> under <env>, else in the file of the poste (its text read by <lire>), as a
|
|
89
|
+
// whole number ≥ 0; <defaut> without either.
|
|
90
|
+
function entierDuPoste(env, nom, defaut, lire) {
|
|
91
|
+
const dedans = env[nom] !== undefined && env[nom] !== '';
|
|
92
|
+
const fichier = variablesDuTexte(
|
|
93
|
+
(lire ? lire(path.join(configurationDuPoste(env) ?? '', FICHIER_DE_LA_MACHINE)) : fichierDuPoste(env)) ?? ''
|
|
94
|
+
);
|
|
95
|
+
const v = dedans ? env[nom] : fichier[nom];
|
|
96
|
+
if (v === undefined || v === '') {
|
|
97
|
+
return defaut;
|
|
98
|
+
}
|
|
99
|
+
if (!/^\d+$/.test(v)) {
|
|
100
|
+
const ou = dedans
|
|
101
|
+
? 'dans l’environnement'
|
|
102
|
+
: `dans ${path.join(configurationDuPoste(env) ?? '~/.config/grillhouse', FICHIER_DE_LA_MACHINE)}`;
|
|
103
|
+
throw new Error(`${nom} vaut « ${v} » ${ou} : un entier supérieur ou égal à zéro est attendu.`);
|
|
104
|
+
}
|
|
105
|
+
return Number(v);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The reserve of the user under <env>: the cores and the memory (bytes) no pass takes.
|
|
110
|
+
* @param {Record<string, string | undefined>} [env]
|
|
111
|
+
* The default reserve of cores leaves the passes 4 cores at least, or all the cores of a smaller
|
|
112
|
+
* machine: min(4, max(0, cores − 4)), so 0 on 4 cores or fewer, 2 on 6, 4 from 8.
|
|
113
|
+
* @param {{ lire?: (f: string) => string | null, coeurs?: number }} [o] the reading of the file
|
|
114
|
+
* and the cores of the machine, for a trial
|
|
115
|
+
* @returns {{ coeurs: number, memoire: number }}
|
|
116
|
+
* @throws {Error} naming the variable whose value is not a whole number ≥ 0
|
|
117
|
+
*/
|
|
118
|
+
export function reserveDe(env = process.env, o = {}) {
|
|
119
|
+
const coeursDeLaMachine = o.coeurs ?? cpus().length;
|
|
120
|
+
const parDefaut = Math.min(
|
|
121
|
+
RESERVE_COEURS_PAR_DEFAUT,
|
|
122
|
+
Math.max(0, coeursDeLaMachine - MIN_COEURS_DE_LA_PART)
|
|
123
|
+
);
|
|
124
|
+
return {
|
|
125
|
+
coeurs: entierDuPoste(env, VARIABLE_RESERVE_COEURS, parDefaut, o.lire),
|
|
126
|
+
memoire:
|
|
127
|
+
entierDuPoste(env, VARIABLE_RESERVE_MEMOIRE, RESERVE_MEMOIRE_GO_PAR_DEFAUT, o.lire) * GO,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The budget of the machine: its cores and its memory less the reserve of the user.
|
|
133
|
+
* @param {{ coeurs: number, memoireTotale: number }} materiel
|
|
134
|
+
* @param {{ coeurs: number, memoire: number }} reserve
|
|
135
|
+
* @returns {{ coeurs: number, memoire: number }}
|
|
136
|
+
* @throws {Error} naming GRILLHOUSE_RESERVE_COEURS or GRILLHOUSE_RESERVE_MEMOIRE_GO when the
|
|
137
|
+
* reserve leaves nothing
|
|
138
|
+
*/
|
|
139
|
+
export function budgetDe({ coeurs, memoireTotale }, reserve) {
|
|
140
|
+
if (reserve.coeurs >= coeurs) {
|
|
141
|
+
throw new Error(
|
|
142
|
+
`${VARIABLE_RESERVE_COEURS} vaut ${reserve.coeurs} pour ${coeurs} cœurs : le budget de la machine serait nul, une réserve plus petite que ses cœurs est attendue.`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
if (reserve.memoire >= memoireTotale) {
|
|
146
|
+
throw new Error(
|
|
147
|
+
`${VARIABLE_RESERVE_MEMOIRE} vaut ${reserve.memoire / GO} Go pour ${Math.round(memoireTotale / GO)} Go de mémoire : le budget de la machine serait nul, une réserve plus petite que sa mémoire est attendue.`
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
return { coeurs: coeurs - reserve.coeurs, memoire: memoireTotale - reserve.memoire };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The part of a pass when its project declares none: MIN_COEURS_DE_LA_PART cores (a third of the
|
|
155
|
+
* budget, rounded up, when that is more), within the budget and one core at least, its memory in proportion of its
|
|
156
|
+
* cores.
|
|
157
|
+
* @param {{ coeurs: number, memoire: number }} budget
|
|
158
|
+
* @returns {{ coeurs: number, memoire: number }}
|
|
159
|
+
*/
|
|
160
|
+
export function partParDefautDe(budget) {
|
|
161
|
+
const coeurs = Math.max(
|
|
162
|
+
1,
|
|
163
|
+
Math.min(budget.coeurs, Math.max(MIN_COEURS_DE_LA_PART, Math.ceil(budget.coeurs / 3)))
|
|
164
|
+
);
|
|
165
|
+
return { coeurs, memoire: Math.floor((budget.memoire * coeurs) / budget.coeurs) };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The part of a pass: the one its project declares (`partDeclareeDe`), its missing values from the
|
|
170
|
+
* default part, within the budget and one core at least.
|
|
171
|
+
* @param {{ declaree: { coeurs?: number, memoire?: number } | null,
|
|
172
|
+
* budget: { coeurs: number, memoire: number } }} o
|
|
173
|
+
* @returns {{ coeurs: number, memoire: number }}
|
|
174
|
+
*/
|
|
175
|
+
export function partDe({ declaree, budget }) {
|
|
176
|
+
const defaut = partParDefautDe(budget);
|
|
177
|
+
return {
|
|
178
|
+
coeurs: Math.max(1, Math.min(budget.coeurs, declaree?.coeurs ?? defaut.coeurs)),
|
|
179
|
+
memoire: Math.min(budget.memoire, declaree?.memoire ?? defaut.memoire),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The part a project declares in the key `grillhouse.part` of its `package.json` <pkg>
|
|
185
|
+
* (`{ coeurs, memoireGo }`, each optional): `{ declaree, faute }`, `declaree` null without the
|
|
186
|
+
* key, `faute` the line that names the key and what is wrong when it is.
|
|
187
|
+
* @param {{ grillhouse?: { part?: unknown } }} pkg
|
|
188
|
+
* @returns {{ declaree: { coeurs?: number, memoire?: number } | null, faute: string | null }}
|
|
189
|
+
*/
|
|
190
|
+
export function partDeclareeDe(pkg) {
|
|
191
|
+
const part = pkg?.grillhouse?.part;
|
|
192
|
+
if (part === undefined) {
|
|
193
|
+
return { declaree: null, faute: null };
|
|
194
|
+
}
|
|
195
|
+
const faute = dit => ({
|
|
196
|
+
declaree: null,
|
|
197
|
+
faute: `grillhouse.part : ${dit} ({ "coeurs": <entier ≥ 1>, "memoireGo": <nombre > 0> } est attendu).`,
|
|
198
|
+
});
|
|
199
|
+
if (part === null || typeof part !== 'object' || Array.isArray(part)) {
|
|
200
|
+
return faute(`« ${JSON.stringify(part)} » n’est pas un objet`);
|
|
201
|
+
}
|
|
202
|
+
const inconnue = Object.keys(part).find(k => k !== 'coeurs' && k !== 'memoireGo');
|
|
203
|
+
if (inconnue !== undefined) {
|
|
204
|
+
return faute(`la clé « ${inconnue} » est inconnue`);
|
|
205
|
+
}
|
|
206
|
+
const { coeurs, memoireGo } = part;
|
|
207
|
+
if (coeurs !== undefined && !(Number.isInteger(coeurs) && coeurs >= 1)) {
|
|
208
|
+
return faute(`coeurs vaut ${JSON.stringify(coeurs)}`);
|
|
209
|
+
}
|
|
210
|
+
if (memoireGo !== undefined && !(typeof memoireGo === 'number' && memoireGo > 0)) {
|
|
211
|
+
return faute(`memoireGo vaut ${JSON.stringify(memoireGo)}`);
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
declaree: {
|
|
215
|
+
...(coeurs === undefined ? {} : { coeurs }),
|
|
216
|
+
...(memoireGo === undefined ? {} : { memoire: memoireGo * GO }),
|
|
217
|
+
},
|
|
218
|
+
faute: null,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The hardware of this machine: its cores and its total memory (bytes).
|
|
224
|
+
* @returns {{ coeurs: number, memoireTotale: number }}
|
|
225
|
+
*/
|
|
226
|
+
export const materielDeLaMachine = () => ({ coeurs: cpus().length, memoireTotale: totalmem() });
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* The budget of this machine under <env>: its hardware less the reserve of the user.
|
|
230
|
+
* @param {Record<string, string | undefined>} [env]
|
|
231
|
+
* @returns {{ coeurs: number, memoire: number }}
|
|
232
|
+
* @throws {Error} naming the variable of the reserve when it is faulty or leaves nothing
|
|
233
|
+
*/
|
|
234
|
+
export const budgetDeLaMachine = (env = process.env) => {
|
|
235
|
+
const materiel = materielDeLaMachine();
|
|
236
|
+
return budgetDe(materiel, reserveDe(env, { coeurs: materiel.coeurs }));
|
|
237
|
+
};
|
package/scripts/preparation.mjs
CHANGED
|
@@ -85,6 +85,7 @@ export function preparer(projet, prefixe) {
|
|
|
85
85
|
'--prefix',
|
|
86
86
|
lePrefixe,
|
|
87
87
|
]);
|
|
88
|
+
lancer(projet, 'bd', ['config', 'set', 'max_collision_prob', '0.99']);
|
|
88
89
|
ecrireLePrefixe(projet, lePrefixe);
|
|
89
90
|
lancer(projet, 'git', ['config', 'beads.role', 'maintainer']);
|
|
90
91
|
const r = spawnSync('git', ['-C', projet, 'config', 'core.hooksPath'], { encoding: 'utf8' });
|
|
@@ -51,6 +51,46 @@ export function refusDeLaPlace(
|
|
|
51
51
|
}
|
|
52
52
|
): string | null;
|
|
53
53
|
|
|
54
|
+
/** The part of a pass: its cores and its memory (bytes). */
|
|
55
|
+
export interface PartDeLaPasse {
|
|
56
|
+
coeurs: number;
|
|
57
|
+
memoire: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** What a pass waits for: the cores or the memory of the budget, or the load of the machine. */
|
|
61
|
+
export type CeQueAttendUnePart = 'cœurs' | 'mémoire' | 'charge';
|
|
62
|
+
|
|
63
|
+
/** Whether a part fits in what the parts held leave of the budget; a refusal says what it waits for. */
|
|
64
|
+
export function partDansLeBudget(o: {
|
|
65
|
+
part: PartDeLaPasse;
|
|
66
|
+
budget: PartDeLaPasse;
|
|
67
|
+
prises: readonly PartDeLaPasse[];
|
|
68
|
+
}): { ok: boolean; attend?: CeQueAttendUnePart; raison?: string };
|
|
69
|
+
|
|
70
|
+
/** Whether a pass of the part <part> is admitted: its part fits in the budget left, then the load and
|
|
71
|
+
* the memory of the machine admit it; a refusal says what it waits for, with its figures. */
|
|
72
|
+
export function admissionDePart(o: {
|
|
73
|
+
part: PartDeLaPasse;
|
|
74
|
+
budget: PartDeLaPasse;
|
|
75
|
+
prises: readonly PartDeLaPasse[];
|
|
76
|
+
mesure: MesureDeLaMachine;
|
|
77
|
+
}): { ok: boolean; attend?: CeQueAttendUnePart; raison?: string };
|
|
78
|
+
|
|
79
|
+
/** Why a pass does not take its part now on a state of the parts, null when it does. */
|
|
80
|
+
export function refusDePart(
|
|
81
|
+
etat: {
|
|
82
|
+
prises: readonly { id?: string; coeurs: number; memoire: number }[];
|
|
83
|
+
attentes: readonly { id: string; rang: number; ticket?: string | null; raison?: string }[];
|
|
84
|
+
},
|
|
85
|
+
o: {
|
|
86
|
+
id: string;
|
|
87
|
+
rang: number;
|
|
88
|
+
part: PartDeLaPasse;
|
|
89
|
+
budget: PartDeLaPasse;
|
|
90
|
+
mesurer: () => MesureDeLaMachine;
|
|
91
|
+
}
|
|
92
|
+
): string | null;
|
|
93
|
+
|
|
54
94
|
/** A place of a circuit not given by its project's queue for this long is gone, in ms: 10 min. */
|
|
55
95
|
export const PERIME_MS: number;
|
|
56
96
|
|
|
@@ -105,6 +105,97 @@ export function refusDeLaPlace(
|
|
|
105
105
|
return null;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
const go = octets => `${nombre(octets / 1024 ** 3)} Go`;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Whether the part <part> (`{ coeurs, memoire }`, bytes) fits in what the parts <prises> leave of
|
|
112
|
+
* the <budget> of the machine: cores, then memory. A refusal says what it waits for (`attend`:
|
|
113
|
+
* « cœurs » or « mémoire ») and its figures, « cœurs : 6 demandés, 4 libres sur 8 ».
|
|
114
|
+
* @param {{ part: { coeurs: number, memoire: number }, budget: { coeurs: number, memoire: number },
|
|
115
|
+
* prises: { coeurs: number, memoire: number }[] }} o
|
|
116
|
+
* @returns {{ ok: true } | { ok: false, attend: 'cœurs' | 'mémoire', raison: string }}
|
|
117
|
+
*/
|
|
118
|
+
export function partDansLeBudget({ part, budget, prises }) {
|
|
119
|
+
const coeursLibres = budget.coeurs - prises.reduce((n, p) => n + p.coeurs, 0);
|
|
120
|
+
if (part.coeurs > coeursLibres) {
|
|
121
|
+
return {
|
|
122
|
+
ok: false,
|
|
123
|
+
attend: 'cœurs',
|
|
124
|
+
raison: `cœurs : ${part.coeurs} demandés, ${Math.max(0, coeursLibres)} libres sur ${budget.coeurs}`,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const memoireLibre = budget.memoire - prises.reduce((n, p) => n + p.memoire, 0);
|
|
128
|
+
if (part.memoire > memoireLibre) {
|
|
129
|
+
return {
|
|
130
|
+
ok: false,
|
|
131
|
+
attend: 'mémoire',
|
|
132
|
+
raison: `mémoire : ${go(part.memoire)} demandés, ${go(Math.max(0, memoireLibre))} libres sur ${go(budget.memoire)}`,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return { ok: true };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Whether a pass of the part <part> is admitted: its part fits in what the parts <prises> leave of
|
|
140
|
+
* the <budget> (`partDansLeBudget`), then the thresholds of `admission` hold on the machine
|
|
141
|
+
* <mesure> (load under the cores, MEMOIRE_MIN free). A refusal says what it waits for (`attend`:
|
|
142
|
+
* « cœurs », « mémoire » or « charge ») and its figures.
|
|
143
|
+
* @param {{ part: { coeurs: number, memoire: number }, budget: { coeurs: number, memoire: number },
|
|
144
|
+
* prises: { coeurs: number, memoire: number }[],
|
|
145
|
+
* mesure: { coeurs: number, charge: number, memoireLibre: number } }} o
|
|
146
|
+
* @returns {{ ok: true } | { ok: false, attend: 'cœurs' | 'mémoire' | 'charge', raison: string }}
|
|
147
|
+
*/
|
|
148
|
+
export function admissionDePart({ part, budget, prises, mesure }) {
|
|
149
|
+
const tient = partDansLeBudget({ part, budget, prises });
|
|
150
|
+
if (!tient.ok) {
|
|
151
|
+
return tient;
|
|
152
|
+
}
|
|
153
|
+
const a = admission(mesure);
|
|
154
|
+
return a.ok
|
|
155
|
+
? a
|
|
156
|
+
: { ...a, attend: mesure.charge >= mesure.coeurs ? 'charge' : 'mémoire' };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Why the pass <id> of the rank <rang> does not take its part <part> now on the state <etat>
|
|
161
|
+
* (`prises`, `attentes`), null when it does: its part does not fit in the <budget>; a wait of a
|
|
162
|
+
* lower rank, alive, which keeps its turn (the measure of the frame has the lower rank of a
|
|
163
|
+
* project's, then the order of arrival); the admission at the load and the memory <mesurer> gives
|
|
164
|
+
* (read only when the part and the turn pass). The night asks for the whole budget as its part: it
|
|
165
|
+
* plays alone. A measure of time (<dediee>) asks for dedicated cores: when they lack, its refusal
|
|
166
|
+
* says « cœurs dédiés » and names the passes that hold them; a pass that comes after it waits
|
|
167
|
+
* behind it, its rank reserved, and one measure plays at a time, whatever its part would fit in the free cores; once it plays, an
|
|
168
|
+
* ordinary pass whose part fits in the cores left goes on.
|
|
169
|
+
* @param {{ prises: { id?: string, coeurs: number, memoire: number, ticket?: string | null }[],
|
|
170
|
+
* attentes: { id: string, rang: number, ticket?: string | null, raison?: string }[] }} etat
|
|
171
|
+
* @param {{ id: string, rang: number, part: { coeurs: number, memoire: number },
|
|
172
|
+
* budget: { coeurs: number, memoire: number }, dediee?: boolean,
|
|
173
|
+
* mesurer: () => { coeurs: number, charge: number, memoireLibre: number } }} o
|
|
174
|
+
* @returns {string | null}
|
|
175
|
+
*/
|
|
176
|
+
export function refusDePart(etat, { id, rang, part, budget, mesurer, dediee = false }) {
|
|
177
|
+
const prises = etat.prises.filter(p => p.id !== id);
|
|
178
|
+
// Two measures of time never play side by side: each would be the load the other is judged on.
|
|
179
|
+
const autre = dediee ? prises.find(p => p.dediee) : undefined;
|
|
180
|
+
if (autre) {
|
|
181
|
+
return `cœurs dédiés : la mesure de ${autre.ticket ?? 'une passe'} les tient, une mesure à la fois`;
|
|
182
|
+
}
|
|
183
|
+
const tient = partDansLeBudget({ part, budget, prises });
|
|
184
|
+
if (!tient.ok) {
|
|
185
|
+
if (dediee && tient.attend === 'cœurs') {
|
|
186
|
+
const tenues = prises.map(p => p.ticket ?? 'une passe').join(', ');
|
|
187
|
+
return `cœurs dédiés${tient.raison.slice('cœurs'.length)}${tenues ? ` ; tenus par ${tenues}` : ''}`;
|
|
188
|
+
}
|
|
189
|
+
return tient.raison;
|
|
190
|
+
}
|
|
191
|
+
const avant = etat.attentes.find(a => a.id !== id && a.rang < rang);
|
|
192
|
+
if (avant) {
|
|
193
|
+
return `rang réservé : ${avant.ticket ?? 'une passe'} est arrivée avant et attend (${avant.raison})`;
|
|
194
|
+
}
|
|
195
|
+
const a = admissionDePart({ part, budget, prises, mesure: mesurer() });
|
|
196
|
+
return a.ok ? null : a.raison;
|
|
197
|
+
}
|
|
198
|
+
|
|
108
199
|
/** A place of a circuit not given by its project's queue for this long is gone, in ms: 10 min. */
|
|
109
200
|
export const PERIME_MS = 10 * 60_000;
|
|
110
201
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// answer, a client not built or any other fault of that reading leaves them unread (null), and
|
|
10
10
|
// the removal of ./copies-finies.mjs then keeps each copy beside its `.travail`.
|
|
11
11
|
// - The removal lives in ./copies-finies.mjs, which imports nothing of the built `dist/`: the lock
|
|
12
|
-
// of the machine (./
|
|
12
|
+
// of the machine (./attente-de-la-machine.mjs) and the base configuration of the tests import it,
|
|
13
13
|
// and a project of trial holds the frame's scripts without `dist/`.
|
|
14
14
|
import { circuitsDuServeur } from './circuits-du-serveur.mjs';
|
|
15
15
|
import { retirerLesCopiesDuDepot } from './copies-finies.mjs';
|
package/scripts/seances.mjs
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
nomsDe,
|
|
48
48
|
} from './ticket-du-circuit.mjs';
|
|
49
49
|
import { emettre } from './effets.mjs';
|
|
50
|
-
import { AttenteDeLaMachine } from './
|
|
50
|
+
import { AttenteDeLaMachine } from './attente-de-la-machine.mjs';
|
|
51
51
|
|
|
52
52
|
// The number of the next files of a session in the working directory <dossier> of the ticket: one
|
|
53
53
|
// past the highest its files carry (`consigne-<n>.md`, `erreurs-<n>.txt`), read
|
|
@@ -324,8 +324,9 @@ export async function lancer(
|
|
|
324
324
|
}
|
|
325
325
|
throw new Arret('a-repasser', e.message);
|
|
326
326
|
}
|
|
327
|
-
// The session writes at the ticket under the author of its role
|
|
328
|
-
// place
|
|
327
|
+
// The session writes at the ticket under the author of its role (the mark of its place,
|
|
328
|
+
// `place.env`); the passes it plays out of the envelope take their own part of the machine,
|
|
329
|
+
// those it plays in its envelope none (its place covers them).
|
|
329
330
|
// A session out of the envelope (the relecteur, which plays tests) plays them on its share of
|
|
330
331
|
// the cores, under nice and ionice; the launcher of an enveloped one does it in the envelope.
|
|
331
332
|
const lancement = horsEnveloppe
|
|
@@ -65,11 +65,11 @@ export const GARDE_DE_LA_MEMOIRE = fileURLToPath(
|
|
|
65
65
|
new URL('./garde-de-la-memoire.mjs', import.meta.url)
|
|
66
66
|
);
|
|
67
67
|
export { ecrirePression, lirePression, SEUIL_PRESSION } from './mesure/pression.mjs';
|
|
68
|
+
export { avecLaPasse, surUnePart } from './passe-de-la-machine.mjs';
|
|
68
69
|
export {
|
|
69
|
-
|
|
70
|
-
surUnePlace,
|
|
70
|
+
nommerLAvancement,
|
|
71
71
|
travailleursDeLaSeance,
|
|
72
72
|
VARIABLE_TRAVAILLEURS,
|
|
73
73
|
} from './places-de-la-machine.mjs';
|
|
74
|
-
export { attendreDeLaPlace, AttenteDeLaMachine
|
|
74
|
+
export { attendreDeLaPlace, AttenteDeLaMachine } from './attente-de-la-machine.mjs';
|
|
75
75
|
export { CONFIG_BEADS, ecrireLePrefixe, prefixe } from './prefixe-des-tickets.mjs';
|
package/scripts/sortie.mjs
CHANGED
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
// refused. Nothing is written when a check fails.
|
|
19
19
|
// - Tagging creates the annotated tag `v<version>` on HEAD, once the release commit is made and
|
|
20
20
|
// the working tree holds no change. Nothing is pushed: the owner validates the push, whose
|
|
21
|
-
// command the script names; `.github/workflows/release.yml` then
|
|
22
|
-
// commit
|
|
21
|
+
// command the script names; `.github/workflows/release.yml` then calls the CI on the tagged
|
|
22
|
+
// commit (which plays nothing again when a branch agent/** already judged that commit) and, once
|
|
23
|
+
// it is green or skipped, checks the tag (`--verifier-etiquette`), publishes the package
|
|
23
24
|
// on the npm registry (trusted publishing, no token stored) and the release on GitHub. The git
|
|
24
25
|
// it runs is passed in (`etiqueter`'s `git`): the command runs git in the repository.
|
|
25
26
|
// - The marketplace roomi-fields (GitHub, roomi-fields/claude-plugins, a repository of its own)
|
|
@@ -36,6 +36,7 @@ export const SOUS_COMMANDES = {
|
|
|
36
36
|
circuit: '../dist/temporal/circuit/commande.js',
|
|
37
37
|
commande: 'verrous/commande.mjs',
|
|
38
38
|
'composants-affectes': 'composants-affectes.mjs',
|
|
39
|
+
consommation: 'consommation.mjs',
|
|
39
40
|
'dependances-internes': 'dependances-internes.mjs',
|
|
40
41
|
droits: 'droits.mjs',
|
|
41
42
|
enveloppe: 'enveloppe/enveloppe.mjs',
|
|
@@ -140,23 +141,21 @@ export function scriptAbsent(nom, script) {
|
|
|
140
141
|
* command of the module of the project's language (`tests`, `verifier`, `construire`…), the
|
|
141
142
|
* ones that run its task runner, gets the module's environment of the poste
|
|
142
143
|
* (`environnementDuPoste`, scripts/jointure.d.ts: the remote cache read-only, when the poste holds
|
|
143
|
-
* its file)
|
|
144
|
-
*
|
|
145
|
-
*
|
|
144
|
+
* its file), and also the tools of the project (`grillhouse.outils`, scripts/outils-cles.mjs) and
|
|
145
|
+
* its data (`grillhouse.donnees`, scripts/donnees-cles.mjs), each variable set to its path,
|
|
146
|
+
* whatever <env> holds; a subcommand of the core gets <env> as it is.
|
|
146
147
|
* @param {string} nom the subcommand
|
|
147
148
|
* @param {string} [racine] the root of the project, the working directory by default
|
|
148
149
|
* @param {Record<string, string | undefined>} [env]
|
|
149
150
|
* @returns {Record<string, string | undefined>}
|
|
150
|
-
* @throws {Error} the faults of the key, for
|
|
151
|
+
* @throws {Error} the faults of the key, for a subcommand of the module of the language
|
|
151
152
|
*/
|
|
152
153
|
export function environnementDe(nom, racine = process.cwd(), env = process.env) {
|
|
153
154
|
if (typeof SOUS_COMMANDES[nom] === 'string') {
|
|
154
155
|
return env;
|
|
155
156
|
}
|
|
156
157
|
const poste = langageDe(racine).environnementDuPoste(env);
|
|
157
|
-
return
|
|
158
|
-
? avecLesDonnees(donneesDe(racine), avecLesOutils(outilsDe(racine), poste))
|
|
159
|
-
: poste;
|
|
158
|
+
return avecLesDonnees(donneesDe(racine), avecLesOutils(outilsDe(racine), poste));
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
// The script of each subcommand in the project at <racine>, where a former copy of the frame lay
|