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