maniwani icon indicating copy to clipboard operation
maniwani copied to clipboard

celery support

Open therealjr opened this issue 5 years ago • 3 comments

I'm trying to integrate some new features into the software such as task queue's and infinite scrolling. I've got a lot of it written but currently cannot find where to start my celery task. I call the celery function that is written in app.py from within Firehouse.py since it is called after the server has started. However I cannot find the interface which the redis server is listening on. How exactly can I reach redis' sockets?

therealjr avatar Jun 19 '20 07:06 therealjr

Which port redis is using (as well as its hostname) is dependent on how you've set up redis via docker-compose (or an alternative orchestration tool) - when using the docker-compose.yml shipped in the repository, you should be able to access it simply via the hostname redis when inside the Docker container network - so from code running in the main Maniwani container, for instance. If you've kept the redis section of your docker-compose.yml the same as it is in repo here, then the port should be redis default, which is 6379.

DangerOnTheRanger avatar Jun 20 '20 10:06 DangerOnTheRanger

Thank you for your response. I think my problem is better described here

therealjr avatar Jun 20 '20 10:06 therealjr

The connection being refused could be caused by the Maniwani container reaching the point where it tries to connect to redis before the redis container can be set up, but that's just a theory. I'd suggest adding a small standalone script (either via docker cp or via amending the Maniwani Dockerfile) that just tests redis and celery, and perhaps just redis alone if possible, and then running it after you're certain redis is up and running, via docker-compose exec or some other mechanism. If it works, then Maniwani is probably starting up.

How would you go about fixing this problem, if it were to be the culprit? Waiting to see if the redis port was open from the shell script that the Maniwani container uses to boot up uWSGI/Flask (build-helpers/docker-entrypoint.sh) and don't start Maniwani proper until after you can make a connection to redis. The captchouli container has similar code if you need some inspiration.

Figuring how when/where to call celery.task.delay can come after this gets sorted out, I think.

DangerOnTheRanger avatar Jun 20 '20 10:06 DangerOnTheRanger