Refactor FaceAI build process and update Docker configurations to include matcher binary
This commit is contained in:
parent
b13c306883
commit
d36b0f4e46
15 changed files with 177 additions and 30 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { constants as fsConstants } from 'node:fs';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { Worker } from 'bullmq';
|
||||
|
|
@ -15,6 +16,22 @@ import { parseMatcherCsv, resolvePklPath, runFaceMatcher } from './worker-utils.
|
|||
|
||||
const connection = createRedisConnection(config.redisUrl);
|
||||
|
||||
async function ensureMatcherBinaryAvailable() {
|
||||
try {
|
||||
await fs.access(config.matcherBinary, fsConstants.X_OK);
|
||||
} catch (error) {
|
||||
console.error(`FaceAI processor cannot start because the matcher binary is unavailable: ${config.matcherBinary}`);
|
||||
console.error('Ensure FACEAI_MATCHER_BINARY points to a real executable and that the processor bind mount contains face_matcher.');
|
||||
if (error?.code === 'ENOENT') {
|
||||
console.error('The configured matcher path does not exist inside the processor runtime.');
|
||||
} else if (error?.code === 'EACCES') {
|
||||
console.error('The configured matcher path exists but is not executable by the processor runtime.');
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function formatLogLine(message, details) {
|
||||
const timestamp = new Date().toISOString();
|
||||
if (details === undefined) {
|
||||
|
|
@ -147,6 +164,8 @@ async function processJob(job) {
|
|||
}
|
||||
}
|
||||
|
||||
await ensureMatcherBinaryAvailable();
|
||||
|
||||
const worker = new Worker(config.queueName, processJob, {
|
||||
connection,
|
||||
concurrency: config.workerConcurrency
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue