• Stars
    star
    135
  • Rank 269,297 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 6 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple tasks real-time updates with django channels, DRF, celery

Build Status

Simple-tasks

Example

Simple tasks real-time updates with django channels, DRF, celery

This repo is showing example how you can use celery tasks and django channels to send tasks progress over the websockets. The client side is written in react and redux.

The task that is executed in celery it is simple add. It accepts two arguments in JSON format, example {"arg1": 2, "arg2": 2}. It will execute as long as the value of the arg1. If the value of arg1 is negative the worker crash will be simulated in the code (crash with segfault). If the value of arg2 is negative then the worker will crash during importing fake package. (Both crash simulations were used to show how we can set FAILURE state even if worker crashed).

In this example the task can be in following states: CREATED, PROGRESS, SUCCESS, FAILURE. The progress value is not stored in database, it is only broadcasted by websockets during task exceution.

The task states and progress are set by:

  • backend/worker/redis_listener.py which is pubsub on redis. It is updating the progress value.
  • backend/worker/worker_listener.py which is monitoring celery events. It is setting state values, for example in case of task failure.

Nginx configuration

In this example we are running gunicorn and daphne servers and redirecting requests in nginx:

  • HTTP is going to gunicorn
  • websocket is going to daphne

This can be changed, and both HTTP and websocket connectionscan be handled by daphne server.

Running

To run the app you can use docker-compose:

docker-compose up --build -d

To stop the app:

docker-compose down

The app will be accessed at 0.0.0.0:8000.

More Repositories

1

keras2cpp

This is a bunch of code to port Keras neural network model into pure C++.
C++
664
star
2

my_ml_service

My Machine Learning Web Service
Python
600
star
3

datasets-for-start

Datasets for start with Machine Learning
60
star
4

dashboard-python-jupyter-notebook

Dashboard in Python with Jupyter Notebook
Jupyter Notebook
42
star
5

turtle-trading-python

The backtest of turtle trading algorithm on cryptocurrency data in python
Python
33
star
6

automated-pdf-reports-python

Automated PDF Reports with Python
Jupyter Notebook
20
star
7

nlp-apps-mercury

Jupyter Notebook
14
star
8

gafe

Genetic Algorithm Feature Engineering
Python
13
star
9

artistic-sketches-jupyter-mercury

Jupyter Notebook
11
star
10

data-drift-detection

Dashboard for Data Drift Detection in Python with Evidently and Mercury
Jupyter Notebook
11
star
11

hack-hn

Python
8
star
12

electron-monaco-python-lsp

Example of Electron with monaco-editor, python-lsp-server, monaco-languageclient
TypeScript
7
star
13

python-dashboard

Dashboard in Python with automatic updates and email notifications
Jupyter Notebook
6
star
14

numerai_metric_research

Research for Risk Metrics in Numerai data tournament
Jupyter Notebook
6
star
15

data-science-portfolio

Data Science Portfolio website created with Jupyter notebooks and Mercury
Jupyter Notebook
5
star
16

budapest-ml-forum-2022

My presentation for Budapest ML Forum (May 4, 2022)
Jupyter Notebook
5
star
17

dashboard-from-jupyter-with-mercury

Create Interactive Dashboard fron Jupyter Notebook with Mercury
Jupyter Notebook
5
star
18

mercury_demo_2

Demo Notebooks converted to web apps with Mercury
Jupyter Notebook
4
star
19

keras-sparse-check

Compare training on dense vs sparse data on data from neutrino experiments
Python
4
star
20

mercury-demo-notebooks

Mercury Demo Notbooks
Jupyter Notebook
3
star
21

test-token-open-zeppelin-crowdsale

Test Token based on Open Zeppelin Crowdsale
JavaScript
3
star
22

mercury_demo_1

Jupyter Notebook
3
star
23

my_ml_service_old

My Machine Learning Web Service
Python
2
star
24

ml-model-slides

Interactive slides for Machine Learning models
Jupyter Notebook
2
star
25

EuroSciPy-2023

Notebooks for EuroSciPy 2023 tutorial: "From Complex Scientific Notebook to User-Friendly Web Application"
Jupyter Notebook
2
star
26

style-transfer-jupyter-mercury

Collection of computer vision apps built with Jupyter Notebook and Mercury
Jupyter Notebook
2
star
27

chat-gpt-generate-jokes

Jupyter Notebook to generate jokes with ChatGPT. Web App created with Mercury.
Jupyter Notebook
2
star
28

pycon-lt-2023

Presentation for PyCon LT 2023 - Mercury Widgets
2
star
29

neural-network-gui

Neural Network GUI
JavaScript
2
star
30

mercury-simple-demo

Deploy Jupyter Notebook as web app to Heroku with Mercury
Jupyter Notebook
2
star
31

crypto-price-tracker-python

Jupyter Notebook
1
star
32

pystok

Prezentacja na pystok.org #50
Jupyter Notebook
1
star
33

mljar_kaggle

MLJAR AutoML benchmark on Kaggle datasets
Python
1
star
34

example-weather-app

REST API for api.example-weather-app.com
Python
1
star
35

JezykiProgramowania

Some code snippets for JP students.
C++
1
star
36

jupyter-notebook-presentation

Presentation from Jupyter Notebook
HTML
1
star
37

europython

Presentation for EuroPython conference
Jupyter Notebook
1
star
38

jupyter-notebook-widgets

Code for article The 2 approaches for Jupyter Notebook widgets
Jupyter Notebook
1
star
39

share-jupyter-notebook

Code for article on how to share Jupyter Notebook with non-programmers
Jupyter Notebook
1
star
40

nlp-spacy-web-app-mercury

Convert Jupyter Notebook to NLP SpaCy Web Application with Mercury
Jupyter Notebook
1
star