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

Pass Error status in /dev/reload stream #8106

Merged
merged 11 commits into from May 1, 2024
Merged

Conversation

freddyaboulton
Copy link
Collaborator

@freddyaboulton freddyaboulton commented Apr 23, 2024

Description

Let clients know when an error happened during reload. Also refactored the route to support more than one client connecting simultaneously.

Logic is here and should not conflict with #8056 but will wait for #8056

There are two message types in the thread reload and error.

reload_status_stream

Edit: also errors are shown in the UI now

image

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Tests

  1. PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests: bash scripts/run_all_tests.sh

  2. You may need to run the linters: bash scripts/format_backend.sh and bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Apr 23, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook failed! Details
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/7f6c699dc9626b3c0cf2e707c963fbdc169bc565/gradio-4.28.3-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@7f6c699dc9626b3c0cf2e707c963fbdc169bc565#subdirectory=client/python"

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Apr 23, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/app patch
gradio patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Pass Error status in /dev/reload stream

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@freddyaboulton freddyaboulton added the v: patch A change that requires a patch release label Apr 23, 2024
@freddyaboulton freddyaboulton marked this pull request as ready for review May 1, 2024 14:35
@pngwn
Copy link
Member

pngwn commented May 1, 2024

I think it would be nice to show the full trace here but I guess the error toast is too small for that?

@freddyaboulton
Copy link
Collaborator Author

I think so and they should have access to the server logs anyways (that's the idea on spaces as well I believe)

@pngwn
Copy link
Member

pngwn commented May 1, 2024

Would be cool if it was all viewable in the browser tho, on a single screen you often have to choose 2 of browser, terminal, editor. Can discuss later anyway, this is much better DX!

Copy link
Member

@pngwn pngwn left a comment

Choose a reason for hiding this comment

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

Tested and works great! Thanks @freddyaboulton!

@freddyaboulton
Copy link
Collaborator Author

Just added the python traceback to the console! Thanks for the review @pngwn

image

@freddyaboulton freddyaboulton enabled auto-merge (squash) May 1, 2024 17:40
@@ -155,6 +155,10 @@
};
}
export function add_new_message(message: string, type: ToastMessage["type"]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: could use this internally in Block.svelte whenever we add a message too

Copy link
Collaborator

@aliabid94 aliabid94 left a comment

Choose a reason for hiding this comment

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

Looks great, thanks freddy! Only thought is if I wonder if the error message should show more than just "Error reloading app", maybe the actual traceback?

EDIT: just saw that was discussed above.

Also, I wish the reload error toast would go away immediately as soon as I fixed the app, but that's probably a bit tricky.

@freddyaboulton freddyaboulton merged commit d0a759f into main May 1, 2024
6 of 7 checks passed
@freddyaboulton freddyaboulton deleted the error-message-stream branch May 1, 2024 22:21
@freddyaboulton
Copy link
Collaborator Author

Thanks for the review @aliabid94 ! Will think about how we can close the error toast automatically!

freddyaboulton added a commit that referenced this pull request May 2, 2024
* get error message

* Support multiple clients

* add changeset

* add changeset

* add changeset

* Display in UI

* console.error the python traceback

* lint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
freddyaboulton added a commit that referenced this pull request May 2, 2024
* get error message

* Support multiple clients

* add changeset

* add changeset

* add changeset

* Display in UI

* console.error the python traceback

* lint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
@pngwn
Copy link
Member

pngwn commented May 2, 2024

Also, I wish the reload error toast would go away immediately as soon as I fixed the app, but that's probably a bit tricky.

I think this should be possible.

If each error message takes an id of the fn_index, then when we change the status of that fn_index to 'not an error' we can call a 'close_message' function on the Toast component (export one) that could filter out toasts with the given id. This is probably a good idea for all statuses tbh, because after the fn has run again those status are stale and irrelevant.

@pngwn
Copy link
Member

pngwn commented May 2, 2024

We need to refactor the progress stuff tbh it has gotten a bit out of hand, very hard to parse now. One problem @freddyaboulton and I came across is that the loading status centres around components, changing statuses for functions is harder than we felt it should be. Can look into it.

@pngwn pngwn mentioned this pull request May 3, 2024
dawoodkhan82 pushed a commit that referenced this pull request May 6, 2024
* get error message

* Support multiple clients

* add changeset

* add changeset

* add changeset

* Display in UI

* console.error the python traceback

* lint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v: patch A change that requires a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants