Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More logging to preload AI script #802

Merged
merged 3 commits into from
Feb 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions desci-server/src/scripts/preload-ai-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,19 @@ async function main() {
try {
const result = await preloadAiData(node);
if (!result) {
// debugger;
logger.error({ uuid, nodeId: id }, 'Error preloading AI data for node');
failures.push({ uuid, nodeId: id });
}
logger.info({ uuid, nodeId: id }, `[Preload AI API] Completed processing node ${nodeIndex}/${nodes.length}`);
} catch (e) {
logger.error({ uuid, nodeId: id }, 'Error preloading AI data for node');
// debugger;
logger.error(
{ uuid, nodeId: id, node: `${nodeIndex}/${nodes.length}`, error: e },
'Error preloading AI data for node',
);
failures.push({ uuid, nodeId: id, error: e });
}
logger.info({ uuid, nodeId: id }, `[Preload AI API] Completed processing node ${nodeIndex}/${nodes.length}`);
});
await Promise.allSettled(promises);
}
Expand Down Expand Up @@ -112,6 +117,8 @@ async function preloadAiData(node: Node) {
if (!aiData) {
logger.error({ nodeId: node.id, uuid: node.uuid, manuscriptCid }, 'Failed getting AI data for manuscript');
throw new Error('Failed getting AI data for manuscript');
} else {
logger.info({ nodeId: node.id, uuid: node.uuid, manuscriptCid }, 'Successfully preloaded AI data for manuscript');
}
return true;
// We can go about making mutations here to the manifest, without the mutations the data is already cached with a long TTL,
Expand Down