@roomi-fields/grillhouse 0.54.1 → 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 +69 -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 +24 -21
- package/docs/architecture/installation.md +35 -30
- 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/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 +9 -0
- 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 +2 -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 +16 -7
- 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 +7 -5
- 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
|
@@ -1,38 +1,118 @@
|
|
|
1
|
-
// The rules of the places of the machine, with no input nor output:
|
|
2
|
-
//
|
|
3
|
-
// not pass now. The workflow of the machine (src/temporal/places/) decides by them and bundles
|
|
1
|
+
// The rules of the places of the machine, with no input nor output: why the reservation
|
|
2
|
+
// of a step is not granted now, and the places of the circuits. The workflow of the machine (src/temporal/places/) decides by them and bundles
|
|
4
3
|
// this module, which imports nothing; the load and the memory come from
|
|
5
4
|
// scripts/mesure-de-la-machine.mjs. Architecture: docs/architecture/machine.md (§3.1, §5.2).
|
|
6
5
|
|
|
7
6
|
/** The memory a start wants free, in bytes: 4 GB. */
|
|
8
7
|
export const MEMOIRE_MIN = 4 * 1024 ** 3;
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
export const
|
|
9
|
+
/** The pressure of the memory (%) above which the watch of the arbiter is on alert. */
|
|
10
|
+
export const SEUIL_D_ALERTE = 10;
|
|
11
|
+
/** The pressure of the memory (%) at which the memory is threatened: a step is stopped. */
|
|
12
|
+
export const SEUIL_DE_MENACE = 50;
|
|
13
|
+
/** How long the pressure stays under the alert, and the swap on disk stops growing, to lift it, in ms. */
|
|
14
|
+
export const DUREE_DE_LA_LEVEE_MS = 60_000;
|
|
15
|
+
/**
|
|
16
|
+
* The steps of the overbooking of the memory the admission counts: the memory of the budget is
|
|
17
|
+
* multiplied by the step in force (the cores are not).
|
|
18
|
+
*/
|
|
19
|
+
export const CRANS = [1, 1.2, 1.5];
|
|
20
|
+
/** How long without alert nor stop for lack of memory before the step goes up, in ms: three days. */
|
|
21
|
+
export const DELAI_DE_MONTEE_MS = 3 * 24 * 3600 * 1000;
|
|
16
22
|
|
|
17
23
|
/**
|
|
18
|
-
* The
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
24
|
+
* The level of the memory of the machine, the three levels of the watch of the arbiter
|
|
25
|
+
* (machine.md §5.3): `menace` at a pressure of 50 % or more, or the memory available and the swap
|
|
26
|
+
* held in memory together under MEMOIRE_MIN; `alerte` above a pressure of 10 %, or when the swap
|
|
27
|
+
* on disk serves; else `calme`. A field that is null says nothing.
|
|
28
|
+
* @param {{ pression: number | null, disponible: number | null, echangeEnMemoire: number,
|
|
29
|
+
* echangeSurDisque: boolean }} m bytes, %
|
|
30
|
+
* @returns {'calme' | 'alerte' | 'menace'}
|
|
22
31
|
*/
|
|
23
|
-
export function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
export function niveauDeLaMemoire({ pression, disponible, echangeEnMemoire, echangeSurDisque }) {
|
|
33
|
+
if (
|
|
34
|
+
(pression !== null && pression >= SEUIL_DE_MENACE) ||
|
|
35
|
+
(disponible !== null && disponible + echangeEnMemoire < MEMOIRE_MIN)
|
|
36
|
+
) {
|
|
37
|
+
return 'menace';
|
|
27
38
|
}
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
`${VARIABLE_ESPACEMENT} vaut « ${v} » : un nombre de millisecondes est attendu.`
|
|
31
|
-
);
|
|
39
|
+
if ((pression !== null && pression > SEUIL_D_ALERTE) || echangeSurDisque) {
|
|
40
|
+
return 'alerte';
|
|
32
41
|
}
|
|
33
|
-
return
|
|
42
|
+
return 'calme';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Whether an alert is lifted: the pressure stayed under the threshold since `sousLeSeuilDepuis`
|
|
47
|
+
* (ms, null while it is not under) for DUREE_DE_LA_LEVEE_MS at least, and the swap on disk does
|
|
48
|
+
* not grow any more.
|
|
49
|
+
* @param {{ sousLeSeuilDepuis: number | null, maintenant: number, echangeSurDisqueGrandit: boolean }} o
|
|
50
|
+
* @returns {boolean}
|
|
51
|
+
*/
|
|
52
|
+
export const alerteLevee = ({ sousLeSeuilDepuis, maintenant, echangeSurDisqueGrandit }) =>
|
|
53
|
+
sousLeSeuilDepuis !== null &&
|
|
54
|
+
maintenant - sousLeSeuilDepuis >= DUREE_DE_LA_LEVEE_MS &&
|
|
55
|
+
!echangeSurDisqueGrandit;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The ids of the steps in the order a threat stops them: first those beyond their reservation, the
|
|
59
|
+
* largest in proportion of it first; then the others, the largest in memory first; on equality a
|
|
60
|
+
* pass before a session, then the most recent before the oldest.
|
|
61
|
+
* @param {{ id: string, memoire: number, reservation: number, passe: boolean, depuis: number }[]} etapes
|
|
62
|
+
* @returns {string[]}
|
|
63
|
+
*/
|
|
64
|
+
export function ordreDArret(etapes) {
|
|
65
|
+
const depasse = e => e.memoire > e.reservation;
|
|
66
|
+
const part = e => (e.reservation > 0 ? e.memoire / e.reservation : Infinity);
|
|
67
|
+
return etapes
|
|
68
|
+
.toSorted(
|
|
69
|
+
(a, b) =>
|
|
70
|
+
Number(depasse(b)) - Number(depasse(a)) ||
|
|
71
|
+
(depasse(a) ? part(b) - part(a) : 0) ||
|
|
72
|
+
b.memoire - a.memoire ||
|
|
73
|
+
Number(b.passe) - Number(a.passe) ||
|
|
74
|
+
b.depuis - a.depuis
|
|
75
|
+
)
|
|
76
|
+
.map(e => e.id);
|
|
34
77
|
}
|
|
35
78
|
|
|
79
|
+
/**
|
|
80
|
+
* The step of the overbooking after a moment: one step down on a `signal` (an alert, a stop for lack
|
|
81
|
+
* of memory; its reason), one step up when `DELAI_DE_MONTEE_MS` passed since the last change or
|
|
82
|
+
* signal (`depuis`) without one. A signal at the lowest step restarts the wait. `changement` says
|
|
83
|
+
* the change, its instant and its reason; null when the step stays.
|
|
84
|
+
* @param {{ cran: number, depuis: number, maintenant: number, signal: string | null }} o
|
|
85
|
+
* @returns {{ cran: number, depuis: number, changement: { de: number, a: number, raison: string,
|
|
86
|
+
* instant: number } | null }}
|
|
87
|
+
*/
|
|
88
|
+
export function ajusterLeCran({ cran, depuis, maintenant, signal }) {
|
|
89
|
+
const i = Math.max(0, CRANS.indexOf(cran));
|
|
90
|
+
const change = (j, raison) => ({
|
|
91
|
+
cran: CRANS[j],
|
|
92
|
+
depuis: maintenant,
|
|
93
|
+
changement: { de: cran, a: CRANS[j], raison, instant: maintenant },
|
|
94
|
+
});
|
|
95
|
+
if (signal) {
|
|
96
|
+
return i > 0 ? change(i - 1, signal) : { cran, depuis: maintenant, changement: null };
|
|
97
|
+
}
|
|
98
|
+
if (i < CRANS.length - 1 && maintenant - depuis >= DELAI_DE_MONTEE_MS) {
|
|
99
|
+
return change(i + 1, 'trois jours sans alerte ni arrêt faute de mémoire');
|
|
100
|
+
}
|
|
101
|
+
return { cran, depuis, changement: null };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Why a request waits under the closure of the machine by the supervisor (`cordon` of kubectl). */
|
|
105
|
+
export const RAISON_FERMEE =
|
|
106
|
+
'machine fermée par le superviseur : la réservation est accordée à la réouverture';
|
|
107
|
+
/**
|
|
108
|
+
* How long after its grant a step is not yet read by the measure of the machine, in ms: the
|
|
109
|
+
* reservation of the steps granted since less than that is taken off the measured availability.
|
|
110
|
+
*/
|
|
111
|
+
export const FENETRE_DE_DEPART_MS = 30_000;
|
|
112
|
+
|
|
113
|
+
/** The sort of the verification of the update (scripts/grillhouse-maj.mjs), a gesture of the maintenance. */
|
|
114
|
+
export const SORTE_DE_LA_MONTEE = 'Montée';
|
|
115
|
+
|
|
36
116
|
// 11.2 → « 11,2 », 4 → « 4 ».
|
|
37
117
|
const nombre = n => (Number.isInteger(n) ? String(n) : n.toFixed(1).replace('.', ','));
|
|
38
118
|
|
|
@@ -44,59 +124,72 @@ const nombre = n => (Number.isInteger(n) ? String(n) : n.toFixed(1).replace('.',
|
|
|
44
124
|
export const duree = ms =>
|
|
45
125
|
ms < 120_000 ? `${Math.round(ms / 1000)} s` : `${Math.round(ms / 60_000)} min`;
|
|
46
126
|
|
|
127
|
+
/** How many times a wait may be passed by a request that fits, before nothing passes it more. */
|
|
128
|
+
export const PASSAGES_MAX = 5;
|
|
129
|
+
|
|
47
130
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @param {{
|
|
51
|
-
* @
|
|
131
|
+
* A request <id> of the rank <rang> is granted before the waits of a lower rank: each gains a
|
|
132
|
+
* passage. Called before the granted request leaves the waits; the state is changed in place.
|
|
133
|
+
* @param {{ attentes: { id: string, rang: number, passages?: number }[] }} etat
|
|
134
|
+
* @param {{ id: string, rang: number }} o
|
|
135
|
+
* @returns {void}
|
|
52
136
|
*/
|
|
53
|
-
export function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
ok: false,
|
|
60
|
-
raison: `mémoire libre ${nombre(memoireLibre / 1024 ** 3)} Go, sous les ${MEMOIRE_MIN / 1024 ** 3} Go demandés`,
|
|
61
|
-
};
|
|
137
|
+
export function compterLesPassages(etat, { id, rang }) {
|
|
138
|
+
for (const a of etat.attentes) {
|
|
139
|
+
if (a.id !== id && a.rang < rang) {
|
|
140
|
+
a.passages = (a.passages ?? 0) + 1;
|
|
141
|
+
}
|
|
62
142
|
}
|
|
63
|
-
return { ok: true };
|
|
64
143
|
}
|
|
65
144
|
|
|
66
145
|
/**
|
|
67
|
-
* Why the
|
|
68
|
-
* `
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
146
|
+
* Why the reservation of a step <id> of the rank <rang> is not granted now on the state <etat>
|
|
147
|
+
* (`prises`: the reservations granted, with the time `depuis` of their grant; `attentes`;
|
|
148
|
+
* `reservation`: the supervisor's closure), null when it is: the closure of the machine; a wait of
|
|
149
|
+
* a lower rank passed PASSAGES_MAX times, which keeps its turn; the reservation within the <budget>
|
|
150
|
+
* in cores, then in memory (what the others granted leave of it); then the free memory the
|
|
151
|
+
* measure <mesurer> gives (read only when the closure, the turn and the budget pass), less the
|
|
152
|
+
* memory reserved by the steps granted since less than FENETRE_DE_DEPART_MS at the time
|
|
153
|
+
* <maintenant>, which the measure does not show yet. The load of the processes outside the frame
|
|
154
|
+
* refuses nothing: the cores count by the reservations only (machine.md §5.2). A refusal names the first condition missed and its figures.
|
|
155
|
+
* @param {{ prises: { id?: string, coeurs: number, memoire: number, depuis?: number,
|
|
156
|
+
* ticket?: string | null }[],
|
|
157
|
+
* attentes: { id: string, rang: number, ticket?: string | null, raison?: string,
|
|
158
|
+
* passages?: number }[],
|
|
159
|
+
* reservation?: object | null }} etat
|
|
160
|
+
* @param {{ id: string, rang: number, reservation: { coeurs: number, memoire: number },
|
|
161
|
+
* budget: { coeurs: number, memoire: number }, maintenant: number, exemptee?: boolean,
|
|
162
|
+
* cran?: number, mesurer: () => { memoireLibre: number } }} o
|
|
163
|
+
* `cran`: the step of the overbooking, which multiplies the memory of the budget (1 by default)
|
|
76
164
|
* @returns {string | null}
|
|
77
165
|
*/
|
|
78
|
-
export function
|
|
166
|
+
export function refusDeLaReservation(
|
|
79
167
|
etat,
|
|
80
|
-
{ id, rang,
|
|
168
|
+
{ id, rang, reservation, budget, maintenant, mesurer, exemptee = false, cran = 1 }
|
|
81
169
|
) {
|
|
82
|
-
// The
|
|
83
|
-
|
|
170
|
+
// The closure refuses every new reservation but one <exemptee> (the update of the frame, a gesture
|
|
171
|
+
// of the maintenance, as a drain keeps the pods of the system).
|
|
172
|
+
if (etat.reservation && !exemptee) {
|
|
84
173
|
return RAISON_FERMEE;
|
|
85
174
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
175
|
+
// A request that fits passes before the waits of a lower rank, until one of them has been
|
|
176
|
+
// passed PASSAGES_MAX times (the backfill of Slurm, bounded in passages, not in minutes).
|
|
177
|
+
const bloquante = etat.attentes.find(
|
|
178
|
+
a => a.id !== id && a.rang < rang && (a.passages ?? 0) >= PASSAGES_MAX
|
|
179
|
+
);
|
|
180
|
+
if (bloquante) {
|
|
181
|
+
return `rang réservé : ${bloquante.ticket ?? 'une étape'} attend, la borne de ${PASSAGES_MAX} passages est atteinte (${bloquante.raison})`;
|
|
92
182
|
}
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
183
|
+
const prises = etat.prises.filter(p => p.id !== id);
|
|
184
|
+
const tient = partDansLeBudget({ part: reservation, budget, prises, cran });
|
|
185
|
+
if (!tient.ok) {
|
|
186
|
+
return tient.raison;
|
|
96
187
|
}
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
188
|
+
const mesure = mesurer();
|
|
189
|
+
const parties = prises.filter(p => maintenant - (p.depuis ?? 0) < FENETRE_DE_DEPART_MS);
|
|
190
|
+
const memoireLibre = mesure.memoireLibre - parties.reduce((n, p) => n + p.memoire, 0);
|
|
191
|
+
if (reservation.memoire > memoireLibre) {
|
|
192
|
+
return `mémoire libre de la machine : ${go(reservation.memoire)} demandés, ${go(Math.max(0, memoireLibre))} libres`;
|
|
100
193
|
}
|
|
101
194
|
return null;
|
|
102
195
|
}
|
|
@@ -108,10 +201,11 @@ const go = octets => `${nombre(octets / 1024 ** 3)} Go`;
|
|
|
108
201
|
* the <budget> of the machine: cores, then memory. A refusal says what it waits for (`attend`:
|
|
109
202
|
* « cœurs » or « mémoire ») and its figures, « cœurs : 6 demandés, 4 libres sur 8 ».
|
|
110
203
|
* @param {{ part: { coeurs: number, memoire: number }, budget: { coeurs: number, memoire: number },
|
|
111
|
-
* prises: { coeurs: number, memoire: number }[] }} o
|
|
204
|
+
* prises: { coeurs: number, memoire: number }[], cran?: number }} o `cran` multiplies the memory
|
|
205
|
+
* of the budget, not its cores
|
|
112
206
|
* @returns {{ ok: true } | { ok: false, attend: 'cœurs' | 'mémoire', raison: string }}
|
|
113
207
|
*/
|
|
114
|
-
export function partDansLeBudget({ part, budget, prises }) {
|
|
208
|
+
export function partDansLeBudget({ part, budget, prises, cran = 1 }) {
|
|
115
209
|
const coeursLibres = budget.coeurs - prises.reduce((n, p) => n + p.coeurs, 0);
|
|
116
210
|
if (part.coeurs > coeursLibres) {
|
|
117
211
|
return {
|
|
@@ -120,90 +214,18 @@ export function partDansLeBudget({ part, budget, prises }) {
|
|
|
120
214
|
raison: `cœurs : ${part.coeurs} demandés, ${Math.max(0, coeursLibres)} libres sur ${budget.coeurs}`,
|
|
121
215
|
};
|
|
122
216
|
}
|
|
123
|
-
const
|
|
217
|
+
const memoireDuBudget = budget.memoire * cran;
|
|
218
|
+
const memoireLibre = memoireDuBudget - prises.reduce((n, p) => n + p.memoire, 0);
|
|
124
219
|
if (part.memoire > memoireLibre) {
|
|
125
220
|
return {
|
|
126
221
|
ok: false,
|
|
127
222
|
attend: 'mémoire',
|
|
128
|
-
raison: `mémoire : ${go(part.memoire)} demandés, ${go(Math.max(0, memoireLibre))} libres sur ${go(
|
|
223
|
+
raison: `mémoire : ${go(part.memoire)} demandés, ${go(Math.max(0, memoireLibre))} libres sur ${go(memoireDuBudget)}`,
|
|
129
224
|
};
|
|
130
225
|
}
|
|
131
226
|
return { ok: true };
|
|
132
227
|
}
|
|
133
228
|
|
|
134
|
-
/**
|
|
135
|
-
* Whether a pass of the part <part> is admitted: its part fits in what the parts <prises> leave of
|
|
136
|
-
* the <budget> (`partDansLeBudget`), then the thresholds of `admission` hold on the machine
|
|
137
|
-
* <mesure> (load under the cores, MEMOIRE_MIN free). A refusal says what it waits for (`attend`:
|
|
138
|
-
* « cœurs », « mémoire » or « charge ») and its figures.
|
|
139
|
-
* @param {{ part: { coeurs: number, memoire: number }, budget: { coeurs: number, memoire: number },
|
|
140
|
-
* prises: { coeurs: number, memoire: number }[],
|
|
141
|
-
* mesure: { coeurs: number, charge: number, memoireLibre: number } }} o
|
|
142
|
-
* @returns {{ ok: true } | { ok: false, attend: 'cœurs' | 'mémoire' | 'charge', raison: string }}
|
|
143
|
-
*/
|
|
144
|
-
export function admissionDePart({ part, budget, prises, mesure }) {
|
|
145
|
-
const tient = partDansLeBudget({ part, budget, prises });
|
|
146
|
-
if (!tient.ok) {
|
|
147
|
-
return tient;
|
|
148
|
-
}
|
|
149
|
-
const a = admission(mesure);
|
|
150
|
-
return a.ok
|
|
151
|
-
? a
|
|
152
|
-
: { ...a, attend: mesure.charge >= mesure.coeurs ? 'charge' : 'mémoire' };
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/** Why a pass waits under the supervisor's closure of the machine. */
|
|
156
|
-
export const RAISON_DE_LA_FERMETURE = 'machine fermée par le superviseur';
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Why the pass <id> of the rank <rang> does not take its part <part> now on the state <etat>
|
|
160
|
-
* (`prises`, `attentes`), null when it does: its part does not fit in the <budget>; a wait of a
|
|
161
|
-
* lower rank, alive, which keeps its turn (the measure of the frame has the lower rank of a
|
|
162
|
-
* project's, then the order of arrival); the admission at the load and the memory <mesurer> gives
|
|
163
|
-
* (read only when the part and the turn pass). A measure of time (<dediee>) asks for dedicated cores: when they lack, its refusal
|
|
164
|
-
* says « cœurs dédiés » and names the passes that hold them; a pass that comes after it waits
|
|
165
|
-
* 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
|
|
166
|
-
* ordinary pass whose part fits in the cores left goes on.
|
|
167
|
-
* @param {{ prises: { id?: string, coeurs: number, memoire: number, ticket?: string | null }[],
|
|
168
|
-
* attentes: { id: string, rang: number, ticket?: string | null, raison?: string }[] }} etat
|
|
169
|
-
* @param {{ id: string, rang: number, part: { coeurs: number, memoire: number },
|
|
170
|
-
* budget: { coeurs: number, memoire: number }, dediee?: boolean,
|
|
171
|
-
* mesurer: () => { coeurs: number, charge: number, memoireLibre: number } }} o
|
|
172
|
-
* @returns {string | null}
|
|
173
|
-
*/
|
|
174
|
-
export function refusDePart(
|
|
175
|
-
etat,
|
|
176
|
-
{ id, rang, part, budget, mesurer, dediee = false, reservation = null }
|
|
177
|
-
) {
|
|
178
|
-
// A closed machine gives no new work (`cordon` of kubectl): the supervisor's closure refuses every pass.
|
|
179
|
-
if (reservation) {
|
|
180
|
-
return RAISON_DE_LA_FERMETURE;
|
|
181
|
-
}
|
|
182
|
-
const prises = etat.prises.filter(p => p.id !== id);
|
|
183
|
-
// Two measures of time never play side by side: each would be the load the other is judged on.
|
|
184
|
-
const autre = dediee ? prises.find(p => p.dediee) : undefined;
|
|
185
|
-
if (autre) {
|
|
186
|
-
return `cœurs dédiés : la mesure de ${autre.ticket ?? 'une passe'} les tient, une mesure à la fois`;
|
|
187
|
-
}
|
|
188
|
-
const tient = partDansLeBudget({ part, budget, prises });
|
|
189
|
-
if (!tient.ok) {
|
|
190
|
-
if (dediee && tient.attend === 'cœurs') {
|
|
191
|
-
const tenues = prises.map(p => p.ticket ?? 'une passe').join(', ');
|
|
192
|
-
return `cœurs dédiés${tient.raison.slice('cœurs'.length)}${tenues ? ` ; tenus par ${tenues}` : ''}`;
|
|
193
|
-
}
|
|
194
|
-
return tient.raison;
|
|
195
|
-
}
|
|
196
|
-
const avant = etat.attentes.find(a => a.id !== id && a.rang < rang);
|
|
197
|
-
if (avant) {
|
|
198
|
-
return `rang réservé : ${avant.ticket ?? 'une passe'} est arrivée avant et attend (${avant.raison})`;
|
|
199
|
-
}
|
|
200
|
-
const a = admissionDePart({ part, budget, prises, mesure: mesurer() });
|
|
201
|
-
return a.ok ? null : a.raison;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/** A place of a circuit not given by its project's queue for this long is gone, in ms: 10 min. */
|
|
205
|
-
export const PERIME_MS = 10 * 60_000;
|
|
206
|
-
|
|
207
229
|
/**
|
|
208
230
|
* The phase of the supervisor's closure of the machine: null without one; `'attend'` while a place
|
|
209
231
|
* is held (the stages under way finish); then `'vide'` (it holds no place itself: every place held
|
|
@@ -219,18 +241,21 @@ export function phaseDeLaReservation({ prises, reservation = null }) {
|
|
|
219
241
|
}
|
|
220
242
|
|
|
221
243
|
/**
|
|
222
|
-
* The places of the circuits of the machine once a demand comes, as
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
244
|
+
* The places of the circuits of the machine once a demand comes, as the scheduler of Kubernetes
|
|
245
|
+
* holds one place per task. A circuit has one place, held by this arbiter: counted in the limit of
|
|
246
|
+
* its project and in the ceiling of the machine, kept until the circuit gives it back
|
|
247
|
+
* (`rendreSaPlace`) or its workflow ends. The queue of the project <racine> gives the circuits
|
|
248
|
+
* the server lists alive <vivants> and the tickets it would start <candidats> (all of them: the
|
|
249
|
+
* limit is counted here), with the reason its disk of copies lacks room (<disque>, null with
|
|
250
|
+
* room). <vivants> creates no place: a circuit that gave its place back asks it again by
|
|
251
|
+
* <reprise>. The garbage collector: a place of the project held by no circuit of <vivants> nor
|
|
252
|
+
* <candidats> is gone (its owner has disappeared), but a circuit resumed that waits. A circuit
|
|
253
|
+
* resumed after its question asks again by itself (<reprise>: its ticket and its rank of arrival,
|
|
254
|
+
* a new one when null), as a candidate, without the disk, its copy already there. The places are
|
|
255
|
+
* granted in the order of arrival while the circuits that hold one are fewer than <plafond>: the
|
|
256
|
+
* first that waits keeps the next ones waiting, but a candidate short of disk, which waits with
|
|
257
|
+
* its reason and keeps no one. Gives the places, the last rank drawn, and the tickets of the
|
|
258
|
+
* demand that hold a place.
|
|
234
259
|
*
|
|
235
260
|
* Between the projects of one group (`grillhouse.groupe`, `groupe` its identity, absent out of a
|
|
236
261
|
* group), the priority orders the circuits that wait: each candidate carries its Beads priority and
|
|
@@ -244,7 +269,7 @@ export function phaseDeLaReservation({ prises, reservation = null }) {
|
|
|
244
269
|
* its circuits that wait keep waiting, whichever project's demand judges them, and the other
|
|
245
270
|
* projects still pass.
|
|
246
271
|
* @param {Array<{ racine: string, ticket: string, rang: number, accordee: boolean, depuis: number,
|
|
247
|
-
*
|
|
272
|
+
* reprise?: boolean, raison?: string | null, priorite?: number, creation?: string,
|
|
248
273
|
* groupe?: string }>} places
|
|
249
274
|
* @param {{ racine: string, vivants?: string[], candidats?: string[], disque?: string | null,
|
|
250
275
|
* reprise?: { ticket: string, rang: number | null }, groupe?: string,
|
|
@@ -267,8 +292,7 @@ export function reserverDesCircuits(places, demande, o) {
|
|
|
267
292
|
let { rang } = o;
|
|
268
293
|
const siens = new Set([...vivants, ...candidats]);
|
|
269
294
|
const garde = c =>
|
|
270
|
-
|
|
271
|
-
(c.racine !== racine || siens.has(c.ticket) || Boolean(reprise) || (c.reprise && !c.accordee));
|
|
295
|
+
c.racine !== racine || siens.has(c.ticket) || Boolean(reprise) || (c.reprise && !c.accordee);
|
|
272
296
|
const circuits = places.filter(garde).map(c => ({ ...c }));
|
|
273
297
|
// What the demand says of a ticket's place: its group, its priority and its creation.
|
|
274
298
|
const dit = ticket => ({
|
|
@@ -281,7 +305,6 @@ export function reserverDesCircuits(places, demande, o) {
|
|
|
281
305
|
const placer = (ticket, accordee, o2 = {}) => {
|
|
282
306
|
const c = circuits.find(x => x.racine === racine && x.ticket === ticket);
|
|
283
307
|
if (c) {
|
|
284
|
-
c.vu = maintenant;
|
|
285
308
|
c.accordee = c.accordee || accordee;
|
|
286
309
|
if (accordee) {
|
|
287
310
|
c.reprise = false;
|
|
@@ -297,12 +320,14 @@ export function reserverDesCircuits(places, demande, o) {
|
|
|
297
320
|
rang: r,
|
|
298
321
|
accordee,
|
|
299
322
|
depuis: maintenant,
|
|
300
|
-
vu: maintenant,
|
|
301
323
|
...dit(ticket),
|
|
302
324
|
...(o2.maj ?? {}),
|
|
303
325
|
});
|
|
304
326
|
};
|
|
305
|
-
|
|
327
|
+
// A circuit alive holds the place it has: it creates none (it gave its place back, or asks by `reprise`).
|
|
328
|
+
vivants
|
|
329
|
+
.filter(t => circuits.some(c => c.racine === racine && c.ticket === t))
|
|
330
|
+
.forEach(t => placer(t, false));
|
|
306
331
|
candidats.forEach(t => placer(t, false, { maj: { raison: disque } }));
|
|
307
332
|
if (reprise) {
|
|
308
333
|
placer(reprise.ticket, false, {
|
|
@@ -347,3 +372,14 @@ export function reserverDesCircuits(places, demande, o) {
|
|
|
347
372
|
);
|
|
348
373
|
return { circuits, rang, accordes };
|
|
349
374
|
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* The places once the circuit <ticket> of the project <racine> gives its place back: that place is
|
|
378
|
+
* taken off the limit of the project and off the ceiling of the machine in one gesture. A circuit
|
|
379
|
+
* that holds none leaves the places as they are; the same circuit of another project keeps its own.
|
|
380
|
+
* @param {Array<{ racine: string, ticket: string }>} places
|
|
381
|
+
* @param {{ racine: string, ticket: string }} q
|
|
382
|
+
*/
|
|
383
|
+
export function rendreSaPlace(places, { racine, ticket }) {
|
|
384
|
+
return places.filter(c => !(c.racine === racine && c.ticket === ticket));
|
|
385
|
+
}
|
package/scripts/retirer-copie.sh
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# The removal of a working copy (packages/grillhouse/docs/architecture/entree.md §5.3, « Après les
|
|
3
3
|
# étapes »; §5.1 for the queue's copy), called by the three places that end one: the agent copy (by
|
|
4
|
-
# scripts/integration/integrer.mjs once its lot is
|
|
5
|
-
# closed without integration), the
|
|
4
|
+
# scripts/integration/integrer.mjs once its lot is in the queue, and by the supervisor for a ticket
|
|
5
|
+
# closed without integration), the queue's copy (scripts/integration/rejeu.mjs) and the night copy
|
|
6
6
|
# (scripts/nuit.sh), the last two when their existing copy does not get ready; and by the night
|
|
7
7
|
# for every other copy once its steps are played (scripts/copies-finies.mjs), without `--jetable`.
|
|
8
8
|
#
|