-
Notifications
You must be signed in to change notification settings - Fork 65
feat: read catalog synchronously during init #3094
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
Conversation
Signed-off-by: Philippe Martin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on Linux
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change, LGTM
this.#jsonWatcher.init(); | ||
|
||
await this.readCatalogs(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async init(): Promise<void> {
return new Promise<void>((resolve) => {
// Creating a json watcher
this.#jsonWatcher = new JsonWatcher(this.getUserCatalogPath(), {
version: CatalogFormat.CURRENT,
recipes: [],
models: [],
categories: [],
});
this.#jsonWatcher.onContentUpdated(content => {
resolve();
this.onUserCatalogUpdate(content);
});
this.#jsonWatcher.init();
});
}
can't we just wrap the JSON watcher instead of reading manually the file??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, great idea. Just moving resolve() after onSuerCatalogUpdate()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Philippe Martin <[email protected]>
packages/backend/src/studio.spec.ts
Outdated
import { afterEach, beforeEach, expect, test, vi, describe, type MockInstance } from 'vitest'; | ||
import { Studio } from './studio'; | ||
import { type ExtensionContext, EventEmitter, version } from '@podman-desktop/api'; | ||
import * as catalogManager from './managers/catalogManager'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why importing everything using *
?
import * as catalogManager from './managers/catalogManager'; | |
import { CatalogManager } from './managers/catalogManager'; | |
[...] | |
vi.mocked(CatalogManager).mockReturnValue(...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, a residue of a another try, reverting...
Signed-off-by: Philippe Martin <[email protected]>
6d83534
to
dcbb838
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ! Thanks for including the changes
Signed-off-by: Philippe Martin [email protected]
What does this PR do?
Reads the catalogs during the call to
catalogManager.init()
, so the models are available for modelsManager at init timeScreenshot / video of UI
What issues does this PR fix or reference?
Fixes #2937
How to test this PR?
The problem in #2937 is reproducible only when a valid user catalog file exists. Download models, then create a user catalog file, and start Podman Desktop with AI Lab. The warnings of model not found should have disappeared