Coder Social home page Coder Social logo

getninjas / celery-executor Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 16.0 67 KB

A `concurrent.futures.Executor` implementation using Celery as backend

Home Page: https://pypi.org/project/celery-executor/

License: Other

Makefile 11.65% Python 88.35%

celery-executor's Introduction

Celery Executor

PyPI version fury.io Build Status Read The Docs PyUP

A concurrent.futures.Executor implementation using Celery as backend

Features

The package provides a CeleryExecutor implementing the interface of concurrent.futures.Executor

>>> from celery_executor.executors import CeleryExecutor
>>> executor = CeleryExecutor()
>>> for result in executor.map(str.upper, ['one', 'two', 'three']):
...     print(result)
ONE
TWO
THREE

Beware that the Executor.map() interface can yield the results out of order, if later ones got to finish first.

Caveats

This executor frees the developer to the burden of mark every single task function with the Celery decorators, and to import such tasks on the Worker beforehand. But does not frees from sending the code to the Worker.

The function sent to CeleryExecutor.map() should be pickable on the client (caller of .map() or .submit()) and should be unpickable on the Celery Worker handling the "Task" sent. Is not possible to send lambdas for example.

As Celery assumes that is to the developer to put the needed code on the Worker, be sure that the function/partial code sent to CeleryExecutor to exist on the Worker.

To Be Done

  • Document the CeleryExecutor.__init__() nonstandard extra options predelay, postdelay and applyasync_kwargs.
  • Test behaviours of canceling a Task when canceling a Future
  • Test behaviours of shutting down executors and trying to send new tasks
  • Find a way to test the RUNNING state of Celery Tasks, as its events are not propagated by the test worker Celery provides

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

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.