fix: move filter model init to an earlier stage
This commit is contained in:
parent
95fa08b517
commit
73b96e869d
@ -1,7 +1,7 @@
|
||||
import { Job } from "bullmq";
|
||||
import { db } from "lib/db/init.ts";
|
||||
import { getUnlabelledVideos, getVideoInfoFromAllData, insertVideoLabel} from "lib/db/allData.ts";
|
||||
import { classifyVideo, initializeModels } from "lib/ml/filter_inference.ts";
|
||||
import { classifyVideo } from "lib/ml/filter_inference.ts";
|
||||
import { ClassifyVideoQueue } from "lib/mq/index.ts";
|
||||
import logger from "lib/log/logger.ts";
|
||||
import { lockManager } from "lib/mq/lockManager.ts";
|
||||
@ -41,8 +41,6 @@ export const classifyVideosWorker = async () => {
|
||||
|
||||
lockManager.acquireLock("classifyVideos");
|
||||
|
||||
await initializeModels();
|
||||
|
||||
const client = await db.connect();
|
||||
const videos = await getUnlabelledVideos(client);
|
||||
logger.log(`Found ${videos.length} unlabelled videos`)
|
||||
|
@ -4,6 +4,7 @@ import logger from "lib/log/logger.ts";
|
||||
import { classifyVideosWorker, classifyVideoWorker } from "lib/mq/exec/classifyVideo.ts";
|
||||
import { WorkerError } from "lib/mq/schema.ts";
|
||||
import { lockManager } from "lib/mq/lockManager.ts";
|
||||
import { initializeModels } from "lib/ml/filter_inference.ts";
|
||||
|
||||
Deno.addSignalListener("SIGINT", async () => {
|
||||
logger.log("SIGINT Received: Shutting down workers...", "mq");
|
||||
@ -17,6 +18,9 @@ Deno.addSignalListener("SIGTERM", async () => {
|
||||
Deno.exit();
|
||||
});
|
||||
|
||||
|
||||
await initializeModels();
|
||||
|
||||
const filterWorker = new Worker(
|
||||
"classifyVideo",
|
||||
async (job: Job) => {
|
||||
|
Loading…
Reference in New Issue
Block a user