diff --git a/lib/db/allData.ts b/lib/db/allData.ts index 6c39256..0c6db08 100644 --- a/lib/db/allData.ts +++ b/lib/db/allData.ts @@ -77,7 +77,7 @@ export async function getNullVideoTagsList(client: Client) { ); } -export async function getUnlabeledVideos(client: Client) { +export async function getUnlabelledVideos(client: Client) { const queryResult = await client.queryObject<{ aid: number }>( `SELECT a.aid FROM all_data a LEFT JOIN labelling_result l ON a.aid = l.aid WHERE l.aid IS NULL`, ); diff --git a/lib/ml/filter_inference.ts b/lib/ml/filter_inference.ts index cb0f1e8..a271d40 100644 --- a/lib/ml/filter_inference.ts +++ b/lib/ml/filter_inference.ts @@ -28,6 +28,7 @@ export async function initializeModels() { sessionClassifier = classifierSession; sessionEmbedding = embeddingSession; + logger.log("Filter models initialized", "ml"); } catch (error) { const e = new WorkerError(error as Error, "ml", "fn:initializeModels"); throw e; diff --git a/lib/mq/exec/classifyVideo.ts b/lib/mq/exec/classifyVideo.ts index 195b79d..4e3c935 100644 --- a/lib/mq/exec/classifyVideo.ts +++ b/lib/mq/exec/classifyVideo.ts @@ -1,6 +1,6 @@ import { Job } from "bullmq"; import { db } from "lib/db/init.ts"; -import { getUnlabeledVideos, getVideoInfoFromAllData, insertVideoLabel} from "lib/db/allData.ts"; +import { getUnlabelledVideos, getVideoInfoFromAllData, insertVideoLabel} from "lib/db/allData.ts"; import { classifyVideo, initializeModels } from "lib/ml/filter_inference.ts"; import { ClassifyVideoQueue } from "lib/mq/index.ts"; import logger from "lib/log/logger.ts"; @@ -35,7 +35,8 @@ export const classifyVideoWorker = async (job: Job) => { export const classifyVideosWorker = async () => { await initializeModels(); const client = await db.connect(); - const videos = await getUnlabeledVideos(client); + const videos = await getUnlabelledVideos(client); + logger.log(`Found ${videos.length} unlabelled videos`) client.release(); let i = 0; for (const aid of videos) {