- commit
- 09eb5c46458f9ad9f98d5773ffcda99b63e179dd
- parent
- a58d774ae0f50b8aaca90c52342558a05714cf0d
- author
- dami <gazey55@gmail.com>
| M | fly.toml | 2 | ++ |
| M | site/ | 3 | +++ |
| M | site/ | 10 | ++++++++-- |
| M | site/ | 2 | ++ |
| M | site/ | 1 | + |
@@ -49,6 +49,7 @@ export type DailyConfig = {
4949 * must finish by rollover (its deadline); jobs = chunk processes at once */5050 prepare_hour_utc: number;5151 jobs: number;52+ band: number;5253 /** the emergency field generated at rollover when nothing is ready */5354 emergency: { chunks: number; chunk_g: number; rings: number };5455 };@@ -73,6 +74,7 @@ export function configFromEnv(): DailyConfig {
7374 generate: Deno.env.get("MOSAIC_GENERATE") === "1",7475 prepare_hour_utc: Number(Deno.env.get("MOSAIC_DAILY_PREPARE_UTC") ?? 20),7576 jobs: num("MOSAIC_DAILY_JOBS", 2),77+ band: num("MOSAIC_DAILY_BAND", 24),7678 emergency: { chunks: 3, chunk_g: 60, rings: 1 },7779 };7880 }@@ -370,6 +372,7 @@ export class Daily {
370372 field_g: this.cfg.G,371373 rings,372374 jobs: this.cfg.jobs,375+ band: this.cfg.band,373376 };374377 }375378 @@ -87,6 +87,9 @@ async function run(
8787 stdin: stdin === undefined ? "null" : "piped",8888 stdout: "piped",8989 stderr: "piped",90+ // a soft heap limit per engine process (each chunk is its own process91+ // and inherits it): the box has 2 GB for everything92+ env: { GOMEMLIMIT: Deno.env.get("MOSAIC_GOMEMLIMIT") ?? "256MiB" },9093 });9194 const child = cmd.spawn();9295 if (stdin !== undefined) {@@ -159,8 +162,10 @@ export type GenParams = {
159162 /** field only: pre-generate this many growth rings ("all" = until the160163 * field is full); the engine emits {base, rings: [delta, ...]} */161164 rings?: number | "all";162- /** field only: chunk processes at once (1 on the hosted box) */165+ /** field only: chunk processes at once (2 on the hosted box) */163166 jobs?: number;167+ /** field only: overlap band between chunk regions (24 is cheapest) */168+ band?: number;164169 /** field only: the engine's own overall budget, seconds */165170 timeout_s?: number;166171 };@@ -182,6 +187,7 @@ export function genArgs(p: GenParams): string[] {
182187 ...(p.field_g ? ["--G", String(p.field_g)] : []),183188 ...(p.rings !== undefined ? ["--rings", String(p.rings)] : []),184189 ...(p.jobs ? ["--jobs", String(p.jobs)] : []),190+ ...(p.band ? ["--band", String(p.band)] : []),185191 ...(p.timeout_s ? ["--timeout", `${p.timeout_s}s`] : []),186192 ];187193 }@@ -207,7 +213,7 @@ export async function cacheFile(p: GenParams): Promise<string> {
207213 const key = await sha256(208214 `${await version()}|${p.seed}|${p.G}|${p.kind}|${p.n ?? ""}|${209215 p.chunks ?? ""210- }|${p.chunk_g ?? ""}|${p.field_g ?? ""}|${p.rings ?? ""}`,216+ }|${p.chunk_g ?? ""}|${p.field_g ?? ""}|${p.rings ?? ""}|${p.band ?? ""}`,211217 );212218 return `${cacheDir()}${key}.json`;213219 }@@ -35,6 +35,7 @@ const cfg = {
3535 generate: true,3636 prepare_hour_utc: 20,3737 jobs: Number(args.jobs ?? 2),38+ band: Number(args.band ?? 24),3839 emergency: { chunks: 3, chunk_g: 60, rings: 1 },3940 };4041 async function token(): Promise<string> {@@ -57,6 +58,7 @@ const out = await gen({
5758 field_g: cfg.G,5859 rings: cfg.rings,5960 jobs: cfg.jobs,61+ band: cfg.band,6062 });6163 const { rings = [], ...base } = out;6264 const body = JSON.stringify({ base, rings });