20 lines
611 B
JavaScript
20 lines
611 B
JavaScript
import cp from "node:child_process";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { jobBuilder, createFile, deleteFile } from "./k8s-common.js";
|
|
|
|
// Constants
|
|
const internalEngine = path.resolve("./lib/jobs/k8s/k8s-internal-engine.js");
|
|
|
|
// Functions
|
|
const applyFileInternally = (filePath) => {
|
|
const job = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
cp.fork(internalEngine, [job]);
|
|
};
|
|
|
|
export default async function createJobInternally(jobRequest) {
|
|
const job = jobBuilder(jobRequest);
|
|
const filePath = createFile(job);
|
|
applyFileInternally(filePath);
|
|
deleteFile(filePath);
|
|
}
|