Skip to content
New issue

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

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

Already on GitHub? # to your account

Replace deprecated flask shutdown with thread kill. #1963

Merged
merged 3 commits into from
Mar 18, 2022

Conversation

T4rk1n
Copy link
Contributor

@T4rk1n T4rk1n commented Mar 10, 2022

Replace usage of deprecated flask shutdown by a thread kill.

Resolve #1780

Contributor Checklist

  • I have added entry in the CHANGELOG.md

@T4rk1n T4rk1n requested a review from alexcjohnson as a code owner March 10, 2022 21:02
@T4rk1n T4rk1n force-pushed the 1780-test-thread-shutdown branch from f1aa3ce to 1f8fac9 Compare March 10, 2022 21:42
@alexcjohnson
Copy link
Collaborator

@T4rk1n this works great, and on CI it looks perfect. However when I run tests locally (mac) I see warnings with every test case. Can we find a way to get rid of these, so the test output is clean? Might be as simple as putting the app.run_server call inside a try/except?

tests/integration/renderer/test_multi_output.py::test_rdmo005_set_props_behavior
  /Users/alex/.pyenv/versions/3.9.5/lib/python3.9/site-packages/_pytest/threadexception.py:75: PytestUnhandledThreadExceptionWarning:

  Exception in thread Thread-116

  Traceback (most recent call last):
    File "/Users/alex/.pyenv/versions/3.9.5/lib/python3.9/threading.py", line 954, in _bootstrap_inner
      self.run()
    File "/Users/alex/.pyenv/versions/3.9.5/lib/python3.9/threading.py", line 892, in run
      self._target(*self._args, **self._kwargs)
    File "/Users/alex/plotly/dash/dash/testing/application_runners.py", line 151, in run
      app.run_server(threaded=True, **kwargs)
    File "/Users/alex/plotly/dash/dash/dash.py", line 2043, in run_server
      self.server.run(host=host, port=port, debug=debug, **flask_run_options)
    File "/Users/alex/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 922, in run
      run_simple(t.cast(str, host), port, self, **options)
    File "/Users/alex/.pyenv/versions/3.9.5/lib/python3.9/site-packages/werkzeug/serving.py", line 1008, in run_simple
      inner()
    File "/Users/alex/.pyenv/versions/3.9.5/lib/python3.9/site-packages/werkzeug/serving.py", line 961, in inner
      srv.serve_forever()
    File "/Users/alex/.pyenv/versions/3.9.5/lib/python3.9/site-packages/werkzeug/serving.py", line 717, in serve_forever
      super().serve_forever(poll_interval=poll_interval)
    File "/Users/alex/.pyenv/versions/3.9.5/lib/python3.9/socketserver.py", line 232, in serve_forever
      ready = selector.select(poll_interval)
    File "/Users/alex/.pyenv/versions/3.9.5/lib/python3.9/selectors.py", line 416, in select
      fd_event_list = self._selector.poll(timeout)
  SystemExit

@T4rk1n
Copy link
Contributor Author

T4rk1n commented Mar 14, 2022

@alexcjohnson I wrapped the run_server call in a try/except, I don't have a Mac, can you try again? Thanks.

@T4rk1n T4rk1n force-pushed the 1780-test-thread-shutdown branch from 68c26f9 to 842cdc5 Compare March 14, 2022 14:46
Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

That did it - nice work! 💃

@T4rk1n T4rk1n force-pushed the 1780-test-thread-shutdown branch from 842cdc5 to a3bbd74 Compare March 18, 2022 14:42
@T4rk1n T4rk1n merged commit 6e09fed into dev Mar 18, 2022
@T4rk1n T4rk1n deleted the 1780-test-thread-shutdown branch March 18, 2022 16:01
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

environ['werkzeug.server.shutdown'] function is deprecated
2 participants