| 1 | import type * as deadline from "@distilled.cloud/aws/deadline"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Queue } from "./Queue.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `deadline:GetJob`. |
| 8 | * |
| 9 | * Reads a job's detail in the bound {@link Queue} — lifecycle status, task |
| 10 | * run status counts, priority, timing. The queue's `farmId`/`queueId` are |
| 11 | * injected from the binding. Provide the implementation with |
| 12 | * `Effect.provide(AWS.Deadline.GetJobHttp)`. |
| 13 | * ### Monitoring Jobs |
| 14 | * **Example:** Check A Job's Status |
| 15 | * ```typescript |
| 16 | * // init — bind the operation to the queue |
| 17 | * const getJob = yield* AWS.Deadline.GetJob(queue); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const job = yield* getJob({ jobId }); |
| 21 | * if (job.taskRunStatus === "FAILED") { |
| 22 | * yield* Effect.logError(job.lifecycleStatusMessage); |
| 23 | * } |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface GetJob extends Binding.Service< |
| 29 | GetJob, |
| 30 | "AWS.Deadline.GetJob", |
| 31 | ( |
| 32 | queue: Queue, |
| 33 | ) => Effect.Effect< |
| 34 | ( |
| 35 | request: Omit<deadline.GetJobRequest, "farmId" | "queueId">, |
| 36 | ) => Effect.Effect<deadline.GetJobResponse, deadline.GetJobError> |
| 37 | > |
| 38 | > {} |
| 39 | export const GetJob = Binding.Service<GetJob>("AWS.Deadline.GetJob"); |