Giter Club home page Giter Club logo

asyncio-pubsub-lab's Introduction

Asyncio Pubsub Lab

I've created this repository to investigate how DB connections behave under the stack of SQLAlchemy 2, asyncio and Pubsub.

Setup Environment

Given you have Python properly installed with poetry:

  1. Create .env from env.sample

  2. Start Pubsub

make pubsub_build
make pubsub_up
make pubsub_create_topic
make pubsub_create_subscription
make pubsub_up
  1. Start poetry
poetry install
poetry shell
  1. Start database
make db_up
make db_upgrade

Setup DB connection

task.py file connects to database, you have 4 options:

async_session as async_session,
async_session_null as async_session_null,
session_factory,
session_null_factory,

So you can use:

async for db_session in session_factory():

# OR

async for db_session in session_null_factory():

# OR

async with async_session() as db_session:

# OR

async with async_session_null() as db_session:

Traces

In order to configure grafana you must add Jaeger data source (URL: http://jaeger:16686)

Start Producer/Consumer

make pubsub_producer

make run_task

Access Database Stats

http://localhost:8080

asyncio-pubsub-lab's People

Contributors

victormartinez avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.