@roomi-fields/grillhouse 0.54.0 → 0.55.1
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 +75 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
- package/cadre/templates/projet/CONTRIBUTING.md +0 -5
- package/cadre/templates/projet/README.md +0 -126
- package/cadre/templates/projet/_npmignore +1 -6
- package/cadre/templates/projet/package.json +5 -32
- package/cadre/templates/projet/tsconfig.json +4 -4
- package/cadre/templates/projet/vitest.config.cjs +3 -2
- package/charte/tests.md +14 -0
- package/dist/machine/part-par-sorte.d.ts +9 -9
- package/dist/machine/part-par-sorte.js +20 -24
- package/dist/machine/part-par-sorte.js.map +1 -1
- package/dist/machine/table-des-consommations.d.ts +65 -0
- package/dist/machine/table-des-consommations.js +94 -0
- package/dist/machine/table-des-consommations.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +2 -0
- package/dist/temporal/circuit/activites.js +87 -3
- package/dist/temporal/circuit/activites.js.map +1 -1
- package/dist/temporal/circuit/client.js +9 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +32 -4
- package/dist/temporal/circuit/deroule.js +54 -4
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/circuit/versions.d.ts +12 -0
- package/dist/temporal/circuit/versions.js +22 -0
- package/dist/temporal/circuit/versions.js.map +1 -0
- package/dist/temporal/consommation/activites.d.ts +2 -0
- package/dist/temporal/consommation/activites.js +9 -0
- package/dist/temporal/consommation/activites.js.map +1 -0
- package/dist/temporal/consommation/actualisation.d.ts +2 -0
- package/dist/temporal/consommation/actualisation.js +71 -0
- package/dist/temporal/consommation/actualisation.js.map +1 -0
- package/dist/temporal/consommation/client.d.ts +12 -0
- package/dist/temporal/consommation/client.js +28 -0
- package/dist/temporal/consommation/client.js.map +1 -0
- package/dist/temporal/consommation/commande.d.ts +5 -0
- package/dist/temporal/consommation/commande.js +32 -0
- package/dist/temporal/consommation/commande.js.map +1 -0
- package/dist/temporal/consommation/contrat.d.ts +15 -0
- package/dist/temporal/consommation/contrat.js +13 -0
- package/dist/temporal/consommation/contrat.js.map +1 -0
- package/dist/temporal/consommation/deroule.d.ts +2 -0
- package/dist/temporal/consommation/deroule.js +14 -0
- package/dist/temporal/consommation/deroule.js.map +1 -0
- package/dist/temporal/deroules.d.ts +2 -1
- package/dist/temporal/deroules.js +3 -2
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +2 -0
- package/dist/temporal/file/deroule.js +14 -4
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +6 -0
- package/dist/temporal/installation.js +15 -0
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +2 -1
- package/dist/temporal/nuits/activites.js +127 -3
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/client.d.ts +19 -5
- package/dist/temporal/nuits/client.js +33 -23
- package/dist/temporal/nuits/client.js.map +1 -1
- package/dist/temporal/nuits/commande.js +16 -11
- package/dist/temporal/nuits/commande.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +29 -0
- package/dist/temporal/nuits/contrat.js +10 -0
- package/dist/temporal/nuits/contrat.js.map +1 -1
- package/dist/temporal/nuits/deroule.d.ts +5 -0
- package/dist/temporal/nuits/deroule.js +18 -1
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/nuits/pc2.d.ts +72 -0
- package/dist/temporal/nuits/pc2.js +206 -0
- package/dist/temporal/nuits/pc2.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +23 -1
- package/dist/temporal/places/activites.js +38 -2
- package/dist/temporal/places/activites.js.map +1 -1
- package/dist/temporal/places/client.d.ts +16 -0
- package/dist/temporal/places/client.js +25 -1
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +79 -14
- package/dist/temporal/places/contrat.js +7 -0
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +159 -23
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/places/reservation.d.ts +54 -0
- package/dist/temporal/places/reservation.js +69 -0
- package/dist/temporal/places/reservation.js.map +1 -0
- package/dist/temporal/planification.d.ts +6 -0
- package/dist/temporal/planification.js +26 -0
- package/dist/temporal/planification.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +0 -2
- package/dist/temporal/tickets/activites.js +2 -52
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +7 -26
- package/dist/temporal/tickets/deroule.js +35 -23
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/dist/temporal/travailleur.js +2 -0
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/ARCHITECTURE.md +2 -2
- package/docs/CADRE.md +1 -1
- package/docs/INTERFACE.md +16 -11
- package/docs/architecture/circuit.md +62 -58
- package/docs/architecture/entree.md +87 -63
- package/docs/architecture/greffon.md +32 -27
- package/docs/architecture/installation.md +43 -32
- package/docs/architecture/machine.md +48 -40
- package/docs/architecture/tests.md +37 -33
- package/docs/lexique.md +4 -3
- package/package.json +1 -1
- package/scripts/activites.mjs +351 -180
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-de-la-machine.mjs +3 -22
- package/scripts/avancement.mjs +21 -30
- package/scripts/bilan.mjs +22 -2
- package/scripts/branche-de-nuit.mjs +1 -1
- package/scripts/circuit.mjs +75 -39
- package/scripts/codes-de-sortie.mjs +0 -6
- package/scripts/consommation-des-passes.mjs +67 -31
- package/scripts/consommation.mjs +152 -24
- package/scripts/copies-finies.mjs +15 -35
- package/scripts/dernier-vert.mjs +4 -5
- package/scripts/dette.mjs +5 -3
- package/scripts/droits.mjs +2 -2
- package/scripts/echantillonneur-de-la-passe.mjs +7 -31
- package/scripts/engendres.mjs +5 -61
- package/scripts/enveloppe/enveloppe.mjs +30 -34
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
- package/scripts/etapes.mjs +21 -7
- package/scripts/etat-du-depot.mjs +61 -0
- package/scripts/faits-du-circuit.mjs +7 -4
- package/scripts/fermeture-de-la-machine.d.mts +6 -4
- package/scripts/fermeture-de-la-machine.mjs +12 -16
- package/scripts/fichier-du-poste.d.mts +9 -0
- package/scripts/file-des-tickets.d.mts +0 -18
- package/scripts/file-des-tickets.mjs +0 -42
- package/scripts/fusion-du-changelog.mjs +1 -1
- package/scripts/greffons.mjs +282 -17
- package/scripts/grillhouse-maj.mjs +1 -1
- package/scripts/index-des-rouges.d.mts +40 -0
- package/scripts/index-des-rouges.mjs +104 -0
- package/scripts/integration/file.mjs +13 -63
- package/scripts/integration/integrer.mjs +157 -424
- package/scripts/integration/jugement.mjs +109 -0
- package/scripts/integration/rejeu.mjs +94 -71
- package/scripts/jointure.d.ts +34 -27
- package/scripts/journal-des-etats.d.mts +1 -1
- package/scripts/langages/c/commandes.mjs +27 -12
- package/scripts/langages/cargo/commandes.mjs +148 -94
- package/scripts/langages/cargo/index.mjs +2 -1
- package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
- package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/python/commandes.mjs +31 -15
- package/scripts/langages/python/index.mjs +2 -1
- package/scripts/langages/python/lectures-des-tests.mjs +148 -0
- package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
- package/scripts/langages/typescript/index.mjs +4 -0
- package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
- package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
- package/scripts/langages/typescript/tests.mjs +11 -37
- package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
- package/scripts/langages/typescript/verifier.mjs +74 -44
- package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
- package/scripts/lectures-communes.mjs +234 -0
- package/scripts/machine.mjs +11 -18
- package/scripts/mesure/base-de-passe.mjs +1 -2
- package/scripts/mesure-de-la-machine.d.mts +40 -3
- package/scripts/mesure-de-la-machine.mjs +201 -11
- package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
- package/scripts/migrations/nuit-yml-retire.mjs +25 -0
- package/scripts/migrations/part-retiree.mjs +31 -0
- package/scripts/migrations.mjs +4 -0
- package/scripts/montee.mjs +22 -1
- package/scripts/nuit-de-pc2.mjs +628 -0
- package/scripts/nuit.sh +8 -131
- package/scripts/paquets.mjs +1 -1
- package/scripts/passe-de-la-machine.mjs +340 -103
- package/scripts/place-du-circuit.d.mts +15 -0
- package/scripts/place-du-circuit.mjs +32 -0
- package/scripts/places-de-la-machine.mjs +148 -626
- package/scripts/places-du-serveur.mjs +26 -13
- package/scripts/plafond-de-la-machine.d.mts +8 -13
- package/scripts/plafond-de-la-machine.mjs +26 -56
- package/scripts/registre-des-entrees.mjs +57 -0
- package/scripts/regles-des-places.d.mts +82 -50
- package/scripts/regles-des-places.mjs +192 -156
- package/scripts/retirer-copie.sh +9 -2
- package/scripts/seances.mjs +181 -63
- package/scripts/secours.mjs +95 -0
- package/scripts/services-du-noyau.mjs +11 -19
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/sous-modules.sh +1 -1
- package/scripts/superviseur.mjs +98 -20
- package/scripts/table-des-consommations.d.mts +9 -0
- package/scripts/table-des-consommations.mjs +35 -0
- package/scripts/tableau.mjs +33 -19
- package/scripts/taches-du-graphe.mjs +124 -2
- package/scripts/transitions.d.mts +27 -5
- package/scripts/transitions.mjs +122 -104
- package/scripts/verdict-de-la-nuit.d.mts +13 -0
- package/scripts/verdict-de-la-nuit.mjs +34 -7
- package/scripts/verrou-de-fichier.mjs +1 -2
- package/scripts/workflows-du-cadre.mjs +2 -2
- package/skills/developpeur/SKILL.md +8 -2
- package/skills/direct/SKILL.md +5 -0
- package/skills/explorateur/SKILL.md +10 -1
- package/skills/grill/SKILL.md +2 -4
- package/skills/pitmaster/SKILL.md +14 -7
- package/skills/pitmaster/references/consigne-agent.md +1 -1
- package/skills/relecteur/SKILL.md +4 -1
- package/skills/testwriter/SKILL.md +15 -2
- package/cadre/templates/projet/.env.example +0 -57
- package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
- package/cadre/templates/projet/deployment/README.md +0 -98
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
- package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
- package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
- package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
- package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
- package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
- package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
- package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
- package/cadre/templates/projet/ecosystem.config.cjs +0 -73
- package/cadre/templates/projet/src/config.ts +0 -68
- package/cadre/templates/projet/src/errors.ts +0 -102
- package/cadre/templates/projet/src/index.ts +0 -46
- package/cadre/templates/projet/src/services/.gitkeep +0 -8
- package/cadre/templates/projet/src/types/index.ts +0 -24
- package/cadre/templates/projet/src/utils/logger.ts +0 -106
- package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
- package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
- package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
- package/cadre/templates/projet/tsconfig.build.json +0 -14
- package/scripts/flux-de-la-nuit.mjs +0 -39
- package/scripts/garde-de-la-memoire.mjs +0 -231
- package/scripts/repli-de-la-nuit.mjs +0 -184
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
// node places-du-serveur.mjs rouvrir
|
|
14
14
|
//
|
|
15
15
|
// - Each mode first starts the workflow of the machine when none runs (`demarrerLesPlaces`, on the
|
|
16
|
-
// task queue of the worker of the machine)
|
|
17
|
-
//
|
|
16
|
+
// task queue of the worker of the machine); it reads its ceiling and its budget from the poste
|
|
17
|
+
// itself.
|
|
18
18
|
// - `rang` writes the next rank of arrival of the machine, which a circuit draws at its launch.
|
|
19
|
-
// - `prendre` asks for a
|
|
20
|
-
// rappelMs }`, the process that holds it), then waits for it: each line it says, at the start of
|
|
19
|
+
// - `prendre` asks for a reservation for <demande> (JSON: `{ pid, depart, ticket, rang, coeurs,
|
|
20
|
+
// memoire, borneMs, rappelMs }`, the process that holds it), then waits for it: each line it says, at the start of
|
|
21
21
|
// a wait and every <rappelMs>, is one JSON line `{ dire }` on the standard output, then the place
|
|
22
22
|
// given, `{ id, rang }`. At the bound <borneMs>, the request is withdrawn, its line said, exit 75.
|
|
23
23
|
// - `rendre` gives the place <id> back (or withdraws its request), `rattacher` names the process
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
// transiently. Still failing, its port open: the server is busy, said on the error stream, exit
|
|
30
30
|
// 75. A port refused (no server), another failure, or a client not built: said on the error
|
|
31
31
|
// stream, exit 1. A malformed call, exit 2.
|
|
32
|
+
import { spawnSync } from 'node:child_process';
|
|
32
33
|
import { randomUUID } from 'node:crypto';
|
|
33
34
|
import { existsSync } from 'node:fs';
|
|
34
35
|
import net from 'node:net';
|
|
@@ -111,12 +112,9 @@ export function ecoute(adresse, delaiMs = 2_000) {
|
|
|
111
112
|
// How often a wait reads its request again.
|
|
112
113
|
const VEILLE_MS = 1_000;
|
|
113
114
|
|
|
114
|
-
// The
|
|
115
|
-
// workflow
|
|
116
|
-
const entreeDe =
|
|
117
|
-
const { espacementDe } = await import('./places-de-la-machine.mjs');
|
|
118
|
-
return { espacementMs: espacementDe(env), veilleMs: 1_000 };
|
|
119
|
-
};
|
|
115
|
+
// The entry of the workflow of the machine: its veille, a second. The ceiling and the budget, the
|
|
116
|
+
// workflow reads from the poste at each judgement.
|
|
117
|
+
const entreeDe = () => ({ veilleMs: 1_000 });
|
|
120
118
|
|
|
121
119
|
const MODES = { rang: 0, prendre: 1, rendre: 1, rattacher: 3, lire: 0, fermer: 0, rouvrir: 0 };
|
|
122
120
|
const ecrire = o => process.stdout.write(`${JSON.stringify(o)}\n`);
|
|
@@ -167,6 +165,21 @@ export async function attendreLaPlace(
|
|
|
167
165
|
}
|
|
168
166
|
}
|
|
169
167
|
|
|
168
|
+
// Builds the package (`npm run build`) when the
|
|
169
|
+
// client is not yet built, so a fresh copy (the final pass of the queue) asks the arbiter without
|
|
170
|
+
// a build of its own before; false when the build fails, its output on the error stream.
|
|
171
|
+
function construireLeClient() {
|
|
172
|
+
const racine = path.join(import.meta.dirname, '..');
|
|
173
|
+
const r = spawnSync('npm', ['run', 'build'], {
|
|
174
|
+
cwd: racine,
|
|
175
|
+
encoding: 'utf8',
|
|
176
|
+
});
|
|
177
|
+
if (r.status !== 0) {
|
|
178
|
+
process.stderr.write(`${r.stdout ?? ''}${r.stderr ?? ''}${r.error?.message ?? ''}\n`);
|
|
179
|
+
}
|
|
180
|
+
return r.status === 0 && existsSync(path.join(DIST, 'places', 'client.js'));
|
|
181
|
+
}
|
|
182
|
+
|
|
170
183
|
// The call <mode> with <args>: its exit code.
|
|
171
184
|
async function principal(mode, args) {
|
|
172
185
|
if (!Object.hasOwn(MODES, mode ?? '') || args.length !== MODES[mode]) {
|
|
@@ -175,9 +188,9 @@ async function principal(mode, args) {
|
|
|
175
188
|
);
|
|
176
189
|
return 2;
|
|
177
190
|
}
|
|
178
|
-
if (!existsSync(path.join(DIST, 'places', 'client.js'))) {
|
|
191
|
+
if (!existsSync(path.join(DIST, 'places', 'client.js')) && !construireLeClient()) {
|
|
179
192
|
process.stderr.write(
|
|
180
|
-
`le client Temporal n'est pas construit (${DIST})
|
|
193
|
+
`le client Temporal n'est pas construit (${DIST}) et sa construction échoue, \`npm run build --workspace @roomi-fields/grillhouse\`.\n`
|
|
181
194
|
);
|
|
182
195
|
return 1;
|
|
183
196
|
}
|
|
@@ -192,7 +205,7 @@ async function principal(mode, args) {
|
|
|
192
205
|
try {
|
|
193
206
|
try {
|
|
194
207
|
await sous(async () =>
|
|
195
|
-
places.demarrerLesPlaces(c.client,
|
|
208
|
+
places.demarrerLesPlaces(c.client, entreeDe(), {
|
|
196
209
|
file: FILE_DE_LA_MACHINE,
|
|
197
210
|
})
|
|
198
211
|
);
|
|
@@ -41,19 +41,14 @@ export function budgetDe(
|
|
|
41
41
|
reserve: PartDeLaPasse
|
|
42
42
|
): PartDeLaPasse;
|
|
43
43
|
|
|
44
|
-
/** The reservation of a pass:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/** The part a project declares in `grillhouse.part` of its package.json, or the fault naming it. */
|
|
53
|
-
export function partDeclareeDe(pkg: { grillhouse?: unknown } | null | undefined): {
|
|
54
|
-
declaree: { coeurs?: number; memoire?: number } | null;
|
|
55
|
-
faute: string | null;
|
|
56
|
-
};
|
|
44
|
+
/** The default reservation of a pass: 3 cores within the budget, the default memory within it. */
|
|
45
|
+
export function partDe(o: { budget: PartDeLaPasse; pic?: number }): PartDeLaPasse;
|
|
46
|
+
|
|
47
|
+
/** The ceiling of a part without a measure: its reservation plus a quarter, within the budget. */
|
|
48
|
+
export function plafondDeDepart(
|
|
49
|
+
part: PartDeLaPasse,
|
|
50
|
+
budget: PartDeLaPasse
|
|
51
|
+
): { limite: number; limiteCoeurs: number };
|
|
57
52
|
|
|
58
53
|
/** The hardware of this machine: its cores and its total memory (bytes). */
|
|
59
54
|
export function materielDeLaMachine(): { coeurs: number; memoireTotale: number };
|
|
@@ -11,22 +11,18 @@
|
|
|
11
11
|
// 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
13
|
//
|
|
14
|
-
// The budget of the machine and the
|
|
15
|
-
// as input, nothing read from the machine):
|
|
14
|
+
// The budget of the machine and the default reservation of a pass (functions with the hardware and
|
|
15
|
+
// the settings as input, nothing read from the machine):
|
|
16
16
|
// - The reserve of the user, the share of the machine no pass takes: GRILLHOUSE_RESERVE_COEURS
|
|
17
17
|
// (by default min(4, max(0, cores − 4)): 0 on 4 cores or fewer, 2 on 6, 4 from 8) and
|
|
18
18
|
// GRILLHOUSE_RESERVE_MEMOIRE_GO (4 GB), the environment first, then `machine.env`; zero is
|
|
19
19
|
// admitted, a value that is not a whole number ≥ 0 is refused by its name.
|
|
20
20
|
// - The budget is the cores and the memory of the machine less the reserve; a reserve that leaves
|
|
21
21
|
// no core or no memory is refused by its name.
|
|
22
|
-
// - The
|
|
23
|
-
// least
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
// share of the budget that max(4, a third of its cores) cores hold, which it is without a
|
|
27
|
-
// measure). A part larger than the budget is the budget (one pass at a time). That memory stands
|
|
28
|
-
// for a sort of pass the register measured less than 20 times (`partDeLaPasse` of
|
|
29
|
-
// ./places-de-la-machine.mjs).
|
|
22
|
+
// - The default reservation of a pass (`partDe`) is 3 cores, within the budget and one core at
|
|
23
|
+
// least, and its memory the share of the budget that max(4, a third of its cores) cores hold,
|
|
24
|
+
// raised to the largest peak given plus a quarter, within the budget. A project's table of the
|
|
25
|
+
// consumptions gives a phase its own (`reservationDeLaPasse` of ./places-de-la-machine.mjs).
|
|
30
26
|
import { readFileSync } from 'node:fs';
|
|
31
27
|
import { cpus, totalmem } from 'node:os';
|
|
32
28
|
import path from 'node:path';
|
|
@@ -96,7 +92,9 @@ function fichierDuPoste(env) {
|
|
|
96
92
|
function entierDuPoste(env, nom, defaut, lire) {
|
|
97
93
|
const dedans = env[nom] !== undefined && env[nom] !== '';
|
|
98
94
|
const fichier = variablesDuTexte(
|
|
99
|
-
(lire
|
|
95
|
+
(lire
|
|
96
|
+
? lire(path.join(configurationDuPoste(env) ?? '', FICHIER_DE_LA_MACHINE))
|
|
97
|
+
: fichierDuPoste(env)) ?? ''
|
|
100
98
|
);
|
|
101
99
|
const v = dedans ? env[nom] : fichier[nom];
|
|
102
100
|
if (v === undefined || v === '') {
|
|
@@ -175,59 +173,31 @@ function memoireParDefautDe(budget, pic) {
|
|
|
175
173
|
}
|
|
176
174
|
|
|
177
175
|
/**
|
|
178
|
-
* The reservation of a pass:
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
176
|
+
* The default reservation of a pass: 3 cores within the budget and one core at least, its memory
|
|
177
|
+
* the default memory within the budget. A project's table of the consumptions gives a phase its own
|
|
178
|
+
* measure (`reservationDeLaPasse` of ./places-de-la-machine.mjs); no key of its `package.json`
|
|
179
|
+
* enters it.
|
|
180
|
+
* @param {{ budget: { coeurs: number, memoire: number }, pic?: number }} o
|
|
183
181
|
* @returns {{ coeurs: number, memoire: number }}
|
|
184
182
|
*/
|
|
185
|
-
export function partDe({
|
|
186
|
-
const voulus = declaree?.coeurs ?? COEURS_PAR_DEFAUT;
|
|
183
|
+
export function partDe({ budget, pic }) {
|
|
187
184
|
return {
|
|
188
|
-
coeurs: Math.max(1, Math.min(budget.coeurs,
|
|
189
|
-
memoire: Math.min(budget.memoire,
|
|
185
|
+
coeurs: Math.max(1, Math.min(budget.coeurs, COEURS_PAR_DEFAUT)),
|
|
186
|
+
memoire: Math.min(budget.memoire, memoireParDefautDe(budget, pic)),
|
|
190
187
|
};
|
|
191
188
|
}
|
|
192
189
|
|
|
193
190
|
/**
|
|
194
|
-
* The
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* @param {{
|
|
198
|
-
* @returns {{
|
|
191
|
+
* The ceiling of a part without a measure of its phase: its reservation plus a quarter, cores
|
|
192
|
+
* rounded up to the whole core, memory in bytes, both within the <budget>.
|
|
193
|
+
* @param {{ coeurs: number, memoire: number }} part
|
|
194
|
+
* @param {{ coeurs: number, memoire: number }} budget
|
|
195
|
+
* @returns {{ limite: number, limiteCoeurs: number }}
|
|
199
196
|
*/
|
|
200
|
-
export
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
const faute = dit => ({
|
|
206
|
-
declaree: null,
|
|
207
|
-
faute: `grillhouse.part : ${dit} ({ "coeurs": <entier ≥ 1>, "memoireGo": <nombre > 0> } est attendu).`,
|
|
208
|
-
});
|
|
209
|
-
if (part === null || typeof part !== 'object' || Array.isArray(part)) {
|
|
210
|
-
return faute(`« ${JSON.stringify(part)} » n’est pas un objet`);
|
|
211
|
-
}
|
|
212
|
-
const inconnue = Object.keys(part).find(k => k !== 'coeurs' && k !== 'memoireGo');
|
|
213
|
-
if (inconnue !== undefined) {
|
|
214
|
-
return faute(`la clé « ${inconnue} » est inconnue`);
|
|
215
|
-
}
|
|
216
|
-
const { coeurs, memoireGo } = part;
|
|
217
|
-
if (coeurs !== undefined && !(Number.isInteger(coeurs) && coeurs >= 1)) {
|
|
218
|
-
return faute(`coeurs vaut ${JSON.stringify(coeurs)}`);
|
|
219
|
-
}
|
|
220
|
-
if (memoireGo !== undefined && !(typeof memoireGo === 'number' && memoireGo > 0)) {
|
|
221
|
-
return faute(`memoireGo vaut ${JSON.stringify(memoireGo)}`);
|
|
222
|
-
}
|
|
223
|
-
return {
|
|
224
|
-
declaree: {
|
|
225
|
-
...(coeurs === undefined ? {} : { coeurs }),
|
|
226
|
-
...(memoireGo === undefined ? {} : { memoire: memoireGo * GO }),
|
|
227
|
-
},
|
|
228
|
-
faute: null,
|
|
229
|
-
};
|
|
230
|
-
}
|
|
197
|
+
export const plafondDeDepart = (part, budget) => ({
|
|
198
|
+
limite: Math.min(budget.memoire, Math.floor(part.memoire * 1.25)),
|
|
199
|
+
limiteCoeurs: Math.max(1, Math.min(budget.coeurs, Math.ceil(part.coeurs * 1.25 - 1e-9))),
|
|
200
|
+
});
|
|
231
201
|
|
|
232
202
|
/**
|
|
233
203
|
* The hardware of this machine: its cores and its total memory (bytes).
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// The registry of the entries of the queue (`.claude/file-des-entrees.jsonl`, entree.md §4): one
|
|
2
|
+
// line per ticket entered, `{ ticket, quand, mainABouge }`, `mainABouge` true when the lot was laid
|
|
3
|
+
// again on main's tip and judged again, false when the tree already judged entered. The queue
|
|
4
|
+
// writes it (`releverLEntree`); `npx grillhouse bilan --file` reads the rate of replay there
|
|
5
|
+
// (`tauxDeRejeu`), the measure that decides later whether the lots waiting are grouped.
|
|
6
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
|
|
9
|
+
export const REGISTRE_DES_ENTREES = path.join('.claude', 'file-des-entrees.jsonl');
|
|
10
|
+
|
|
11
|
+
// The lines of the registry of the project <racine>, each a parsed object; a line that is no JSON
|
|
12
|
+
// is left out.
|
|
13
|
+
function lignesDe(racine) {
|
|
14
|
+
const fichier = path.join(racine, REGISTRE_DES_ENTREES);
|
|
15
|
+
if (!existsSync(fichier)) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
return readFileSync(fichier, 'utf8')
|
|
19
|
+
.split('\n')
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.flatMap(l => {
|
|
22
|
+
try {
|
|
23
|
+
return [JSON.parse(l)];
|
|
24
|
+
} catch {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The entry <entree> (`{ ticket, mainABouge }`) added to the registry of <racine>; an entry played
|
|
32
|
+
* again after an incident adds no second line.
|
|
33
|
+
*/
|
|
34
|
+
export function releverLEntree(racine, entree) {
|
|
35
|
+
if (lignesDe(racine).some(l => l.ticket === entree.ticket)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const fichier = path.join(racine, REGISTRE_DES_ENTREES);
|
|
39
|
+
mkdirSync(path.dirname(fichier), { recursive: true });
|
|
40
|
+
const ligne = {
|
|
41
|
+
ticket: entree.ticket,
|
|
42
|
+
quand: new Date().toISOString(),
|
|
43
|
+
mainABouge: entree.mainABouge === true,
|
|
44
|
+
};
|
|
45
|
+
appendFileSync(fichier, `${JSON.stringify(ligne)}\n`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The rate of replay of the project <racine>: `{ rejeux, entrees, pourcent }`, pourcent null without entry. */
|
|
49
|
+
export function tauxDeRejeu(racine) {
|
|
50
|
+
const lignes = lignesDe(racine);
|
|
51
|
+
const rejeux = lignes.filter(l => l.mainABouge === true).length;
|
|
52
|
+
return {
|
|
53
|
+
rejeux,
|
|
54
|
+
entrees: lignes.length,
|
|
55
|
+
pourcent: lignes.length ? Math.round((100 * rejeux) / lignes.length) : null,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -4,16 +4,57 @@
|
|
|
4
4
|
/** The memory a start wants free, in bytes: 4 GB. */
|
|
5
5
|
export const MEMOIRE_MIN: number;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/** The
|
|
11
|
-
export
|
|
7
|
+
/** The sort of the verification of the update, which the closure of the machine does not refuse. */
|
|
8
|
+
export const SORTE_DE_LA_MONTEE: string;
|
|
9
|
+
|
|
10
|
+
/** The steps of the overbooking of the memory: 1, 1,2 and 1,5. */
|
|
11
|
+
export const CRANS: number[];
|
|
12
|
+
|
|
13
|
+
/** The level of the memory: calm, alert (pressure above 10 % or swap on disk serving) or threat. */
|
|
14
|
+
export function niveauDeLaMemoire(m: {
|
|
15
|
+
pression: number | null;
|
|
16
|
+
disponible: number | null;
|
|
17
|
+
echangeEnMemoire: number;
|
|
18
|
+
echangeSurDisque: boolean;
|
|
19
|
+
}): 'calme' | 'alerte' | 'menace';
|
|
20
|
+
|
|
21
|
+
/** Whether an alert is lifted: under the threshold for a minute, the swap on disk not growing. */
|
|
22
|
+
export function alerteLevee(o: {
|
|
23
|
+
sousLeSeuilDepuis: number | null;
|
|
24
|
+
maintenant: number;
|
|
25
|
+
echangeSurDisqueGrandit: boolean;
|
|
26
|
+
}): boolean;
|
|
27
|
+
|
|
28
|
+
/** The ids of the steps in the order a threat stops them. */
|
|
29
|
+
export function ordreDArret(
|
|
30
|
+
etapes: readonly {
|
|
31
|
+
id: string;
|
|
32
|
+
memoire: number;
|
|
33
|
+
reservation: number;
|
|
34
|
+
passe: boolean;
|
|
35
|
+
depuis: number;
|
|
36
|
+
}[]
|
|
37
|
+
): string[];
|
|
38
|
+
|
|
39
|
+
/** The step of the overbooking after a moment: down on a signal, up after three days without one. */
|
|
40
|
+
export function ajusterLeCran(o: {
|
|
41
|
+
cran: number;
|
|
42
|
+
depuis: number;
|
|
43
|
+
maintenant: number;
|
|
44
|
+
signal: string | null;
|
|
45
|
+
}): {
|
|
46
|
+
cran: number;
|
|
47
|
+
depuis: number;
|
|
48
|
+
changement: { de: number; a: number; raison: string; instant: number } | null;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/** How long after its grant a step is not yet read by the measure of the machine, in ms. */
|
|
52
|
+
export const FENETRE_DE_DEPART_MS: number;
|
|
12
53
|
|
|
13
54
|
/** A duration as a line says it: seconds under 2 min, else minutes. */
|
|
14
55
|
export function duree(ms: number): string;
|
|
15
56
|
|
|
16
|
-
/** What the machine gives at a moment: its cores,
|
|
57
|
+
/** What the machine gives at a moment: its cores, the cores occupied over ten seconds, its free memory. */
|
|
17
58
|
export interface MesureDeLaMachine {
|
|
18
59
|
coeurs: number;
|
|
19
60
|
charge: number;
|
|
@@ -21,29 +62,46 @@ export interface MesureDeLaMachine {
|
|
|
21
62
|
memoireLibre: number;
|
|
22
63
|
}
|
|
23
64
|
|
|
24
|
-
/**
|
|
25
|
-
export
|
|
65
|
+
/** How many times a wait may be passed before nothing passes it more. */
|
|
66
|
+
export const PASSAGES_MAX: number;
|
|
26
67
|
|
|
27
|
-
/**
|
|
28
|
-
export function
|
|
68
|
+
/** Each wait of a rank lower than the granted request <id> gains a passage (state changed in place). */
|
|
69
|
+
export function compterLesPassages(
|
|
70
|
+
etat: { attentes: { id: string; rang: number; passages?: number }[] },
|
|
71
|
+
o: { id: string; rang: number }
|
|
72
|
+
): void;
|
|
73
|
+
|
|
74
|
+
/** Why the reservation of a step is not granted now on a state of the places, null when it is. */
|
|
75
|
+
export function refusDeLaReservation(
|
|
29
76
|
etat: {
|
|
30
|
-
prises: readonly
|
|
77
|
+
prises: readonly {
|
|
78
|
+
id?: string;
|
|
79
|
+
coeurs: number;
|
|
80
|
+
memoire: number;
|
|
81
|
+
depuis?: number;
|
|
82
|
+
ticket?: string | null;
|
|
83
|
+
}[];
|
|
31
84
|
attentes: readonly {
|
|
32
85
|
id: string;
|
|
33
86
|
rang: number;
|
|
34
87
|
ticket?: string | null;
|
|
35
88
|
raison?: string;
|
|
89
|
+
/** The requests that fit and were granted before it. */
|
|
90
|
+
passages?: number;
|
|
36
91
|
}[];
|
|
37
|
-
dernier: number;
|
|
38
92
|
reservation?: ReservationDeLaMachine | null;
|
|
39
93
|
},
|
|
40
94
|
o: {
|
|
41
95
|
id: string;
|
|
42
96
|
rang: number;
|
|
43
|
-
|
|
44
|
-
|
|
97
|
+
reservation: { coeurs: number; memoire: number };
|
|
98
|
+
budget: { coeurs: number; memoire: number };
|
|
45
99
|
maintenant: number;
|
|
46
100
|
mesurer: () => MesureDeLaMachine;
|
|
101
|
+
/** The step of the overbooking, which multiplies the memory of the budget (1 by default). */
|
|
102
|
+
cran?: number;
|
|
103
|
+
/** A reservation the closure of the machine does not refuse (the update of the frame). */
|
|
104
|
+
exemptee?: boolean;
|
|
47
105
|
}
|
|
48
106
|
): string | null;
|
|
49
107
|
|
|
@@ -53,49 +111,18 @@ export interface PartDeLaPasse {
|
|
|
53
111
|
memoire: number;
|
|
54
112
|
}
|
|
55
113
|
|
|
56
|
-
/** What a
|
|
57
|
-
export type CeQueAttendUnePart = 'cœurs' | 'mémoire'
|
|
114
|
+
/** What a reservation waits for in the budget: its cores or its memory. */
|
|
115
|
+
export type CeQueAttendUnePart = 'cœurs' | 'mémoire';
|
|
58
116
|
|
|
59
117
|
/** Whether a part fits in what the parts held leave of the budget; a refusal says what it waits for. */
|
|
60
118
|
export function partDansLeBudget(o: {
|
|
61
119
|
part: PartDeLaPasse;
|
|
62
120
|
budget: PartDeLaPasse;
|
|
63
121
|
prises: readonly PartDeLaPasse[];
|
|
122
|
+
/** The step of the overbooking, which multiplies the memory of the budget, not its cores. */
|
|
123
|
+
cran?: number;
|
|
64
124
|
}): { ok: boolean; attend?: CeQueAttendUnePart; raison?: string };
|
|
65
125
|
|
|
66
|
-
/** Whether a pass of the part <part> is admitted: its part fits in the budget left, then the load and
|
|
67
|
-
* the memory of the machine admit it; a refusal says what it waits for, with its figures. */
|
|
68
|
-
export function admissionDePart(o: {
|
|
69
|
-
part: PartDeLaPasse;
|
|
70
|
-
budget: PartDeLaPasse;
|
|
71
|
-
prises: readonly PartDeLaPasse[];
|
|
72
|
-
mesure: MesureDeLaMachine;
|
|
73
|
-
}): { ok: boolean; attend?: CeQueAttendUnePart; raison?: string };
|
|
74
|
-
|
|
75
|
-
/** Why a pass does not take its part now on a state of the parts, null when it does. */
|
|
76
|
-
export function refusDePart(
|
|
77
|
-
etat: {
|
|
78
|
-
prises: readonly { id?: string; coeurs: number; memoire: number }[];
|
|
79
|
-
attentes: readonly { id: string; rang: number; ticket?: string | null; raison?: string }[];
|
|
80
|
-
},
|
|
81
|
-
o: {
|
|
82
|
-
id: string;
|
|
83
|
-
rang: number;
|
|
84
|
-
part: PartDeLaPasse;
|
|
85
|
-
budget: PartDeLaPasse;
|
|
86
|
-
mesurer: () => MesureDeLaMachine;
|
|
87
|
-
dediee?: boolean;
|
|
88
|
-
/** The reservation of the machine read this turn, null without. */
|
|
89
|
-
reservation?: ReservationDeLaMachine | null;
|
|
90
|
-
}
|
|
91
|
-
): string | null;
|
|
92
|
-
|
|
93
|
-
/** Why a pass waits under the supervisor's closure of the machine. */
|
|
94
|
-
export const RAISON_DE_LA_FERMETURE: string;
|
|
95
|
-
|
|
96
|
-
/** A place of a circuit not given by its project's queue for this long is gone, in ms: 10 min. */
|
|
97
|
-
export const PERIME_MS: number;
|
|
98
|
-
|
|
99
126
|
/** The reservation of the machine: the supervisor's closure, the only one. */
|
|
100
127
|
export interface ReservationDeLaMachine {
|
|
101
128
|
auteur?: 'superviseur';
|
|
@@ -118,7 +145,6 @@ export interface PlaceDeCircuit {
|
|
|
118
145
|
rang: number;
|
|
119
146
|
accordee: boolean;
|
|
120
147
|
depuis: number;
|
|
121
|
-
vu: number;
|
|
122
148
|
/** A circuit resumed after its question, which asks again by itself. */
|
|
123
149
|
reprise?: boolean;
|
|
124
150
|
/** Why it waits apart from the order of arrival (its disk of copies), null without. */
|
|
@@ -153,3 +179,9 @@ export function reserverDesCircuits(
|
|
|
153
179
|
},
|
|
154
180
|
o: { rang: number; plafond: number; maintenant: number; reservee?: boolean }
|
|
155
181
|
): { circuits: PlaceDeCircuit[]; rang: number; accordes: string[] };
|
|
182
|
+
|
|
183
|
+
/** The places once a circuit gives its place back: its place is taken off the limit and the ceiling. */
|
|
184
|
+
export function rendreSaPlace<P extends { racine: string; ticket: string }>(
|
|
185
|
+
places: readonly P[],
|
|
186
|
+
q: { racine: string; ticket: string }
|
|
187
|
+
): P[];
|