GithubHelp home page GithubHelp logo

npavan063 / django-celery-inspect Goto Github PK

View Code? Open in Web Editor NEW

This project forked from psychok7/django-celery-inspect

0.0 2.0 0.0 9 KB

Django app that uses Celery Inspect command to monitor workers/tasks via the Django REST Framework

License: MIT License

Python 100.00%

django-celery-inspect's Introduction

django-celery-inspect

Django reusable-app that uses Celery Inspect command to monitor workers via the Django REST Framework.

The main idea is to be able to monitor celery workers from another external service or server via a REST API and figure out if they are running or not by using celery's own [Inspect API] (http://docs.celeryproject.org/en/latest/userguide/workers.html#inspecting-workers).

Quick start

  1. Install:

     pip install django-celery-inspect
    
  2. Add "celery_inspect" to your INSTALLED_APPS setting like this:

     INSTALLED_APPS = [
    
       ...
       'celery_inspect',
     ]
    
  3. Add the following to your urls.py:

     url(r'^api/v1/celery-inspect/', include('celery_inspect.urls', namespace='celery_inspect')),
    
  4. If you Desire to use DRF's Authentication to protect these endpoints (Optional).

     REST_FRAMEWORK = {
         'DEFAULT_AUTHENTICATION_CLASSES': (
     	'rest_framework.authentication.TokenAuthentication',
         ),
         'DEFAULT_PERMISSION_CLASSES': (
     	'rest_framework.permissions.IsAuthenticated',
         ),
     }
    

Usage:

  1. http://localhost:8000/api/v1/celery-inspect/ping/

     {
     	"worker2@localhost:8000": {
     	    "ok": "pong"
     	},
     	"worker1@localhost:8000": {
     	    "ok": "pong"
     	}
     	}
    
  2. http://localhost:8000/api/v1/celery-inspect/active/

     {
         "worker2@localhost:8000": [],
         "worker1@localhost:8000": []
     }
    
  3. http://localhost:8000/api/v1/celery-inspect/registered/

     {
         "worker2@localhost:8000": [
             "core.tasks.db_backup",
             "core.tasks.send_queued_emails",
             "yy.tasks.assign_to_mongo",
             "xx.tasks.check_for_new_registered",
             "xx.tasks.create_and_associate_manager",
             "qq.celery.debug_task"
         ],
         "worker1@localhost:8000": [
             "core.tasks.db_backup",
             "core.tasks.send_queued_emails",
             "yy.tasks.assign_to_mongo",
             "xx.tasks.check_for_new_registered",
             "xx.tasks.create_and_associate_manager",
             "qq.celery.debug_task"
         ]
     }
    
  4. http://localhost:8000/api/v1/celery-inspect/scheduled/

     {
         "worker2@localhost:8000": [],
         "worker1@localhost:8000": []
     }
    

django-celery-inspect's People

Watchers

 avatar  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.