Essence
This commit is contained in:
parent
512766ebed
commit
295f4a0c2a
|
@ -3,14 +3,6 @@ import { Dimensions } from "services/face/geom";
|
|||
import { EnteFile } from "types/file";
|
||||
import { Box, Point } from "./geom";
|
||||
|
||||
export interface MLSyncResult {
|
||||
nOutOfSyncFiles: number;
|
||||
nSyncedFiles: number;
|
||||
nSyncedFaces: number;
|
||||
nFaceClusters: number;
|
||||
error?: Error;
|
||||
}
|
||||
|
||||
export declare type FaceDescriptor = Float32Array;
|
||||
|
||||
export declare type Cluster = Array<number>;
|
||||
|
|
|
@ -16,7 +16,6 @@ import {
|
|||
MLLibraryData,
|
||||
MLSearchConfig,
|
||||
MLSyncFileContext,
|
||||
MLSyncResult,
|
||||
MlFileData,
|
||||
} from "services/face/types";
|
||||
import { getLocalFiles } from "services/fileService";
|
||||
|
@ -151,7 +150,7 @@ class MachineLearningService {
|
|||
private localSyncContext: Promise<MLSyncContext>;
|
||||
private syncContext: Promise<MLSyncContext>;
|
||||
|
||||
public async sync(token: string, userID: number): Promise<MLSyncResult> {
|
||||
public async sync(token: string, userID: number): Promise<boolean> {
|
||||
if (!token) {
|
||||
throw Error("Token needed by ml service to sync file");
|
||||
}
|
||||
|
@ -180,18 +179,9 @@ class MachineLearningService {
|
|||
}
|
||||
*/
|
||||
|
||||
const mlSyncResult: MLSyncResult = {
|
||||
nOutOfSyncFiles: syncContext.outOfSyncFiles.length,
|
||||
nSyncedFiles: syncContext.nSyncedFiles,
|
||||
nSyncedFaces: syncContext.nSyncedFaces,
|
||||
nFaceClusters:
|
||||
syncContext.mlLibraryData?.faceClusteringResults?.clusters
|
||||
.length,
|
||||
error: syncContext.error,
|
||||
};
|
||||
// log.info('[MLService] sync results: ', mlSyncResult);
|
||||
|
||||
return mlSyncResult;
|
||||
const error = syncContext.error;
|
||||
const nOutOfSyncFiles = syncContext.outOfSyncFiles.length;
|
||||
return !error && nOutOfSyncFiles > 0;
|
||||
}
|
||||
|
||||
public async regenerateFaceCrop(faceID: string) {
|
||||
|
|
|
@ -269,11 +269,8 @@ class MLWorkManager {
|
|||
const userID = getUserID();
|
||||
const jobWorkerProxy = await this.getSyncJobWorker();
|
||||
|
||||
const mlSyncResult = await jobWorkerProxy.sync(token, userID);
|
||||
|
||||
return await jobWorkerProxy.sync(token, userID);
|
||||
// this.terminateSyncJobWorker();
|
||||
return !mlSyncResult.error && mlSyncResult.nOutOfSyncFiles > 0;
|
||||
|
||||
// TODO: redirect/refresh to gallery in case of session_expired, stop ml sync job
|
||||
} catch (e) {
|
||||
log.error("Failed to run MLSync Job", e);
|
||||
|
|
Loading…
Reference in a new issue