summaryrefslogtreecommitdiff
path: root/hooks/queuer.ts
diff options
context:
space:
mode:
authorElizabeth Alexander Hunt <me@liz.coffee>2025-05-18 22:54:15 -0700
committerElizabeth Alexander Hunt <me@liz.coffee>2025-05-18 22:55:20 -0700
commitd54e91c6582ed160cf2f2fcf977e48b4439d133b (patch)
tree5669367c4fa49bc0373b0c581ea3027218fd5e32 /hooks/queuer.ts
parent9cf3fc0259730b7dcf47b3ab4a04369e39fb4614 (diff)
downloadci-theBigRefactor.tar.gz
ci-theBigRefactor.zip
Diffstat (limited to 'hooks/queuer.ts')
-rw-r--r--hooks/queuer.ts44
1 files changed, 0 insertions, 44 deletions
diff --git a/hooks/queuer.ts b/hooks/queuer.ts
deleted file mode 100644
index d2987ca..0000000
--- a/hooks/queuer.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { getStdout, type IEither, type Traceable } from "@liz-ci/utils";
-import type { Job } from "@liz-ci/model";
-
-type QueuePosition = string;
-export class QueueError extends Error {}
-export interface IJobQueuer<TJob> {
- queue: (
- job: TJob,
- ) => Promise<IEither<QueueError, QueuePosition>>;
-}
-
-export class LaminarJobQueuer implements IJobQueuer<Traceable<Job>> {
- constructor(
- private readonly queuePositionPrefix: string,
- ) {}
-
- public async queue(j: Traceable<Job>) {
- const { item: job, logger: _logger } = j;
- const logger = _logger.addTracer(() => `[LaminarJobQueuer.queue.${job}]`);
- const laminarCommand = [
- "laminarc",
- "queue",
- job.type,
- ...Object.entries(job.arguments).map(([key, val]) => `"${key}"="${val}"`),
- ];
-
- logger.log(
- `im so excited to see how this queue job will end!! (>ᴗ<)`,
- laminarCommand,
- );
-
- return (await getStdout(j.map(() => laminarCommand))).mapRight(
- (stdout) => {
- logger.log(stdout);
-
- const [jobName, jobId] = stdout.split(":");
- const jobUrl = `${this.queuePositionPrefix}/jobs/${jobName}/${jobId}`;
-
- logger.log(`all queued up and weady to go~ (˘ω˘) => ${jobUrl}\n`);
- return jobUrl;
- },
- );
- }
-}