1import * as AWS from "@/AWS";
2import * as Effect from "effect/Effect";
3
4/**
5 * Marker printed by the job body; the e2e test asserts it appears in the
6 * job's `/aws/batch/job` log stream, proving the bundled Effect actually ran
7 * to completion inside the Batch container.
8 */
9export const MARKER = "alchemy-batch-platform-marker";
10
11/**
12 * End-to-end fixture for the Effect-native `AWS.Batch.JobDefinition` form: an
13 * inline run-to-completion Effect bundled + containerized + pushed to a
14 * managed ECR repository and registered as a Batch job definition. The
15 * container runs the `run` Effect and exits 0 (job `SUCCEEDED`).
16 */
17export default class NightlyJob extends AWS.Batch.JobDefinition<NightlyJob>()(
18 "BatchE2ENightlyJob",
19 {
20 main: import.meta.filename,
21 jobDefinitionName: "alchemy-test-batch-platform-e2e",
22 vcpus: 0.25,
23 memory: 512,
24 timeout: "10 minutes",
25 // Docker Hub's `oven/bun` image; the public.ecr.aws default mirror
26 // aggressively rate-limits anonymous pulls (429) during local builds.
27 docker: { base: "oven/bun:1" },
28 },
29 Effect.gen(function* () {
30 return {
31 run: Effect.gen(function* () {
32 // The awslogs driver captures stdout — print the marker for the
33 // out-of-band log assertion.
34 yield* Effect.sync(() => console.log(MARKER));
35 yield* Effect.log("nightly job body complete");
36 }),
37 };
38 }),
39) {}