Giter VIP home page Giter VIP logo

radical's Introduction

image

Contents

Decription

About

Radical is a RPC library that allows you to have cross-service communication out of the box.

It can serve as a replacement for Celery.

Radical has out-of-the-box integration with Django and also supports asyncio, but can be used without it.

Radical is easily extensible with custom transports and serializers.

Available transports:

  • Redis
  • Postgres

Default and recommended transport is Redis.

Available serializers:

  • JSON
  • Pickle

Default and recommended serializer is Pickle.

Glossary

Term Meaning

Service

A fully autonomous application written with Django, Sanic or vanilla Python.

Transport

Module that provides interface to actual network communication: for example, a Redis transport.

Serializer

Module that provides interface to data serialization and deserialization.

Quick start

Installing

pip install radical-rpc

Using with Django

  1. Add Radical to INSTALLED_APPS:

    INSTALLED_APPS = [
        # ...
        'radical',
        # ...
    ]
  2. Configure Radical:

    RADICAL_CONFIG = {
        'TRANSPORT_URL': 'redis://redis:6379/0?request_timeout=10',
        'QUEUE_NAME': 'myapp',
        'MODULES': [
            'radical.demo'
        ]
    }
  3. Call it anywhere:

    from radical.contrib.django import call_wait, call
    from django.http import JsonResponse
    
    def some_view(request):
        # Call remote method and wait for it to return result.
        result = call_wait('myapp', 'radical.demo.add', 1300, 37)
        return JsonResponse(dict(result=result))  # Returns {'result': 1337}
    
    def some_view(request):
        # Call remote method and do not wait for it to finish.
        call('myapp', 'radical.demo.add', 1300, 37)
        return JsonResponse(dict(result='Job was scheduled.'))
  4. Start Radical worker:

    ./manage.py radical

radical's People

Contributors

and3rson avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

chr1043086360

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.