Category : celery

I’m trying to run redis and celery separately in two docker container docker run -p 6379:6379 –name some-redis -d redis and docker run –link some-redis:redis -e CELERY_BROKER_URL=redis://localhost:6739/0 –name some-celery -d celery But it looks like celery doesn’t see redis BROKER_URL = ‘redis://localhost:6379/0’ app = Celery(‘tasks’, broker=BROKER_URL) @app.task def add(): text = ‘hello !’ url = ..

Read more

who knows what the problem is and how to fix it, I will try to explain. I have 2 projects, 2 databases: a warehouse and a store, when a new product arrives at the warehouse, the selery performs the task and checks how much product needs to be added to the Store’s database, or if ..

Read more

I’m having the following configuration: class Foo: def __init__(self, services: List[str]): self.services = services def enqueuer(self, func): def wrapper(*args, **kwargs): if not args[1] in self.services: raise ForbiddenServiceError return func.delay(*args, **kwargs) return wrapper @enqueuer @celery_app.task() def foo_task(self, data, service: str): time.sleep(10) print(f"Received the service: {service} with data: {data}") foo = Foo(["service1", "service2"]) foo.foo_task("Dummy data", "service1") Will ..

Read more

I’m getting this error after running the following command: C:Userscalluproject_name>celery -A project_name worker -l info I’m wondering if it has something to do with the fact that I’ve not created my django project in a virtual environment but I can’t find anything on the issue. If it was due to it being outside a virtual ..

Read more

I’m using Pydantic’s BaseModel for creating my working class. I also have custom methods other than the methods with validators. I need to use singledispatchmethod decorator from functools with the custom function. For example, class Foo(pydantic.BaseModel): name: str bar: int baz: int @functools.singledispatchmethod def handle(self, command: Command) -> CommandResult: pass @celery.task def add(a: int, b: ..

Read more

I’m running a selenium webdriver in a celery task. However, in some cases, I need to revoke/terminate the celery task. I successfully terminate the celery task using the following >>> from proj.celery import app >>> app.control.revoke(task_id, terminate=True) However, the webdriver remains open when the task is terminated has been terminated. How can I quit the ..

Read more

I am using celery in both the projects. Redis is used as a broker and backend. Suppose project A has task @shared_task() def add(x,y): return x+y Now I want to send this task in Project B and execute it there. Is there any possible way to do so? Both the project has configuration like this ..

Read more

class DevelopmentConfigLocalHost(Config): SQLALCHEMY_DATABASE_URI = ‘sqlite:///tmp/temp.db’ CELERY_BROKER_URL = "redis://localhost:6379/0" This is pretty simple config. As for my factory, I’m supplying app, and celery as global. _celery def create_app(): global _celery Suppling my global _celery with create_celery inside of create_app factory. Also made sure the config is working. It does. app.config.from_object(DevelopmentConfigLocalHost()) print(app.config[‘CELERY_BROKER_URL’]) CORS(app, resources={ r’/document/*’: {‘origins’: ‘*’}, ..

Read more