Skip to content

Releases: Mjolnir-Software/dynoscale-python

v1.2.2

17 May 18:45

Choose a tag to compare

1.2.2 [2023-05-17]

  • updated test/dev dependencies
  • adding support for TLS redis urls with self-signed certificates

v1.2.1

21 Mar 12:50

Choose a tag to compare

1.2.1 [2023-03-21]

  • improved speed and memory consumption while logging RQ jobs

v1.2.0

08 Feb 18:07
02778bc

Choose a tag to compare

1.2.0 [2023-01-08]

  • dropping support for Python 3.7, 3.8, 3.9
  • adding support for Gunicorn with Uvicorn workers, use dynoscale.uvicorn.DynoscaleUnicornWorker

...

📖 Complete ASGI example

  1. Add dynoscale to your app on Heroku: heroku addons:create dscale
  2. Prepare your amazing webapp, we'll use Starlette served by Gunicorn with Uvicorn workers:
    # web.py
    import datetime
    from starlette.applications import Starlette
    from starlette.responses import Response
    from starlette.routing import Route
    
    
    async def home(_):
        return Response(
            "Hello from 🌟 Starlette 🌟 served by Gunicorn using Uvicorn workers and scaled by Dynoscale!\n"
            f"It's {datetime.datetime.now()} right now.",
            media_type='text/plain'
        )
    
    
    app = Starlette(debug=True, routes=[Route('/', endpoint=home, methods=['GET'])])
    ... add Gunicorn config:
    # gunicorn.conf.py
    import os
    # ENV vars
    PORT = int(os.getenv('PORT', '3000'))
    WEB_CONCURRENCY = int(os.getenv('WEB_CONCURRENCY', '10'))
    
    # Gunicorn config
    wsgi_app = "web:app"
    
    # ┌---------- THIS HERE IS ALL OF DYNOSCALE SETUP ----------┐
    # | # worker_class = 'uvicorn.workers.UvicornWorker'        |
    worker_class = 'dynoscale.uvicorn.DynoscaleUvicornWorker' # |
    # └---------------------------------------------------------┘
    
    bind = f"0.0.0.0:{PORT}"
    preload_app = True
    
    workers = WEB_CONCURRENCY
    max_requests = 1000
    max_requests_jitter = 50
    
    accesslog = '-'
    loglevel = 'debug'
  3. Install all the dependencies:
    • python -m pip install "uvicorn[standard]" gunicorn dynoscale
  4. Start it up with:
      DYNO=web.1 DYNOSCALE_DEV_MODE=true DYNOSCALE_URL=https://some_request_bin_or_some_such.com gunicorn
    • On Heroku, DYNO and DYNOSCALE_URL will be set for you, you should only have web: gunicorn in your procfile.
    • In this example we start Dynoscale in dev mode to simulate random queue times, don't do this on Heroku!
  5. That's it you're done, now Profit! Literally, this will save you money! 💰💰💰 😏
    ...

v1.1.3

13 Jan 15:46
d66320f

Choose a tag to compare

  • Added support for ASGI through DynoscaleAsgiApp class
  • Added options to control DS repository storage location with environment variables

.
..
...
If you have an ASGI app (ex.: Starlette, Responder, FastAPI, Sanic, Django, Guillotina, ...) pass your ASGI app
into DynoscaleASGIApp:

# `web.py` - Starlette Example
import os

from starlette.applications import Starlette
from starlette.responses import Response
from starlette.routing import Route

from dynoscale.asgi import DynoscaleAsgiApp


async def home(_):
    return Response("Hello from Starlette, scaled by Dynoscale!", media_type='text/plain')


app = DynoscaleAsgiApp(Starlette(debug=True, routes=[Route('/', endpoint=home, methods=['GET'])]))

if __name__ == "__main__":
    import uvicorn

    uvicorn.run('web:app', host='0.0.0.0', port=int(os.getenv('PORT', '8000')), log_level="info")

...
..
.

... more info in README.md

v1.1.2

27 May 14:31

Choose a tag to compare

Added logging to DynoscaleRQLogger

v1.1.1

12 May 20:28

Choose a tag to compare

Fix for incorrect request start lookup in env.headers when using gunicorn hook.

v1.1.0

10 May 11:36

Choose a tag to compare

Support for RQ workers

v1.0.0

28 Feb 00:01

Choose a tag to compare

Initial release