How to Create a Celery Task Progress Bar in Django

  Рет қаралды 44,384

Pretty Printed

Pretty Printed

4 жыл бұрын

In this video I will show you how to use the library Django Celery Results to display a progress bar for any Celery tasks you have running.
Need one-on-one help with your project? I can help through my coaching program. Learn more here: prettyprinted.com/coaching
docs.celeryproject.org/en/sta...
github.com/czue/celery-progress
github.com/celery/django-cele...
Get the code here: prettyprinted.com/l/V9v
Twitter: / pretty_printed
Github: github.com/prettyprinted

Пікірлер: 65
@ShaunCullen
@ShaunCullen 2 жыл бұрын
Thanks for highlighting how to manually request the task progress, this makes it useful for people using Django as just an API using DRF. Much appreciated!
@down__lo7359
@down__lo7359 3 жыл бұрын
Only channel on youtube covering this, been helpful. Thanks a ton :)
@pardhabandaru1105
@pardhabandaru1105 2 жыл бұрын
most tutorials edit the messed up parts and show them as smooth flow. but you admitin and showing the error and fixing is very helpful. Thanks a lot.
@MarceloAgostonSchrotlin
@MarceloAgostonSchrotlin 3 жыл бұрын
Thanks again for another great video Anthony... please make more videos like this!!
@Ali-ts6po
@Ali-ts6po 3 жыл бұрын
Awesome! You made my day! Thank you for the awesome video.
@anubhavsidhu23
@anubhavsidhu23 4 жыл бұрын
Hey Anthony, Thanks for another great video. Your videos deserve more views and likes.
@steventeglman
@steventeglman 11 ай бұрын
This is a criminally underviewed video; helped me a lot! Thank you!
@prettyprinted
@prettyprinted 11 ай бұрын
Glad it helped you!
@CryptoWizards
@CryptoWizards 3 жыл бұрын
Great video and worked really well when assigning a workr as --pool=solo for windows users
@numanfarukh1645
@numanfarukh1645 3 жыл бұрын
Thanks for clear explanation.
@kaithojuranjith9522
@kaithojuranjith9522 3 жыл бұрын
Man you are just awesome. I always follow your videos 👏👏
@mahmudsajib8648
@mahmudsajib8648 4 жыл бұрын
Wow! Loved it. Unique content
@prettyprinted
@prettyprinted 4 жыл бұрын
I'm glad you liked it!
@tekbahadurkshetri4327
@tekbahadurkshetri4327 4 жыл бұрын
Thank you very much i just need this and you uploaded the video. What a coincidence?😄
@prettyprinted
@prettyprinted 4 жыл бұрын
That's awesome! I'm glad I could help.
@MrJplattus
@MrJplattus 3 жыл бұрын
work as a charm
@mashoodurrehman9840
@mashoodurrehman9840 4 жыл бұрын
Awesome as ever.
@prettyprinted
@prettyprinted 4 жыл бұрын
Thanks for watching!
@juantascon3870
@juantascon3870 3 жыл бұрын
Thanks a lot!
@x20x200
@x20x200 Жыл бұрын
Thank you.
@forgiveness_denied
@forgiveness_denied 4 жыл бұрын
Thank you ! thanks kinda cool
@prettyprinted
@prettyprinted 4 жыл бұрын
Glad you liked it!
@gideonz74b
@gideonz74b Жыл бұрын
It's a great video, thanks! What would really help is to have a block diagram that shows what elements are used and how they talk to each other. It is hard to grasp like this (with as little background as I have), and because of that, it looks unnecessarily complex. In other words, the necessity for this complexity is not explained.
@DetectiveMichealScarn
@DetectiveMichealScarn Жыл бұрын
Which part is too complex specifically? if you mean the general reason why you would use this, in that case it's more for running things you know are going to take a lot of time, have many steps, some of which could fail, and more along these lines. Celery is something I would say most don't use. I am for example only using it for the first time in my 7 year Development Career because I need to create an Application for working with an AI, one which has a lot of steps, which I want to communicate to the user.
@cookdonald6222
@cookdonald6222 3 жыл бұрын
Cool video.Does celery support windows now?
@namangupta2587
@namangupta2587 4 жыл бұрын
Please make an app based on react and django
@rahulpatel4701
@rahulpatel4701 3 жыл бұрын
how to get redis url?
@syedkabir934
@syedkabir934 3 жыл бұрын
its important to add -------- 'DIRS': [os.path.join(BASE_DIR, 'templates')] in your settings.py
@pathakotasrikar1866
@pathakotasrikar1866 4 жыл бұрын
Hii, how to redirect to another page after progress bar shows success...
@mohamedmzoughi8234
@mohamedmzoughi8234 2 жыл бұрын
Is it Necessary to use redis broker ?
@stej2248
@stej2248 2 жыл бұрын
How to get this live response in react js?
@nextgodlevel4056
@nextgodlevel4056 2 ай бұрын
if want to send this progress over to a React project which is currently using REST API from django backend how I can achieve that ?
@123Freerunninginindi
@123Freerunninginindi 4 жыл бұрын
Please upload for flask as well.
@prettyprinted
@prettyprinted 4 жыл бұрын
I'll look into making one for Flask.
@123Freerunninginindi
@123Freerunninginindi 4 жыл бұрын
@@prettyprinted Thank you very much. :) You are awesome 👏
@satkarphuyal6802
@satkarphuyal6802 3 жыл бұрын
My code is working properly and the celery worker is also working properly but I don't see anything in django admin . What might be the problem?
@susanca8443
@susanca8443 9 ай бұрын
Why does the index page say 'done' while the progress is still building up? i.e. If it is already done, then what is the need for the progress bar.
@r4z74
@r4z74 4 жыл бұрын
Hi Anthony Can you please do a flask one?
@prettyprinted
@prettyprinted 4 жыл бұрын
I'll look into making a Flask version.
@lucsigier2375
@lucsigier2375 5 ай бұрын
If like me your task get send but never succed mind 'pip install eventlet' And launch celry with this following command line : celery -A progress worker --loglevel=info -P eventlet
@VsevoTV-ik9bw
@VsevoTV-ik9bw 3 жыл бұрын
Warninig. Redis url in app/nameapp/settings, Config Vars.
@pablomuniz9021
@pablomuniz9021 3 жыл бұрын
Hi, great video. I followed it and my async tasks are working when I run django locally (e.g. runserver), but it doesn’t work when deployed on Heroku. Redis receives the task requests, but they aren’t added to the Heroku postgres database (thus not displaying in the admin app). Any advice?
@andrehenriquemendes7270
@andrehenriquemendes7270 3 жыл бұрын
Same problem here
@andrehenriquemendes7270
@andrehenriquemendes7270 3 жыл бұрын
I figured out how to fix it. Compile Celery with "--pool=solo" argument. Example: celery -A progress worker -l info --pool=solo
@CryptoWizards
@CryptoWizards 3 жыл бұрын
@@andrehenriquemendes7270 Thanks man this helped!
@emilseyfullayev1638
@emilseyfullayev1638 3 жыл бұрын
Please, please help me, Why I receive this error? I installed ubuntu 20.04, I also connect to redis locally. May I have to change any my laptop configuration settings? [2021-04-11 19:58:44,253: ERROR/MainProcess] consumer: Cannot connect to redis://:**@ec2-54-217-183-159.eu-west-1.compute.amazonaws.com:22600//: Error while reading from socket: (104, 'Connection reset by peer'). Trying again in 26.00 seconds... (13/100)
@adityanjsg99
@adityanjsg99 5 ай бұрын
Not getting Task Results in Django Admin..! CAn some one help?
@lakshitukani468
@lakshitukani468 3 жыл бұрын
task is not getting reflected in database
@AllexRadu
@AllexRadu 3 жыл бұрын
I'm trying to conect to redis locally using : "CELERY_BROKER_URL = 'redis://127.0.0.1:6379/1' CELERY_ACCEPT_CONTENT = ['json'] CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_BACKEND = 'redis'" When I run celery i get: I'm getting an error "ModuleNotFoundError: No module named 'django_celery_results'" I have the module installed. Pip freeze reveals: amqp==5.0.2 asgiref==3.3.1 billiard==3.6.3.0 celery==5.0.4 certifi==2020.12.5 click==7.1.2 click-didyoumean==0.0.3 click-plugins==1.1.1 click-repl==0.1.6 Django==3.1.4 django-celery-results==2.0.0 kombu==5.0.2 prompt-toolkit==3.0.8 pytz==2020.4 redis==3.5.3 six==1.15.0 sqlparse==0.4.1 vine==5.0.0 wcwidth==0.2.5 Can you guys help?
@TheAnkur117
@TheAnkur117 4 жыл бұрын
Hey, Its not adding tasks to my database table in admin panel, hence rest of the things also not working, can I get the solution. I have followed all steps as it is
@TheAnkur117
@TheAnkur117 4 жыл бұрын
Celery results is always empty. I don't know whats lacking. can you please help
@andrehenriquemendes7270
@andrehenriquemendes7270 3 жыл бұрын
Same problema here. Did you fix it?
@andrehenriquemendes7270
@andrehenriquemendes7270 3 жыл бұрын
I figured out how to fix it. Compile Celery with "--pool=solo" argument. Example: celery -A progress worker -l info --pool=solo
@cselefendi
@cselefendi 3 жыл бұрын
@@andrehenriquemendes7270 Thanks! This worked for me.
@saadbutt6938
@saadbutt6938 Жыл бұрын
@@andrehenriquemendes7270 You are the GOAT man! Thank you!!
@BohdanDuCiel
@BohdanDuCiel 3 жыл бұрын
I still don’t get how you can implement this in a real project, it’s as if you need to know exactly how long your task is gonna run ( which in still manageable by putting a timeout) but the hardest part is knowing where to pinpoint the progress of the task, because nobody’s using sleep() in real applications, so how do you know where and when to update the progress? This would be just the same as showing a filling progress bar to the user with JavaScript while the page loads (in other words faking it) I genuinely want to know how to implement this for a real long running task because it seems unpractical.
@jamesmicker7863
@jamesmicker7863 3 жыл бұрын
I very much agree with you
@AnasLahrech
@AnasLahrech 2 жыл бұрын
You can set a timer from the beginning of your function and a timer at the end, then make the substraction and set your progress bar right after
@flaviusteodorof2601
@flaviusteodorof2601 2 жыл бұрын
for example i have an app where the user can input words, and it will run a function with each of those words. I update the progressbar once a word is done and the user can see 145/500words done
@BohdanDuCiel
@BohdanDuCiel 2 жыл бұрын
Now back to this after I have had more experience in software engineering 😅, this is an easy fix: just use a different thread. To get the runtime of the executed function I’d probably warp it in a decorator
@flaviusteodorof2601
@flaviusteodorof2601 2 жыл бұрын
@@BohdanDuCiel celery is useful because you can queue multiple tasks. This addon for progress is purely for informational purpose, since in my case the user can input an unlimited number of words, and it's designed for batches of 2-3k words, and each one can take up to 1-2 minutes, it's useful that they can close the browser and check once in a while to see of their session is complete. It's purely a UX thing:)
@evgenyocean426
@evgenyocean426 3 жыл бұрын
Unfortunately, the vast majority of youtube tutorials come down to "we do this, we do that, let's paste it here, let's install that". It's just sad. I want to know why we're doing this or that. Otherwise, it's totaly useless. The equevalent of this tutorial is a link to source code. No need for 20 minutes video.
@DouwedeJong
@DouwedeJong 4 жыл бұрын
celery looks very over engineered.
@down__lo7359
@down__lo7359 3 жыл бұрын
maybe in this example. But in a prod setting with any amount of traffic it is capable of handling large task queues.
Accepting Payments in Django Using Stripe Checkout
32:39
Pretty Printed
Рет қаралды 25 М.
Asynchronous Tasks in Python - Getting Started With Celery
9:07
Pretty Printed
Рет қаралды 143 М.
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 20 МЛН
LOVE LETTER - POPPY PLAYTIME CHAPTER 3 | GH'S ANIMATION
00:15
Progress Bars in Python Terminal
11:54
NeuralNine
Рет қаралды 101 М.
Sending Emails in Django With Celery
23:20
Pretty Printed
Рет қаралды 77 М.
Heroku Is Dead, Here's What I Recommend
11:59
Theo - t3․gg
Рет қаралды 251 М.
What's new in Django 5.0!
6:30
Djangonaut Views
Рет қаралды 14 М.
Async & Await in Python Simple & FAST HTTP Requests
9:37
John Watson Rooney
Рет қаралды 8 М.
Programming Is NOT Enough | Add these 7 skills…
13:19
Travis Media
Рет қаралды 414 М.
Go Pointers: When & How To Use Them Efficiently
14:09
Anthony GG
Рет қаралды 69 М.