Comments (9)
@bkeifer I'll see if I can add something soon.
from jobtastic.
Hi Jacob,
Yup. The documentation on jquery-celery is pretty abysmal right now :(
Here's a todo-django project using Jobtastic and jquery-celery that did for a presentation. Hopefully it will help at least a little bit. site_base.html is where the djcelery
magic gets hooked in.
It's a pretty good example, since it uses progress and has error/success callbacks, but it's a bit more complex than the simplest example possible.
Would you be willing to take some quick notes on the things that tripped you up starting from that example? Maybe then I could adapt the code there as jquery-celery documentation and then specifically address the things that were confusing/surprising to you.
I'm sorry that I don't have better documentation here already. If you have questions, definitely ask them here and I'll try and respond quickly (at least for the next couple of hours, since I'm already writing documentation for other things anyway).
Thanks for asking the question!
-Wes
from jobtastic.
Thanks; looking at todo-django was enough to get me started.
The error/success callbacks are a big part of why I'm excited to work what you're doing with jobtastic and jquery-celery into some of my projects. I'll come back to this issue later in the week to try and capture my thoughts and do whatever I can to help improve documentation...out of time for today.
Thanks for the great work to date on both of these projects.
from jobtastic.
I know this is old, but I'd also like to see a sample HTML file. The AJAX part of this whole stack is my weakest point, and that's the one that's not in the docs. =)
from jobtastic.
@bkeifer: I'd love if you took a look at the updated README on this branch with the sample file included.
Ask me follow-up questions here if you're still stuck, and we can iterate on the file/instructions until you're up and running.
Hopefully that way we can end up with a good PR to the README that assumes nothing but gets other new users to the project up and running/
from jobtastic.
Progress! I'm slowly working through this and getting close.
First thing I found is an extra semicolon on the closing } for on_other (line 39).
The task is started and completes successfully (verified via flower), but I'm getting the "Something went horribly wrong" message on the web page.
My console shows the following URL throwing a 404:
http://localhost:8080/task/f231d5df-fbc6-45b6-acf1-625f4a669134/status/?_=1462994476693
This makes sense, since I don't have anything at /task/ (that I know of, at least...). Where is that URL handled? Is that a part of the Celery setup I missed? If it matters, this is in a Django app.
EDIT: I'm getting there. I think I've almost gotten my view for /task/ working. I'll be happy to provide a copy for the readme once it's working.
from jobtastic.
So here's what I've got for my /task view. It's not pretty, but it works. Does this jive with what you'd expect to see from the method handling that call?
def task(request, task_id):
data = 'Fail'
task = AsyncResult(task_id)
# Task is still in progress
if type(task.result) is dict:
data = {'task': {'result': {}}}
data['task']['id'] = task_id
data['task']['status'] = task.state
data['task']['result']['progress_percent'] = task.result['progress_percent']
# Task has finished.
elif type(task.result) is list:
data = {'task': {}}
data['task'] = {
'status': task.state,
'id': task_id,
'progress_percent' : 100,
}
return HttpResponse(json.dumps(data), content_type='application/json')
from jobtastic.
@bkeifer: You're on the right track.
Celery includes a task status view that you can wire up in the urls.py
for your project. It corresponds to the path defined in jquery-celery:
from djcelery.views import task_status
urlpatterns = [
url(r'^admin/', admin.site.urls),
...
url(r'^task/(?P<task_id>[\w\d\-\.]+)/status/', task_status),
]
from jobtastic.
That was the missing piece. Thank you!
from jobtastic.
Related Issues (20)
- Add option to skip herd avoidance check, but still trigger avoidance for other tasks HOT 19
- compatibility with Celery 4.0? HOT 3
- Project configuration HOT 4
- celery.conf deprecated HOT 2
- License mismatch HOT 1
- Python core dump or memcached/redis I/O error can cause other-process `apply_async` to loop for `thundering_herd_timeout` HOT 4
- Add option to retry a task later if the task is already running HOT 1
- Add ability to ensure only 1 version of a task is running at a time, but still actually run subsequent jobs: Simultaneous Execution Prevention HOT 3
- Add support for Celery >= 4.0 HOT 11
- How do you handle POST -> REDIRECT -> GET sequence to pass task_id? HOT 2
- groups or subtask HOT 1
- old requirements of psutil clashes
- Herd Avoidance and Task Retry HOT 1
- Jobtastic tasks waits even CELERY_TASK_ALWAYS_EAGER is True
- Magic value (-1) for cache TTL is not compatible with cachelib RedisCache.
- Expose method to extend lock timeout HOT 1
- jquery-celery is dead ...
- Caching task even though cache_duration = -1 HOT 7
- cache locking allows bypassing herd avoidance
- Support for celery 5.0
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 jobtastic.