@roomi-fields/grillhouse 0.54.1 → 0.55.2

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.
Files changed (238) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +73 -0
  3. package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
  4. package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
  5. package/cadre/templates/projet/CONTRIBUTING.md +0 -5
  6. package/cadre/templates/projet/README.md +0 -126
  7. package/cadre/templates/projet/_npmignore +1 -6
  8. package/cadre/templates/projet/package.json +5 -32
  9. package/cadre/templates/projet/tsconfig.json +4 -4
  10. package/cadre/templates/projet/vitest.config.cjs +3 -2
  11. package/charte/tests.md +14 -0
  12. package/dist/machine/part-par-sorte.d.ts +9 -9
  13. package/dist/machine/part-par-sorte.js +20 -24
  14. package/dist/machine/part-par-sorte.js.map +1 -1
  15. package/dist/machine/table-des-consommations.d.ts +65 -0
  16. package/dist/machine/table-des-consommations.js +94 -0
  17. package/dist/machine/table-des-consommations.js.map +1 -0
  18. package/dist/temporal/circuit/activites.d.ts +2 -0
  19. package/dist/temporal/circuit/activites.js +87 -3
  20. package/dist/temporal/circuit/activites.js.map +1 -1
  21. package/dist/temporal/circuit/client.js +9 -4
  22. package/dist/temporal/circuit/client.js.map +1 -1
  23. package/dist/temporal/circuit/contrat.d.ts +32 -4
  24. package/dist/temporal/circuit/deroule.js +54 -4
  25. package/dist/temporal/circuit/deroule.js.map +1 -1
  26. package/dist/temporal/circuit/versions.d.ts +12 -0
  27. package/dist/temporal/circuit/versions.js +22 -0
  28. package/dist/temporal/circuit/versions.js.map +1 -0
  29. package/dist/temporal/consommation/activites.d.ts +2 -0
  30. package/dist/temporal/consommation/activites.js +9 -0
  31. package/dist/temporal/consommation/activites.js.map +1 -0
  32. package/dist/temporal/consommation/actualisation.d.ts +2 -0
  33. package/dist/temporal/consommation/actualisation.js +71 -0
  34. package/dist/temporal/consommation/actualisation.js.map +1 -0
  35. package/dist/temporal/consommation/client.d.ts +12 -0
  36. package/dist/temporal/consommation/client.js +28 -0
  37. package/dist/temporal/consommation/client.js.map +1 -0
  38. package/dist/temporal/consommation/commande.d.ts +5 -0
  39. package/dist/temporal/consommation/commande.js +32 -0
  40. package/dist/temporal/consommation/commande.js.map +1 -0
  41. package/dist/temporal/consommation/contrat.d.ts +15 -0
  42. package/dist/temporal/consommation/contrat.js +13 -0
  43. package/dist/temporal/consommation/contrat.js.map +1 -0
  44. package/dist/temporal/consommation/deroule.d.ts +2 -0
  45. package/dist/temporal/consommation/deroule.js +14 -0
  46. package/dist/temporal/consommation/deroule.js.map +1 -0
  47. package/dist/temporal/deroules.d.ts +2 -1
  48. package/dist/temporal/deroules.js +3 -2
  49. package/dist/temporal/deroules.js.map +1 -1
  50. package/dist/temporal/file/contrat.d.ts +2 -0
  51. package/dist/temporal/file/deroule.js +14 -4
  52. package/dist/temporal/file/deroule.js.map +1 -1
  53. package/dist/temporal/installation.d.ts +6 -0
  54. package/dist/temporal/installation.js +15 -0
  55. package/dist/temporal/installation.js.map +1 -1
  56. package/dist/temporal/nuits/activites.d.ts +2 -1
  57. package/dist/temporal/nuits/activites.js +127 -3
  58. package/dist/temporal/nuits/activites.js.map +1 -1
  59. package/dist/temporal/nuits/client.d.ts +19 -5
  60. package/dist/temporal/nuits/client.js +33 -23
  61. package/dist/temporal/nuits/client.js.map +1 -1
  62. package/dist/temporal/nuits/commande.js +16 -11
  63. package/dist/temporal/nuits/commande.js.map +1 -1
  64. package/dist/temporal/nuits/contrat.d.ts +29 -0
  65. package/dist/temporal/nuits/contrat.js +10 -0
  66. package/dist/temporal/nuits/contrat.js.map +1 -1
  67. package/dist/temporal/nuits/deroule.d.ts +5 -0
  68. package/dist/temporal/nuits/deroule.js +18 -1
  69. package/dist/temporal/nuits/deroule.js.map +1 -1
  70. package/dist/temporal/nuits/pc2.d.ts +72 -0
  71. package/dist/temporal/nuits/pc2.js +206 -0
  72. package/dist/temporal/nuits/pc2.js.map +1 -0
  73. package/dist/temporal/places/activites.d.ts +23 -1
  74. package/dist/temporal/places/activites.js +38 -2
  75. package/dist/temporal/places/activites.js.map +1 -1
  76. package/dist/temporal/places/client.d.ts +18 -2
  77. package/dist/temporal/places/client.js +28 -3
  78. package/dist/temporal/places/client.js.map +1 -1
  79. package/dist/temporal/places/contrat.d.ts +79 -14
  80. package/dist/temporal/places/contrat.js +7 -0
  81. package/dist/temporal/places/contrat.js.map +1 -1
  82. package/dist/temporal/places/deroule.js +159 -23
  83. package/dist/temporal/places/deroule.js.map +1 -1
  84. package/dist/temporal/places/reservation.d.ts +54 -0
  85. package/dist/temporal/places/reservation.js +69 -0
  86. package/dist/temporal/places/reservation.js.map +1 -0
  87. package/dist/temporal/planification.d.ts +6 -0
  88. package/dist/temporal/planification.js +26 -0
  89. package/dist/temporal/planification.js.map +1 -0
  90. package/dist/temporal/tickets/activites.d.ts +0 -2
  91. package/dist/temporal/tickets/activites.js +2 -52
  92. package/dist/temporal/tickets/activites.js.map +1 -1
  93. package/dist/temporal/tickets/contrat.d.ts +7 -26
  94. package/dist/temporal/tickets/deroule.js +35 -23
  95. package/dist/temporal/tickets/deroule.js.map +1 -1
  96. package/dist/temporal/travailleur.js +2 -0
  97. package/dist/temporal/travailleur.js.map +1 -1
  98. package/docs/ARCHITECTURE.md +2 -2
  99. package/docs/CADRE.md +1 -1
  100. package/docs/INTERFACE.md +16 -11
  101. package/docs/architecture/circuit.md +62 -58
  102. package/docs/architecture/entree.md +87 -63
  103. package/docs/architecture/greffon.md +24 -21
  104. package/docs/architecture/installation.md +35 -30
  105. package/docs/architecture/machine.md +48 -40
  106. package/docs/architecture/tests.md +37 -33
  107. package/docs/lexique.md +4 -3
  108. package/package.json +1 -1
  109. package/scripts/activites.mjs +351 -180
  110. package/scripts/aiguillage.mjs +1 -0
  111. package/scripts/attente-de-la-machine.mjs +3 -22
  112. package/scripts/avancement.mjs +21 -30
  113. package/scripts/bilan.mjs +22 -2
  114. package/scripts/branche-de-nuit.mjs +1 -1
  115. package/scripts/circuit.mjs +75 -39
  116. package/scripts/codes-de-sortie.mjs +0 -6
  117. package/scripts/coeurs-dedies.mjs +19 -2
  118. package/scripts/consommation-des-passes.mjs +67 -35
  119. package/scripts/consommation.mjs +152 -24
  120. package/scripts/copies-finies.mjs +15 -35
  121. package/scripts/dernier-vert.mjs +4 -5
  122. package/scripts/dette.mjs +5 -3
  123. package/scripts/droits.mjs +2 -2
  124. package/scripts/echantillonneur-de-la-passe.mjs +7 -31
  125. package/scripts/engendres.mjs +5 -61
  126. package/scripts/enveloppe/enveloppe.mjs +30 -34
  127. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
  128. package/scripts/etapes.mjs +21 -7
  129. package/scripts/etat-du-depot.mjs +61 -0
  130. package/scripts/faits-du-circuit.mjs +7 -4
  131. package/scripts/fermeture-de-la-machine.d.mts +6 -4
  132. package/scripts/fermeture-de-la-machine.mjs +12 -16
  133. package/scripts/fichier-du-poste.d.mts +9 -0
  134. package/scripts/file-des-tickets.d.mts +0 -18
  135. package/scripts/file-des-tickets.mjs +0 -42
  136. package/scripts/fusion-du-changelog.mjs +1 -1
  137. package/scripts/grillhouse-maj.mjs +1 -1
  138. package/scripts/index-des-rouges.d.mts +40 -0
  139. package/scripts/index-des-rouges.mjs +104 -0
  140. package/scripts/integration/file.mjs +13 -63
  141. package/scripts/integration/integrer.mjs +157 -424
  142. package/scripts/integration/jugement.mjs +109 -0
  143. package/scripts/integration/rejeu.mjs +94 -71
  144. package/scripts/jointure.d.ts +34 -27
  145. package/scripts/journal-des-etats.d.mts +1 -1
  146. package/scripts/langages/c/commandes.mjs +27 -12
  147. package/scripts/langages/cargo/commandes.mjs +148 -94
  148. package/scripts/langages/cargo/index.mjs +2 -1
  149. package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
  150. package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
  151. package/scripts/langages/python/commandes.mjs +31 -15
  152. package/scripts/langages/python/index.mjs +2 -1
  153. package/scripts/langages/python/lectures-des-tests.mjs +148 -0
  154. package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
  155. package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
  156. package/scripts/langages/typescript/index.mjs +4 -0
  157. package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
  158. package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
  159. package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
  160. package/scripts/langages/typescript/tests.mjs +11 -37
  161. package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
  162. package/scripts/langages/typescript/verifier.mjs +74 -44
  163. package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
  164. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
  165. package/scripts/lectures-communes.mjs +234 -0
  166. package/scripts/machine.mjs +11 -18
  167. package/scripts/mesure/base-de-passe.mjs +1 -2
  168. package/scripts/mesure-de-la-machine.d.mts +43 -3
  169. package/scripts/mesure-de-la-machine.mjs +209 -11
  170. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
  171. package/scripts/migrations/nuit-yml-retire.mjs +25 -0
  172. package/scripts/migrations/part-retiree.mjs +31 -0
  173. package/scripts/migrations/table-des-consommations.mjs +36 -0
  174. package/scripts/migrations.mjs +6 -0
  175. package/scripts/montee.mjs +9 -0
  176. package/scripts/nuit-de-pc2.mjs +628 -0
  177. package/scripts/nuit.sh +8 -131
  178. package/scripts/paquets.mjs +1 -1
  179. package/scripts/passe-de-la-machine.mjs +365 -105
  180. package/scripts/place-du-circuit.d.mts +15 -0
  181. package/scripts/place-du-circuit.mjs +32 -0
  182. package/scripts/places-de-la-machine.mjs +148 -627
  183. package/scripts/places-du-serveur.mjs +43 -16
  184. package/scripts/plafond-de-la-machine.d.mts +8 -13
  185. package/scripts/plafond-de-la-machine.mjs +37 -69
  186. package/scripts/registre-des-entrees.mjs +57 -0
  187. package/scripts/regles-des-places.d.mts +84 -50
  188. package/scripts/regles-des-places.mjs +200 -156
  189. package/scripts/retirer-copie.sh +2 -2
  190. package/scripts/seances.mjs +181 -63
  191. package/scripts/secours.mjs +95 -0
  192. package/scripts/services-du-noyau.mjs +11 -19
  193. package/scripts/sous-commandes.mjs +1 -0
  194. package/scripts/sous-modules.sh +1 -1
  195. package/scripts/superviseur.mjs +16 -7
  196. package/scripts/table-des-consommations.d.mts +9 -0
  197. package/scripts/table-des-consommations.mjs +35 -0
  198. package/scripts/tableau.mjs +33 -19
  199. package/scripts/taches-du-graphe.mjs +124 -2
  200. package/scripts/transitions.d.mts +27 -5
  201. package/scripts/transitions.mjs +125 -104
  202. package/scripts/verdict-de-la-nuit.d.mts +13 -0
  203. package/scripts/verdict-de-la-nuit.mjs +34 -7
  204. package/scripts/verrou-de-fichier.mjs +1 -2
  205. package/scripts/workflows-du-cadre.mjs +2 -2
  206. package/skills/developpeur/SKILL.md +8 -2
  207. package/skills/direct/SKILL.md +5 -0
  208. package/skills/explorateur/SKILL.md +10 -1
  209. package/skills/grill/SKILL.md +2 -4
  210. package/skills/pitmaster/SKILL.md +7 -5
  211. package/skills/pitmaster/references/consigne-agent.md +1 -1
  212. package/skills/relecteur/SKILL.md +4 -1
  213. package/skills/testwriter/SKILL.md +15 -2
  214. package/cadre/templates/projet/.env.example +0 -57
  215. package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
  216. package/cadre/templates/projet/deployment/README.md +0 -98
  217. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
  218. package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
  219. package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
  220. package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
  221. package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
  222. package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
  223. package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
  224. package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
  225. package/cadre/templates/projet/ecosystem.config.cjs +0 -73
  226. package/cadre/templates/projet/src/config.ts +0 -68
  227. package/cadre/templates/projet/src/errors.ts +0 -102
  228. package/cadre/templates/projet/src/index.ts +0 -46
  229. package/cadre/templates/projet/src/services/.gitkeep +0 -8
  230. package/cadre/templates/projet/src/types/index.ts +0 -24
  231. package/cadre/templates/projet/src/utils/logger.ts +0 -106
  232. package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
  233. package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
  234. package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
  235. package/cadre/templates/projet/tsconfig.build.json +0 -14
  236. package/scripts/flux-de-la-nuit.mjs +0 -39
  237. package/scripts/garde-de-la-memoire.mjs +0 -231
  238. package/scripts/repli-de-la-nuit.mjs +0 -184
@@ -1,55 +1,78 @@
1
- // A pass on the machine: it takes its part of the budget (scripts/places-de-la-machine.mjs
2
- // `prendreUnePart`), waiting when the parts held leave too little, and plays held to that part
3
- // by a control group of its own (`systemd-run --user --scope`) whose CPU weight and memory bound
4
- // come from the part (the bound its limit, else its memory), with no hard CPU ceiling. Its tools receive the cores of its part
5
- // (GRILLHOUSE_TRAVAILLEURS). A pass takes no place. Architecture:
6
- // docs/architecture/machine.md (§3.1, §5.1, §6).
1
+ // A pass on the machine: it asks the arbiter of the machine for its reservation, as a step of the
2
+ // circuit does (scripts/places-de-la-machine.mjs `prendreUnePlace`), waiting when the reservations
3
+ // held leave too little, and plays held to it by a control group of its own (`systemd-run --user
4
+ // --scope`) whose CPU weight and memory bound come from the reservation (the bound its limit, else
5
+ // its memory), with no hard CPU ceiling. Its tools receive the cores of its reservation
6
+ // (GRILLHOUSE_TRAVAILLEURS). Architecture: docs/architecture/machine.md (§3.1, §5.1, §6).
7
7
  //
8
- // - A pass out of the envelope of an agent is held to its part: the heavy pass of a circuit (its
9
- // command, launched by the circuit), `npm run verifier`, a targeted `npm test`, the CI on a
10
- // machine of ours, the night. The commands an agent launches in its envelope take no part and
11
- // play without a group; where the system gives no group (no manager of the user), the pass
12
- // plays without one too; each says it once, « joue sans part tenue ».
13
- // - A heavy pass keeps what it consumes (scripts/consommation-des-passes.mjs): a pass that is the
14
- // process itself (`npm run verifier`) enters its group by `StartTransientUnit` of the manager
15
- // of the user, the weight and the bound of its part among its properties; a pass the circuit
16
- // launches as a command (`mode: 'commande'`) runs in the group `commandeDuGroupe` builds, its
17
- // unit named, which a sampler reads. A pass that consumes clearly more than its part is said to
18
- // the board and to the figures (`depasseLaPart`).
19
- // - A pass under the part its parent holds (GRILLHOUSE_PART_TENUE) takes none of its own.
8
+ // - The reservation of a pass is that of the table of the consumptions of its project for the
9
+ // phase of its sort (`reservationDeLaPasse`), the default reservation of the budget without one;
10
+ // no key of the `package.json` enters it. The arbiter grants it in the order of arrival alone and
11
+ // shows it, with its project, ticket and sort, in its view (`lirePlaces`), where the board reads
12
+ // it.
13
+ // - A pass out of the envelope of an agent asks it: the heavy pass of a circuit (its command,
14
+ // launched by the circuit), `npm run verifier`, a targeted `npm test`, the CI on a machine of
15
+ // ours, the night. The commands an agent launches in its envelope ask none and play without a
16
+ // group; where the system gives no group (no manager of the user), the pass plays without one
17
+ // too; each says it once, « joue sans groupe de contrôle ».
18
+ // - An arbiter that does not answer refuses the pass, named (code 1), before any work, in each
19
+ // language. In the CI, under a reservation already held (GRILLHOUSE_PLACE_TENUE) or under that of
20
+ // the step of the circuit (GRILLHOUSE_RESERVATION_D_ETAPE), the pass asks nothing.
21
+ // - A pass held to a reservation keeps what it consumes (scripts/consommation-des-passes.mjs),
22
+ // under its phase, a pass that is not heavy marked so: a pass that is the process itself (`npm
23
+ // run verifier`) enters its group by `StartTransientUnit` of the manager of the user, the weight
24
+ // and the bound of its reservation among its properties; a pass the circuit launches as a command
25
+ // (`mode: 'commande'`) runs in the group `commandeDuGroupe` builds, its unit named, which a
26
+ // sampler reads. A pass that consumes clearly more than its reservation is said to the board and
27
+ // to the figures (`depasseLaPart`).
20
28
  // - A session of an agent keeps its peak too (`mesureDeLaSeance`), read from its group.
21
29
  import { spawnSync } from 'node:child_process';
22
30
  import { randomUUID } from 'node:crypto';
23
31
  import { readFileSync } from 'node:fs';
32
+ import { coeursDeLaMachine } from './mesure-de-la-machine.mjs';
24
33
  import {
25
- coeursDeLaMachine,
26
34
  depasseLaPart,
27
35
  garderLaConsommation,
36
+ marquesDeLaPasse,
28
37
  poidsDeLaPart,
29
38
  scopeDeCommande,
30
39
  scopeSystemd,
31
40
  sorteDeLaPasse,
32
41
  } from './consommation-des-passes.mjs';
33
- import { AttenteDeLaMachine } from './attente-de-la-machine.mjs';
34
42
  import {
35
43
  attacheDesCoeurs,
44
+ budgetEnFils,
36
45
  chargeHorsMesure,
46
+ choisirLesCoeurs,
37
47
  codeDeLaMesure,
38
48
  ecartDesProgrammes,
49
+ filsDeLaMesure,
39
50
  listeDeCoeurs,
51
+ lireLaTopologie,
40
52
  lireLesTempsOccupes,
41
53
  OUTIL_D_AFFINITE,
42
54
  tempsDuSysteme,
43
55
  } from './coeurs-dedies.mjs';
44
56
  import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
45
57
  import {
46
- dossierDesParts,
47
- prendreUnePart,
58
+ budgetDeLaPasse,
59
+ coeursDeLaMesure,
60
+ machineDe,
61
+ prendreUnePlace,
62
+ reservationDeLaPasse,
63
+ reservationDeLEtape,
48
64
  sousNiceEtIonice,
49
65
  travailleursDe,
50
66
  VARIABLE_MESURE_D_ESSAI,
67
+ VARIABLE_PHASE_DE_SEANCE,
68
+ VARIABLE_PHASE_DE_VERIFICATION,
69
+ VARIABLE_RESERVATION_D_ETAPE,
70
+ VARIABLE_TENUE,
51
71
  VARIABLE_TRAVAILLEURS,
52
72
  } from './places-de-la-machine.mjs';
73
+ import { AttenteDeLaMachine, attendreDeLaPlace } from './attente-de-la-machine.mjs';
74
+ import { A_REPASSER } from './codes-de-sortie.mjs';
75
+ import { phaseDeLaSeance } from './etapes.mjs';
53
76
 
54
77
  // The launcher of a command in a control group of the manager of the user.
55
78
  const LANCEUR_DE_GROUPE = 'systemd-run';
@@ -88,20 +111,30 @@ export function lancementDeLaPasse({ lourde, cmd, args, env }) {
88
111
  /**
89
112
  * The command line that runs <cmd> in a control group of its own under the part <part>: `systemd-run
90
113
  * --user --scope` (the manager of the user, no privilege), its CPU weight and its memory bound
91
- * (the limit of the part, else its memory) drawn from the part, no hard ceiling of CPU, the command of the pass whole at the end after
114
+ * (the limit of the part, else its memory) drawn from the part, no hard ceiling of CPU unless <plafond>, the command of the pass whole at the end after
92
115
  * `--`, given as written (`--expand-environment=no`: systemd-run would otherwise expand each
93
- * `${…}` of its arguments, a shell script's included). <plafond> adds the hard CPU ceiling (`CPUQuota`, the cores of the part: the group of an
94
- * agent's session); <memoire> false leaves the memory unbound. <unite> names the scope, which a
116
+ * `${…}` of its arguments, a shell script's included). <plafond> adds the hard CPU ceiling (`CPUQuota`, the ceiling of cores of the phase of the
117
+ * part, `limiteCoeurs`, else its cores: the group of a step); <memoire> false leaves the memory unbound. <unite> names the scope, which a
95
118
  * sampler reads. With <fils> (the precise threads of the
96
119
  * part, the system delegating the cpuset controller to the account) the group allows those
97
120
  * threads only (`AllowedCPUs`), under the slice of the frame, which the programs out of the frame
98
121
  * are kept out of.
99
- * @param {{ part: { coeurs: number, memoire: number, limite?: number | null }, cmd: string,
122
+ * @param {{ part: { coeurs: number, memoire: number, limite?: number | null,
123
+ * limiteCoeurs?: number | null }, cmd: string,
100
124
  * args: string[], unite?: string | null, fils?: number[] | null, plafond?: boolean,
101
125
  * memoire?: boolean }} o
102
126
  * @returns {{ cmd: string, args: string[] }}
103
127
  */
104
- export function commandeDuGroupe({ part, cmd, args, unite = null, fils = null, plafond = false, memoire = true }) {
128
+ export function commandeDuGroupe({
129
+ part,
130
+ cmd,
131
+ args,
132
+ unite = null,
133
+ fils = null,
134
+ plafond = false,
135
+ memoire = true,
136
+ tranche = false,
137
+ }) {
105
138
  return {
106
139
  cmd: LANCEUR_DE_GROUPE,
107
140
  args: [
@@ -110,13 +143,15 @@ export function commandeDuGroupe({ part, cmd, args, unite = null, fils = null, p
110
143
  '--quiet',
111
144
  '--expand-environment=no',
112
145
  ...(unite ? [`--unit=${unite}`] : []),
113
- ...(fils ? [`--slice=${TRANCHE_DU_CADRE}`] : []),
146
+ ...(fils || tranche ? [`--slice=${TRANCHE_DU_CADRE}`] : []),
114
147
  '-p',
115
148
  'MemoryAccounting=yes',
116
149
  '-p',
117
150
  `CPUWeight=${poidsDeLaPart(part)}`,
118
- ...(memoire ? ['-p', `MemoryMax=${Math.floor(part.limite ?? part.memoire)}`] : []),
119
- ...(plafond ? ['-p', `CPUQuota=${part.coeurs * 100}%`] : []),
151
+ ...(memoire && Math.floor(part.limite ?? part.memoire) > 0
152
+ ? ['-p', `MemoryMax=${Math.floor(part.limite ?? part.memoire)}`]
153
+ : []),
154
+ ...(plafond ? ['-p', `CPUQuota=${(part.limiteCoeurs ?? part.coeurs) * 100}%`] : []),
120
155
  ...(fils ? ['-p', `AllowedCPUs=${listeDeCoeurs(fils)}`] : []),
121
156
  '--',
122
157
  cmd,
@@ -127,12 +162,12 @@ export function commandeDuGroupe({ part, cmd, args, unite = null, fils = null, p
127
162
 
128
163
  /**
129
164
  * What a pass under its part launches: its command, in its control group when the system gives
130
- * one (<groupe>), as it is otherwise, GRILLHOUSE_TRAVAILLEURS set to the cores of its part. Its
165
+ * one (<groupe>), as it is otherwise, GRILLHOUSE_TRAVAILLEURS set to the core ceiling of its part (`limiteCoeurs`), else its cores. Its
131
166
  * precise threads <fils> hold it to them: the allowed cores of its group (the cpuset controller
132
167
  * delegated to the account), or, with <affinite>, the affinity of the launch (`taskset`, which its
133
168
  * children inherit); without either of the two, nothing is attached.
134
- * @param {{ part: { coeurs: number, memoire: number }, cmd: string, args: string[],
135
- * env: Record<string, string | undefined>, groupe: boolean, unite?: string | null,
169
+ * @param {{ part: { coeurs: number, memoire: number, limiteCoeurs?: number | null }, cmd: string,
170
+ * args: string[], env: Record<string, string | undefined>, groupe: boolean, unite?: string | null,
136
171
  * fils?: number[] | null, affinite?: boolean }} o
137
172
  * @returns {{ cmd: string, args: string[], env: Record<string, string | undefined> }}
138
173
  */
@@ -147,12 +182,20 @@ export function lancementSousPart({
147
182
  affinite = false,
148
183
  }) {
149
184
  const { [VARIABLE_TRAVAILLEURS]: _herite, ...sans } = env;
150
- const e = { ...sans, [VARIABLE_TRAVAILLEURS]: String(part.coeurs) };
185
+ const e = { ...sans, [VARIABLE_TRAVAILLEURS]: String(part.limiteCoeurs ?? part.coeurs) };
151
186
  const attachee =
152
- affinite && fils ? { cmd: OUTIL_D_AFFINITE, args: ['-c', listeDeCoeurs(fils), cmd, ...args] } : { cmd, args };
187
+ affinite && fils
188
+ ? { cmd: OUTIL_D_AFFINITE, args: ['-c', listeDeCoeurs(fils), cmd, ...args] }
189
+ : { cmd, args };
153
190
  return groupe
154
191
  ? {
155
- ...commandeDuGroupe({ part, ...attachee, unite, fils: affinite ? null : fils }),
192
+ ...commandeDuGroupe({
193
+ part,
194
+ ...attachee,
195
+ unite,
196
+ fils: affinite ? null : fils,
197
+ plafond: true,
198
+ }),
156
199
  env: e,
157
200
  }
158
201
  : { ...attachee, env: e };
@@ -187,8 +230,8 @@ export function groupeIndisponible({ env, sonde = sondeDuSysteme }) {
187
230
  }
188
231
 
189
232
  /**
190
- * The line-writer <dire> of a pass, which writes a line once: the same pass says « joue sans part
191
- * tenue » one time, however often it asks.
233
+ * The line-writer <dire> of a pass, which writes a line once: the same pass says « joue sans
234
+ * groupe de contrôle » one time, however often it asks.
192
235
  * @param {(l: string) => void} dire
193
236
  * @returns {(l: string) => void}
194
237
  */
@@ -209,6 +252,9 @@ const issueDe = r => {
209
252
  return r === 0 ? 'verte' : 'rouge';
210
253
  }
211
254
  if (r && typeof r === 'object') {
255
+ if (r.arretee) {
256
+ return 'arrêtée faute de mémoire';
257
+ }
212
258
  if (r.signal) {
213
259
  return 'interrompue';
214
260
  }
@@ -219,9 +265,31 @@ const issueDe = r => {
219
265
  return 'verte';
220
266
  };
221
267
 
268
+ // The phase of a pass out of the circuit, from its sort: a targeted run (`tests`), the night and
269
+ // its measures of time (`nuit`), else a verification, the montée's included.
270
+ function phaseHorsCircuit(sorte) {
271
+ if (sorte === 'tests') {
272
+ return 'tests';
273
+ }
274
+ return ['nuit', 'tests-de-nuit'].includes(sorte) || sorte.startsWith('mesure')
275
+ ? 'nuit'
276
+ : 'verification';
277
+ }
278
+
222
279
  // Keeps in the register of the project the line of what the group <ouvert> consumed since <debut>:
223
280
  // the figures, its part when it holds one, and what exceeds it; then closes the group.
224
- function garderLaMesure({ ouvert, racine, ticket, sorte, part, horloge, coeurs, debut, issue }) {
281
+ function garderLaMesure({
282
+ ouvert,
283
+ racine,
284
+ ticket,
285
+ sorte,
286
+ marques,
287
+ part,
288
+ horloge,
289
+ coeurs,
290
+ debut,
291
+ issue,
292
+ }) {
225
293
  let lecture = null;
226
294
  try {
227
295
  lecture = ouvert.lire();
@@ -231,12 +299,13 @@ function garderLaMesure({ ouvert, racine, ticket, sorte, part, horloge, coeurs,
231
299
  try {
232
300
  const dureeMs = horloge() - debut;
233
301
  const depasse =
234
- lecture && part
302
+ lecture && part && marques.lourde !== false
235
303
  ? depasseLaPart({ part, cpuNs: lecture.cpuNs, dureeMs, memoirePic: lecture.memoirePic })
236
304
  : null;
237
305
  const limite = part?.limite === undefined ? part?.memoire : part.limite;
238
306
  garderLaConsommation(racine, {
239
307
  sorte,
308
+ ...marques,
240
309
  ...(ticket ? { ticket } : {}),
241
310
  dureeMs,
242
311
  cpuNs: lecture?.cpuNs ?? null,
@@ -258,9 +327,10 @@ function garderLaMesure({ ouvert, racine, ticket, sorte, part, horloge, coeurs,
258
327
  }
259
328
  }
260
329
 
261
- // Plays <jouer> in the group <ouvert> (`ouvrir()` of a scope) and, for a heavy pass, keeps its
262
- // line, the pass red or interrupted included, read before the group goes.
263
- function jouerMesuree(jouer, { ouvert, racine, ticket, sorte, part, horloge, coeurs, lourde }) {
330
+ // Plays <jouer> in the group <ouvert> (`ouvrir()` of a scope) and keeps its line, the pass red or
331
+ // interrupted included, read before the group goes.
332
+ function jouerMesuree(jouer, mesure) {
333
+ const { horloge } = mesure;
264
334
  const debut = horloge();
265
335
  let issue = 'rouge';
266
336
  try {
@@ -268,11 +338,7 @@ function jouerMesuree(jouer, { ouvert, racine, ticket, sorte, part, horloge, coe
268
338
  issue = issueDe(r);
269
339
  return r;
270
340
  } finally {
271
- if (lourde) {
272
- garderLaMesure({ ouvert, racine, ticket, sorte, part, horloge, coeurs, debut, issue });
273
- } else {
274
- ouvert.clore?.();
275
- }
341
+ garderLaMesure({ ...mesure, debut, issue });
276
342
  }
277
343
  }
278
344
 
@@ -282,9 +348,10 @@ function jouerMesuree(jouer, { ouvert, racine, ticket, sorte, part, horloge, coe
282
348
  * (GRILLHOUSE_MESURE_D_ESSAI, without a <scope> of its own). Else the sampler of the group is
283
349
  * started; `unite` names the group the session's command is to run in (`commandeDuGroupe`), and
284
350
  * `garder(r)`, at the session's end (`r`, `{ status, signal, error }`), writes its line of the
285
- * register, sort « seance-<role> ». <part>, the part the session holds, `id` the one that names
351
+ * register, sort « seance-<role> », its phase <phase>: by default the one the circuit names to the
352
+ * session (GRILLHOUSE_PHASE_DE_SEANCE), else the step of its role. <part>, the part the session holds, `id` the one that names
286
353
  * the group; without one (a session out of the envelope) the line names no part.
287
- * @param {{ racine: string, role: string, ticket?: string, env?: Record<string, string | undefined>,
354
+ * @param {{ racine: string, role: string, phase?: string, ticket?: string, env?: Record<string, string | undefined>,
288
355
  * part?: { id: string, coeurs: number, memoire: number, limite?: number | null } | null,
289
356
  * sonde?: () => boolean, scope?: { ouvrir: () => any }, horloge?: () => number,
290
357
  * coeurs?: number }} o
@@ -295,6 +362,7 @@ export function mesureDeLaSeance({
295
362
  role,
296
363
  ticket,
297
364
  env = process.env,
365
+ phase = env[VARIABLE_PHASE_DE_SEANCE] || phaseDeLaSeance(role),
298
366
  part = null,
299
367
  sonde,
300
368
  scope,
@@ -313,6 +381,7 @@ export function mesureDeLaSeance({
313
381
  scopeDeCommande({
314
382
  racine,
315
383
  sorte,
384
+ phase,
316
385
  ticket,
317
386
  coeurs,
318
387
  part: {
@@ -320,8 +389,7 @@ export function mesureDeLaSeance({
320
389
  memoire: 0,
321
390
  limite: null,
322
391
  ...part,
323
- id: part?.id ?? randomUUID(),
324
- dossier: dossierDesParts(env),
392
+ id: part?.id ?? reservationDeLEtape(env)?.id ?? randomUUID(),
325
393
  },
326
394
  })
327
395
  ).ouvrir();
@@ -329,10 +397,41 @@ export function mesureDeLaSeance({
329
397
  return {
330
398
  unite: ouvert.unite,
331
399
  garder: r =>
332
- garderLaMesure({ ouvert, racine, ticket, sorte, part, horloge, coeurs, debut, issue: issueDe(r) }),
400
+ garderLaMesure({
401
+ ouvert,
402
+ racine,
403
+ ticket,
404
+ sorte,
405
+ marques: marquesDeLaPasse({ phase }),
406
+ part,
407
+ horloge,
408
+ coeurs,
409
+ debut,
410
+ issue: issueDe(r),
411
+ }),
333
412
  };
334
413
  }
335
414
 
415
+ // The mark a pass without an arbiter (the CI, a trial machine) gives its children, so that a pass
416
+ // they play asks nothing and measures nothing of its own.
417
+ const SANS_ARBITRE = 'sans-arbitre';
418
+
419
+ // Asks the arbiter the reservation <reservation> of a pass; an arbiter that does not answer stops
420
+ // the pass, named (code 1), before any work, a wait that reaches its bound (75) as it is.
421
+ function demanderLaReservation(prendre, demande) {
422
+ try {
423
+ return prendre(demande);
424
+ } catch (e) {
425
+ if (e instanceof AttenteDeLaMachine && e.code !== 1) {
426
+ throw e;
427
+ }
428
+ throw new AttenteDeLaMachine(
429
+ `✗ l’arbitre de la machine ne répond pas : ${String(e?.message ?? e).replace(/^✗ /, '')}`,
430
+ 1
431
+ );
432
+ }
433
+ }
434
+
336
435
  /**
337
436
  * How a pass asks whether the controller of the cores is delegated to the account: <delegation>
338
437
  * when its caller gives one; on the machine a trial fixes (GRILLHOUSE_MESURE_D_ESSAI) a function
@@ -356,35 +455,52 @@ export const jugeLaChargeDuJeu = ({ dediee, voie, env = process.env }) =>
356
455
  Boolean(dediee) && voie !== undefined && voie !== 'aucune' && !env[VARIABLE_MESURE_D_ESSAI];
357
456
 
358
457
  /**
359
- * Plays <mesure> on its part of the machine, held to it by the system, and returns what it
360
- * returns; <mesure> receives the environment of its children (the mark of the part, the workers
361
- * of its tools) and `{ part, groupe, unite }`: the part held (null where none is), whether its
362
- * command is to run in a control group of its own (`mode: 'commande'`, `lancementSousPart`), and
363
- * the name of that group. The wait for the part says its reason and stops at the bound (75). A
364
- * heavy pass (<lourde>) keeps what it consumes.
458
+ * Plays <mesure> on its reservation of the machine, held to it by the system, and returns what it
459
+ * returns; <mesure> receives the environment of its children (the mark of the reservation, the
460
+ * workers of its tools) and `{ part, groupe, unite }`: the reservation held (null where none is),
461
+ * whether its command is to run in a control group of its own (`mode: 'commande'`,
462
+ * `lancementSousPart`), and the name of that group. The pass asks the arbiter for its reservation
463
+ * (<prendre>, `prendreUnePlace` by default) once the room of its disks is there: the cores and
464
+ * the memory of the table of the consumptions of its project for its phase; the arbiter that does
465
+ * not answer refuses it, named (code 1), and the wait for the reservation stops at its bound (75).
466
+ * It asks nothing in the CI, under a reservation already held (GRILLHOUSE_PLACE_TENUE or the step
467
+ * of the circuit's, GRILLHOUSE_RESERVATION_D_ETAPE) or in the envelope of an agent. A pass keeps
468
+ * what it consumes under its <phase> (by default the one its caller's environment names,
469
+ * GRILLHOUSE_VERIFICATION_PHASE, else the one of its sort out of the circuit), with the
470
+ * <execution> of its step when given, marked when it is not heavy (<lourde>).
365
471
  * @template T
366
472
  * @param {(env: Record<string, string | undefined>,
367
- * contexte: { part: { coeurs: number, memoire: number } | null, groupe: boolean,
368
- * unite: string | null }) => T} mesure
473
+ * contexte: { part: { coeurs: number, memoire: number, limite?: number } | null, groupe: boolean,
474
+ * unite: string | null, fils?: number[] | null, affinite?: boolean }) => T} mesure
369
475
  * @param {{ lourde?: boolean, mode?: 'processus' | 'commande',
370
476
  * env?: Record<string, string | undefined>, racine?: string, ticket?: string, sorte?: string,
371
477
  * dire?: (l: string) => void, borneMs?: number, rappelMs?: number, scope?: object,
372
- * horloge?: () => number, coeurs?: number, sonde?: () => boolean } & Record<string, unknown>} options
478
+ * horloge?: () => number, coeurs?: number, sonde?: () => boolean, phase?: string,
479
+ * execution?: string, mesure?: boolean, topologie?: object, delegation?: () => boolean,
480
+ * affinite?: unknown, ecarter?: (o: object) => boolean, prendre?: typeof prendreUnePlace, libre?: (d: string) => number,
481
+ * occupe?: (d: string) => string, occupeLaCopie?: (r: string) => string,
482
+ * maintenant?: () => number, dormir?: (ms: number) => void }} options
373
483
  * `mode` « processus » (by default): the pass is the process itself, which enters its group;
374
- * `mesure`: a measure of time, which plays on
375
- * dedicated cores (scripts/coeurs-dedies.mjs), attached to them (`contexte.fils`,
376
- * `contexte.affinite`) and judged on the load of those cores out of it
484
+ * « commande »: the circuit launches the command in the group `commandeDuGroupe` builds;
485
+ * `mesure`: a measure of time, which plays on dedicated cores (scripts/coeurs-dedies.mjs) in
486
+ * addition to its reservation, attached to them (`contexte.fils`, `contexte.affinite`) and judged
487
+ * on the load of those cores out of it
377
488
  * @returns {T}
489
+ * @throws {AttenteDeLaMachine} at the bound of the wait (code 75), or on a faulty reserve or an
490
+ * arbiter that does not answer (code 1), its reason named
378
491
  */
379
492
  export function avecLaPasse(
380
493
  mesure,
381
494
  {
382
495
  lourde = true,
496
+ mesure: mesureDeTemps = false,
383
497
  mode = 'processus',
384
498
  env = process.env,
385
499
  racine = process.cwd(),
386
500
  ticket,
387
501
  sorte,
502
+ phase,
503
+ execution,
388
504
  dire = l => process.stdout.write(`${l}\n`),
389
505
  scope,
390
506
  horloge = Date.now,
@@ -393,41 +509,97 @@ export function avecLaPasse(
393
509
  delegation,
394
510
  affinite,
395
511
  ecarter = ecarterLesProgrammes,
396
- ...options
512
+ topologie,
513
+ prendre = prendreUnePlace,
514
+ borneMs,
515
+ rappelMs,
516
+ ...disques
397
517
  } = {}
398
518
  ) {
399
- const prise = prendreUnePart({ ...options, env, racine, ticket, sorte, dire });
519
+ const direSansGroupe = direUneFois(dire);
520
+ if (paquetsDeLEnveloppe(env) !== null) {
521
+ direSansGroupe("joue sans groupe de contrôle : dans l'enveloppe d'un agent");
522
+ return mesure(env, { part: null, groupe: false, unite: null });
523
+ }
524
+ if (env[VARIABLE_TENUE] || env[VARIABLE_RESERVATION_D_ETAPE]) {
525
+ return mesure(env, { part: null, groupe: false, unite: null });
526
+ }
527
+ // The caller names who the pass is, else its environment does (GRILLHOUSE_VERIFICATION_TICKET,
528
+ // GRILLHOUSE_VERIFICATION_SORTE, empty as absent), else « Vérification » and no ticket.
529
+ const sorteDite = sorte ?? (env.GRILLHOUSE_VERIFICATION_SORTE || 'Vérification');
530
+ const sorteLue = sorteDeLaPasse(sorteDite);
531
+ const ticketLu = ticket ?? (env.GRILLHOUSE_VERIFICATION_TICKET || undefined);
532
+ const marques = marquesDeLaPasse({
533
+ phase: phase ?? (env[VARIABLE_PHASE_DE_VERIFICATION] || phaseHorsCircuit(sorteLue)),
534
+ execution,
535
+ lourde,
536
+ });
537
+ let reservation;
538
+ // The dedicated cores of a measure of time, chosen on the topology of the machine in addition to
539
+ // its reservation; null for any other pass.
540
+ let dediees = null;
400
541
  try {
401
- const direSansPart = direUneFois(dire);
402
- // How the precise threads of the part are held: the allowed cores of a group, the affinity of
403
- // the launch, or not at all; a measure of time says it once.
542
+ reservation = reservationDeLaPasse({ racine, env, phase: marques.phase });
543
+ if (mesureDeTemps) {
544
+ dediees = choisirLesCoeursDedies({ racine, env, topologie, dire });
545
+ }
546
+ } catch (e) {
547
+ throw e instanceof AttenteDeLaMachine ? e : new AttenteDeLaMachine(`✗ ${e.message}`, 1);
548
+ }
549
+ // Room first on the disks the pass writes on, then the reservation.
550
+ attendreDeLaPlace({ env, dire, racine, borneMs, rappelMs, ...disques });
551
+ // The CI has no arbiter: nothing is asked, the pass holds no reservation.
552
+ const place = env.CI
553
+ ? { id: null, rang: null, env, rendre: () => {}, rattacher: () => {} }
554
+ : demanderLaReservation(prendre, {
555
+ env,
556
+ racine,
557
+ ticket: ticketLu ?? null,
558
+ sorte: sorteDite,
559
+ reservation: { coeurs: reservation.coeurs, memoire: reservation.memoire },
560
+ borneMs,
561
+ rappelMs,
562
+ dire,
563
+ });
564
+ try {
565
+ const {
566
+ GRILLHOUSE_VERIFICATION_SORTE: _sorte,
567
+ GRILLHOUSE_VERIFICATION_TICKET: _ticket,
568
+ [VARIABLE_PHASE_DE_VERIFICATION]: _phase,
569
+ ...enfant
570
+ } = place.env;
571
+ const envEnfant = {
572
+ ...enfant,
573
+ [VARIABLE_TENUE]: enfant[VARIABLE_TENUE] ?? SANS_ARBITRE,
574
+ [VARIABLE_TRAVAILLEURS]: String(reservation.limiteCoeurs ?? reservation.coeurs),
575
+ };
576
+ // How the precise threads of a measure are held: the allowed cores of a group, the affinity of
577
+ // the launch, or not at all; a measure says it once.
404
578
  const delegationLue = delegationDeLaPasse({ env, delegation });
405
- const attache = prise.fils
579
+ const attache = dediees
406
580
  ? attacheDesCoeurs({
407
581
  env,
408
582
  ...(delegationLue ? { delegation: delegationLue } : {}),
409
583
  ...(affinite ? { affinite } : {}),
410
584
  })
411
585
  : null;
412
- if (attache?.dit && prise.dediee) {
586
+ if (attache?.dit) {
413
587
  dire(attache.dit);
414
588
  }
415
589
  const contexteDe = (groupe, unite) => ({
416
- part: prise.part,
590
+ part: reservation,
417
591
  groupe,
418
592
  unite,
419
- fils: attache && attache.voie !== 'aucune' ? prise.fils : null,
593
+ fils: attache && attache.voie !== 'aucune' ? dediees.fils : null,
420
594
  affinite: attache?.voie === 'affinite',
421
595
  });
422
596
  const sans = raison => {
423
- direSansPart(`joue sans part tenue : ${raison}`);
424
- return mesure(prise.env, contexteDe(false, null));
597
+ // Without an arbiter (the CI, a trial machine) nothing is said: no reservation is held.
598
+ if (place.id !== null) {
599
+ direSansGroupe(`joue sans groupe de contrôle : ${raison}`);
600
+ }
601
+ return mesure(envEnfant, { part: reservation, groupe: false, unite: null });
425
602
  };
426
- if (prise.part === null) {
427
- return prise.raison === "dans l'enveloppe d'un agent"
428
- ? sans(prise.raison)
429
- : mesure(prise.env, { part: null, groupe: false, unite: null });
430
- }
431
603
  const indisponible = groupeIndisponible({ env, ...(sonde ? { sonde } : {}) });
432
604
  if (indisponible !== null) {
433
605
  return sans(indisponible);
@@ -436,28 +608,56 @@ export function avecLaPasse(
436
608
  // cpuset controller delegated), and the cores given back at its end; the pass plays as it is
437
609
  // when the system refuses it, which it says.
438
610
  let rendreLesCoeurs = () => {};
439
- if (attache?.voie === 'groupe' && prise.dediee) {
440
- const tous = prise.topologie.coeurs.flatMap(c => c.fils);
441
- if (!ecarter({ dedies: prise.fils, fils: tous })) {
611
+ if (attache?.voie === 'groupe') {
612
+ const tous = dediees.topologie.coeurs.flatMap(c => c.fils);
613
+ if (!ecarter({ dedies: dediees.fils, fils: tous })) {
442
614
  dire(
443
615
  'les programmes hors du cadre ne sont pas tenus à l’écart des cœurs dédiés : le système refuse de régler leur groupe.'
444
616
  );
445
617
  }
446
618
  rendreLesCoeurs = () => void ecarter({ dedies: [], fils: tous });
447
619
  }
620
+ // An interrupted measure (SIGINT, SIGTERM, SIGHUP) lifts the restriction before it dies: the
621
+ // end of the `finally` below is not reached when a signal kills the process.
622
+ const signaux = ['SIGINT', 'SIGTERM', 'SIGHUP'];
623
+ const fin = signal => {
624
+ rendreLesCoeurs();
625
+ for (const s of signaux) {
626
+ process.removeListener(s, fin);
627
+ }
628
+ process.kill(process.pid, signal);
629
+ };
630
+ if (attache?.voie === 'groupe') {
631
+ for (const s of signaux) {
632
+ process.once(s, fin);
633
+ }
634
+ }
635
+ const retirerLesSignaux = () => {
636
+ for (const s of signaux) {
637
+ process.removeListener(s, fin);
638
+ }
639
+ };
448
640
  const identite = {
449
641
  racine,
450
- sorte: sorteDeLaPasse(sorte ?? (env.GRILLHOUSE_VERIFICATION_SORTE || 'verification')),
451
- ticket: ticket ?? (env.GRILLHOUSE_VERIFICATION_TICKET || undefined),
642
+ sorte: sorteLue,
643
+ ...marques,
644
+ ticket: ticketLu,
645
+ coeurs,
646
+ part: { ...reservation, id: place.id ?? randomUUID() },
647
+ };
648
+ const mesuree = {
649
+ racine,
650
+ ticket: identite.ticket,
651
+ sorte: sorteLue,
652
+ marques,
653
+ part: reservation,
654
+ horloge,
452
655
  coeurs,
453
- part: { ...prise.part, dossier: dossierDesParts(env), id: prise.id },
454
- mesurer: lourde,
455
656
  };
456
- const mesuree = { racine, ticket: identite.ticket, sorte: identite.sorte, part: prise.part, horloge, coeurs, lourde };
457
657
  // A measure of time judges the load of its dedicated cores while it plays: the busy time of
458
658
  // those cores out of its own (read from its group), a red on loaded cores « à repasser ».
459
659
  const jugee = (jouer, ouvert) => () => {
460
- if (!jugeLaChargeDuJeu({ dediee: prise.dediee, voie: attache?.voie, env })) {
660
+ if (!jugeLaChargeDuJeu({ dediee: mesureDeTemps, voie: attache?.voie, env })) {
461
661
  return jouer();
462
662
  }
463
663
  const avant = lireLesTempsOccupes(tempsDuSysteme());
@@ -474,11 +674,13 @@ export function avecLaPasse(
474
674
  : chargeHorsMesure({
475
675
  avant,
476
676
  apres: lireLesTempsOccupes(tempsDuSysteme()),
477
- fils: prise.fils,
677
+ fils: dediees.fils,
478
678
  mesureNs: cpuNs,
479
679
  });
480
680
  if (charge === null) {
481
- dire('la charge des cœurs dédiés pendant la mesure ne se lit pas : la mesure ne la juge pas.');
681
+ dire(
682
+ 'la charge des cœurs dédiés pendant la mesure ne se lit pas : la mesure ne la juge pas.'
683
+ );
482
684
  return r;
483
685
  }
484
686
  const code = typeof r === 'number' ? r : (r?.status ?? 0);
@@ -491,15 +693,36 @@ export function avecLaPasse(
491
693
  );
492
694
  return typeof r === 'number' ? juge : { ...r, status: juge };
493
695
  };
696
+ // The command of a group the system or the arbiter cut (SIGTERM, then SIGKILL, with no error of
697
+ // its own) is not judged: it ends « à repasser » (75), its line of the register « arrêtée faute
698
+ // de mémoire » (machine.md §5.3).
699
+ const arretee = jouer => () => {
700
+ const r = jouer();
701
+ if (
702
+ r &&
703
+ typeof r === 'object' &&
704
+ r.error === undefined &&
705
+ (r.signal === 'SIGTERM' || r.signal === 'SIGKILL')
706
+ ) {
707
+ dire(`l'étape est arrêtée par le système (${r.signal}) : à repasser (code ${A_REPASSER}).`);
708
+ return { ...r, status: A_REPASSER, signal: null, arretee: true };
709
+ }
710
+ return r;
711
+ };
494
712
  try {
495
713
  if (mode === 'commande') {
496
714
  const ouvert = (scope ?? scopeDeCommande(identite)).ouvrir();
497
- const contexte = contexteDe(true, ouvert.unite ?? null);
498
- return jouerMesuree(jugee(() => mesure(prise.env, contexte), ouvert), { ...mesuree, ouvert });
715
+ return jouerMesuree(
716
+ jugee(arretee(() => mesure(envEnfant, contexteDe(true, ouvert.unite ?? null))), ouvert),
717
+ {
718
+ ...mesuree,
719
+ ouvert,
720
+ }
721
+ );
499
722
  }
500
723
  const ouvert = (
501
724
  scope ??
502
- scopeSystemd({ ...identite, ...(attache?.voie === 'groupe' ? { fils: prise.fils } : {}) })
725
+ scopeSystemd({ ...identite, ...(attache?.voie === 'groupe' ? { fils: dediees.fils } : {}) })
503
726
  ).ouvrir();
504
727
  if ('raison' in ouvert) {
505
728
  return sans(ouvert.raison);
@@ -507,21 +730,56 @@ export function avecLaPasse(
507
730
  // The pass is the process itself: under the affinity of the launch, it takes its cores and
508
731
  // gives its own back at its end, its children inheriting them in between.
509
732
  const rendreLAffinite =
510
- attache?.voie === 'affinite' ? attacherLeProcessus(prise.fils) : () => {};
733
+ attache?.voie === 'affinite' ? attacherLeProcessus(dediees.fils) : () => {};
511
734
  try {
512
735
  return jouerMesuree(
513
- jugee(() => mesure(prise.env, contexteDe(false, null)), ouvert),
514
- { ...mesuree, ouvert }
736
+ jugee(() => mesure(envEnfant, contexteDe(false, null)), ouvert),
737
+ {
738
+ ...mesuree,
739
+ ouvert,
740
+ }
515
741
  );
516
742
  } finally {
517
743
  rendreLAffinite();
518
744
  }
519
745
  } finally {
746
+ retirerLesSignaux();
520
747
  rendreLesCoeurs();
521
748
  }
522
749
  } finally {
523
- prise.rendre();
750
+ place.rendre();
751
+ }
752
+ }
753
+
754
+ // The dedicated cores of a measure of time: the whole physical cores `grillhouse.mesure` asks for
755
+ // (`coeursDeLaMesure`), rounded as `filsDeLaMesure` says, on the topology of the machine; each
756
+ // thread counts for a core when the topology does not read.
757
+ function choisirLesCoeursDedies({ racine, env, topologie, dire }) {
758
+ const budget = budgetDeLaPasse(env);
759
+ let topo = topologie ?? lireLaTopologie({ nombreDeFils: machineDe(env).coeurs });
760
+ const budgetFils = budgetEnFils({ topologie: topo, budget: budget.coeurs });
761
+ const demande = coeursDeLaMesure({ racine, budget });
762
+ let n = filsDeLaMesure({ budget: budgetFils, topologie: topo, demande });
763
+ if (n === null || !topo.lisible) {
764
+ // No whole core in the budget, or a topology that does not read: each thread is a core.
765
+ topo = {
766
+ lisible: false,
767
+ coeurs: topo.coeurs.flatMap(c => c.fils.map(f => ({ fils: [f], noeud: c.noeud }))),
768
+ };
769
+ n = filsDeLaMesure({ budget: budgetFils, topologie: topo, demande });
770
+ dire('la topologie des cœurs ne se lit pas : chaque fil compte pour un cœur.');
771
+ }
772
+ const fils = choisirLesCoeurs({
773
+ budget: budgetFils,
774
+ topologie: topo,
775
+ tenus: [],
776
+ demande: n,
777
+ dedies: true,
778
+ });
779
+ if (fils === null) {
780
+ throw new AttenteDeLaMachine(`✗ cœurs dédiés : ${n} demandés, aucun cœur entier libre`, 1);
524
781
  }
782
+ return { fils, topologie: topo };
525
783
  }
526
784
 
527
785
  // Sets the programs out of the frame away from the dedicated cores (`ecartDesProgrammes`): whether
@@ -536,7 +794,8 @@ function ecarterLesProgrammes({ dedies, fils }) {
536
794
  function attacherLeProcessus(fils) {
537
795
  let avant = null;
538
796
  try {
539
- avant = /^Cpus_allowed_list:\s*(\S+)/m.exec(readFileSync('/proc/self/status', 'utf8'))?.[1] ?? null;
797
+ avant =
798
+ /^Cpus_allowed_list:\s*(\S+)/m.exec(readFileSync('/proc/self/status', 'utf8'))?.[1] ?? null;
540
799
  } catch {
541
800
  // unreadable: the former cores are not given back
542
801
  }
@@ -552,14 +811,15 @@ function attacherLeProcessus(fils) {
552
811
  }
553
812
 
554
813
  /**
555
- * Plays <passe> on its part of the machine, as a command a person runs (`npm test`): its exit
556
- * code, or, a wait that stops (its bound, 75; a faulty key or reserve, 1), its reason said and
557
- * its code. <passe> receives the environment of its children and its part (null where none is
558
- * held, in the envelope of an agent).
814
+ * Plays <passe> on its reservation of the machine, as a command a person runs (`npm test`): its
815
+ * exit code, or, a wait that stops (its bound, 75; a faulty reserve or an arbiter that does not
816
+ * answer, 1), its reason said and its code. <passe> receives the environment of its children and
817
+ * its reservation (null where none is held, in the envelope of an agent).
559
818
  * @param {(env: Record<string, string | undefined>,
560
819
  * part: { coeurs: number, memoire: number } | null) => number} passe
561
820
  * @param {{ env?: Record<string, string | undefined>, racine?: string,
562
- * mesure?: boolean, dire?: (l: string) => void }} [o] `mesure`: dedicated physical cores as its part (a measure of time)
821
+ * mesure?: boolean, dire?: (l: string) => void }} [o] `mesure`: a measure of time, played on
822
+ * dedicated cores in addition to its reservation
563
823
  * @returns {number}
564
824
  */
565
825
  export function surUnePart(