Skip to content

Instantly share code, notes, and snippets.

@Quard
Quard / primary_celery_example.py
Last active December 15, 2021 08:27
The Python Celery Cookbook: Small Tool, Big Possibilities
from django.conf import settings
from django.core.mail import send_mail
from django.template import Engine, Context
from myproject.celery import app
def render_template(template, context):
engine = Engine.get_default()
@Quard
Quard / primary_celery_example_use.py
Created April 10, 2019 13:16
The Python Celery Cookbook: Small Tool, Big Possibilities
send_mail_task.delay(('noreply@example.com', ), 'Celery cookbook test', 'test', {})
@Quard
Quard / queues_config_example.py
Created April 10, 2019 13:16
The Python Celery Cookbook: Small Tool, Big Possibilities
CELERY_TASK_ROUTES = {
'myproject.apps.mail.tasks.send_mail_task': {'queue': 'mail', },
}
@Quard
Quard / run_queues_example.sh
Created April 10, 2019 13:17
The Python Celery Cookbook: Small Tool, Big Possibilities
celery -A myproject worker -l info -Q celery
celery -A myproject worker -l info -Q mail
@Quard
Quard / bechmark_results.md
Created July 16, 2019 08:53
Benchmark results for article "My story about Go, Python and benkmarks."

Python + Redis

API get

Running 30s test @ http://rpi:5000/api/v1/url/aaaa
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   489.29ms  196.29ms   1.38s    82.02%
    Req/Sec    68.43     31.64   192.00     72.98%