Comments (6)
Thanks for this issue! I'll try and set out some time to look into it in the next few weeks.
from celery-progress.
I'm not sure it's a race condition. The initial state should be "PENDING" or "STARTED" even if set_progress() isn't called.
The error message indicates this is caused by an unknown state (in which case this is related to #54). It would be helpful to know what state caused the error. Do you have a way to check the task state when the error happens? If not, I made PR #82 to log unknown states and show them in the "Uh-Oh" message.
from celery-progress.
What I saw was that if I created a ProgressRecorder and didn't set_progress until later, I could see that state was occasionally coming back as null and then within a few seconds I'd see it going to PENDING state.. But by that time, I already had the "uh-oh" message.
As soon as I added a set_progress just below my creation of the ProgressRecorder, I haven't had the problem since.
progress_recorder = ProgressRecorder(self)
progress_recorder.set_progress(0, 1, description='Querying solutions...')
from celery-progress.
That's odd. I'm unable to reproduce the issue with this setup:
python 3.8, redis 5.0, packages:
- celery-progress==0.1.0
- celery==5.0.5
- Django==3.1.7
- redis==3.5.3
The task:
@shared_task(bind=True)
def http_task(self, number):
progress_recorder = ProgressRecorder(self)
for i in range(number):
time.sleep(.1)
return random()*1000
The view:
def http_view(request):
result = http_task.apply_async(kwargs={'number':15})
return render(request, 'http.html', context={'task_id': result.task_id})
Is your application similar? Any other notable thing that could be related (celery config, progress bar template)?
Also, where did you see that the state was null?
from celery-progress.
This doesn't happen often, and I just can't figure out how to reproduce it. But I added some console logs to hopefully give a little more info for you.
In celery_progress.js, in the function onData(), I'm falling into the case where data.complete === true and data.success === false. data.state does not equal RETRY, so I'm hitting the else onTaskError(). Even though the task did complete successfully.
{state: "PROGRESS", complete: true, success: false, progress: {…}, result: "Unknown state { <> }"
state: "PROGRESS"
success: false
data.progress looks like
{pending: false, current: 0, total: 100, percent: 0}
from celery-progress.
{state: "PROGRESS", complete: true, success: false, progress: {…}, result: "Unknown state { <> }"
Interesting. I'm not sure how this response was made, but I have a theory.
This response is produced when a state is unknown. See here.
But 'PROGRESS' is a known state, and there's an "else if" clause that produces a proper response for it:
The only thing I can think of is that the state (self.result.state) changed midway. It was 'PROGRESS' at first, then it changed to an unknown state. So self.result.state had different values in these two lines:
Is that possible? If it's, a fix would be to store the state once and use the stored value throughout the method instead of asking for it in each clause.
I'm also not sure what the unknown state is. It'll be logged and shown in the page if you use the unpublished version of celery-progress from github (by installing "git+https://github.com/czue/celery-progress@master#egg=celery-progress" or putting it in your requirements file).
from celery-progress.
Related Issues (20)
- Using master branch leads to Javascript TypeError HOT 1
- DOM only updating last element of the loop while diplaying progress HOT 2
- django.conf.urls.url() deprecated in Django 3+, removed in 4.0 HOT 3
- using websockets with channels_redis 4.0.0+ leads to RuntimeError("Event loop is closed") HOT 2
- NoReverseMatch at /status 'celery_progress' is not a registered namespace HOT 2
- celery Progress on file upload HOT 1
- Get the actual value when onProgress HOT 4
- Update two bars relatively to two workers HOT 6
- Maintenance and support for Django >= 3.1 HOT 3
- Introduce changelog HOT 3
- get_progress endpoint allows retrieval of arbitrary tasks HOT 7
- How would one use this progress bar when a task is wrapped in a Django transaction.on_commit? HOT 4
- Create Sdist HOT 9
- Handling a FileResponse HOT 3
- Config Mensages HOT 1
- 'celery_progress' is not a registered namespace
- ajax request using htmx HOT 1
- This could benefit from documantation for how to use it with chord or group based workflows. HOT 4
- Legacy install method will be deprecated soon HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from celery-progress.