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

feat: async creation of playground #616

Merged
merged 7 commits into from
Mar 21, 2024

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Mar 21, 2024

What does this PR do?

Creates the playground async, and use tasks to display to the user the advancement

Out of scope for this PR:

  • A refactoring is possible as the application, inference server and playground creations use the same technique.

Screenshot / video of UI

What issues does this PR fix or reference?

Part of #525
Fixes #615

How to test this PR?

Delete inference servers and related image, and create a new playground.

The creation page should display a task 'Creating...'

When the playground is created, a button should be available to go to the Playground page

@feloy feloy requested a review from a team as a code owner March 21, 2024 06:54
@feloy feloy marked this pull request as draft March 21, 2024 06:54
@feloy feloy force-pushed the feat-525/create-playground-tasks branch 2 times, most recently from a55c74e to c372e0c Compare March 21, 2024 07:10
@feloy feloy marked this pull request as ready for review March 21, 2024 08:27
Copy link
Contributor

@jeffmaury jeffmaury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we switch to the playground once it is created (as it was before) ?

Comment on lines +58 to +65
.then((playgroundId: string) => {
this.taskRegistry.updateTask({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using await ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean await this.createPlayground(name, model) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes as it is the pattern we use in general

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because in this request* method, we want to return the trackingId asap, and run the long-running operation (createPlayground) asynchronously.

I think that it is done the same way in the other request* methods.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why it has an impact

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use await createPlayground here, it will wait for this function to resolve before to return trackingId. But this createPlayground can be long to be resolved (the time the inference server image is downloaded, the container started, etc)

@feloy
Copy link
Contributor Author

feloy commented Mar 21, 2024

Why don't we switch to the playground once it is created (as it was before) ?

I have been tempted to do the same as for the Inference server, but let's revert to the previous behaviour, which is more efficient for the user

@feloy feloy requested a review from jeffmaury March 21, 2024 13:21
Copy link
Contributor

@jeffmaury jeffmaury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a little comment on code style

Copy link
Contributor

@axel7083 axel7083 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job !

Just something is wrong with the layout position

image
windows-size.mp4

@@ -72,7 +110,15 @@ export class PlaygroundV2Manager extends Publisher<PlaygroundV2[]> implements Di
} else if (server.status === 'stopped') {
await this.inferenceManager.startInferenceServer(server.container.containerId);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should propagate the trackingId you created to the InferenceServer to see all the tasks related to the inference server creation.

https://github.com/projectatomic/ai-studio/blob/faf50e4bc7359728195b99cd8080e608e47bb52c/packages/backend/src/managers/playgroundV2Manager.ts#L72-L77

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, thanks, I was looking at how to do this

Signed-off-by: Philippe Martin <phmartin@redhat.com>
Signed-off-by: Philippe Martin <phmartin@redhat.com>
Signed-off-by: Philippe Martin <phmartin@redhat.com>
Signed-off-by: Philippe Martin <phmartin@redhat.com>
@feloy feloy force-pushed the feat-525/create-playground-tasks branch from db8ee53 to 291e2f4 Compare March 21, 2024 13:58
Signed-off-by: Philippe Martin <phmartin@redhat.com>
Signed-off-by: Philippe Martin <phmartin@redhat.com>
@feloy feloy force-pushed the feat-525/create-playground-tasks branch from bf132e4 to 895ad27 Compare March 21, 2024 14:18
@feloy feloy requested a review from axel7083 March 21, 2024 14:18
packages/frontend/src/pages/PlaygroundCreate.svelte Outdated Show resolved Hide resolved
packages/frontend/src/pages/PlaygroundCreate.svelte Outdated Show resolved Hide resolved
Co-authored-by: Florent BENOIT <fbenoit@redhat.com>
Signed-off-by: Philippe Martin <feloy1@gmail.com>
@feloy feloy merged commit bd95f70 into containers:main Mar 21, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playground creation should be async and use tasks
4 participants