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

Make sdx controller a WSGI app #215

Merged
merged 18 commits into from
Jan 30, 2024
Merged

Make sdx controller a WSGI app #215

merged 18 commits into from
Jan 30, 2024

Conversation

sajith
Copy link
Member

@sajith sajith commented Jan 27, 2024

Resolves #135. These commands should work now:

$ flask --app sdx_controller.app [run|routes|shell]

The above should work for development purposes. For production, we should be using:

$ uvicorn sdx_controller.app:app

Further, docker compose up will run uvicorn sdx_controller.app:app.

@sajith sajith self-assigned this Jan 27, 2024
@coveralls
Copy link

coveralls commented Jan 27, 2024

Pull Request Test Coverage Report for Build 7715376992

  • -13 of 46 (71.74%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.9%) to 38.387%

Changes Missing Coverage Covered Lines Changed/Added Lines %
sdx_controller/init.py 29 30 96.67%
sdx_controller/messaging/rpc_queue_consumer.py 4 7 57.14%
sdx_controller/app.py 0 9 0.0%
Totals Coverage Status
Change from base Build 7706014685: 0.9%
Covered Lines: 605
Relevant Lines: 1416

💛 - Coveralls

With daemon = True, when stopping the process:

    ^CINFO:root:Stopping RPC queue consumer
    INFO:sdx_controller.messaging.rpc_queue_consumer:[MQ] Stopping threads.

When daemon is not set:

    ^C^CException ignored in: <module 'threading' from '/usr/lib/python3.11/threading.py'>
    Traceback (most recent call last):
      File "/usr/lib/python3.11/threading.py", line 1583, in _shutdown
        lock.acquire()
    KeyboardInterrupt:
    INFO:root:Stopping RPC queue consumer
    INFO:sdx_controller.messaging.rpc_queue_consumer:[MQ] Stopping threads.
This is a work-around with testing in mind. We do not really use the
message queue, at least right now, in our little unit/integration test
suite. We do use the database.  With this restructuring, we do not
have to bring up the message queue for testing, just the DB.

When we are ready to test things with the message queue, we might want
to turn this back though.
WSGI server should manage the threads now
@sajith sajith marked this pull request as ready for review January 30, 2024 17:57
@sajith sajith merged commit 2dd0436 into main Jan 30, 2024
9 checks passed
@sajith sajith deleted the 135.wsgi-appify branch January 30, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Use WSGI (or maybe ASGI)?
3 participants