Giter Site home page Giter Site logo

Make Celery pluggable about selinon HOT 9 OPEN

selinon avatar selinon commented on May 25, 2024 1
Make Celery pluggable

from selinon.

Comments (9)

geetikabatra avatar geetikabatra commented on May 25, 2024

@fridex, is someone working on this issue?

from selinon.

fridex avatar fridex commented on May 25, 2024

@geetikabatra I don't think so. I planned it for the eventual release of 2.0 (I didn't expect to come this in before 1.0 release). Do you have a use case for it?

from selinon.

geetikabatra avatar geetikabatra commented on May 25, 2024

@fridex , There is no specific use case. But I would like to work on it.

from selinon.

fridex avatar fridex commented on May 25, 2024

@geetikabatra cool! If you need any guidance or a sync, feel free to ask :)

from selinon.

geetikabatra avatar geetikabatra commented on May 25, 2024

@fridex, Awesome. I can spend some time reading the documentation and the code, and we can sync up around next week. Please share any other link, if there is, that might be useful to me. :)

from selinon.

fridex avatar fridex commented on May 25, 2024

@fridex, Awesome. I can spend some time reading the documentation and the code, and we can sync up around next week. Please share any other link, if there is, that might be useful to me. :)

At least basic notion about Celery tasks - notably how to schedule task (the apply_async method on Celery's task instance) and how to retrieve states of tasks. Celery's docs can be helpful http://docs.celeryproject.org/en/latest/userguide/tasks.html

A basic knowledge of Selinon will be required - see official docs at http://selinon.readthedocs.io/en/latest/internals.html

Basically, there is a need to abstract apply_async and state checking into an interface, so there will be a need to create a class:

import enum
from abc import ABCMeta

class TaskState(enum.Enum):
      FINISHED
      PENDING
      FAILED
      UNKNOWN  # This will be an issue for Celery as it will always return pending state AFAIK

class SelinonBackend(metaclass=ABCMeta):
    @abstractmethod
    def schedule_task(self, task_name, node_args):
        """Schedule a task.

        @param task_name: name of task to be scheduled
        @param node_args: arguments supplied to the task
        @return: task id
        """

    @abstractmethod
    def check_task_state(self, task_id):
        """Check state of a task.

        @param task_id: id of task which state should be checked
        @return: task state
        """

And check for all occurrences of async apply and state checks. The constructor of SelinonBackend should be configurable via yaml files.

Celery or Dramatiq backend will simply implement SelinonBackend interface. If there is anything not clear, feel to ask.

from selinon.

geetikabatra avatar geetikabatra commented on May 25, 2024

@fridex, Thanks for the explanation. I got most of it. Will let you know if I get stuck anywhere.

from selinon.

weizhongjia avatar weizhongjia commented on May 25, 2024

is there any progress on this issue

from selinon.

fridex avatar fridex commented on May 25, 2024

is there any progress on this issue

Not any I would be aware of.

from selinon.

Related Issues (20)

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.