Skip to content

Instantly share code, notes, and snippets.

View hadpro24's full-sized avatar
🎯
Focusing

Harouna Diallo hadpro24

🎯
Focusing
View GitHub Profile
@hadpro24
hadpro24 / celery_app.py
Created March 13, 2023 13:42 — forked from speedplane/celery_app.py
Celery Autoscaler Based on Memory and System Load
import multiprocessing
import re
from celery import Celery
from celery.worker.autoscale import Autoscaler as CeleryAutoscaler
class DAAutoscaler(CeleryAutoscaler):
# Try to keep the load above this point.
LOAD_MIN = .8
# Try to keep the load below this.
LOAD_MAX = 1.1
from flask import Flask
from flask_restful import Api, Resource, reqparse
app = Flask(__name__)
api = Api(app)
users = [
{
"name": "Nicholas",
"age": 42,