-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot import name Task #11
Comments
Thanks for the bug, that must have shown up in one of the recent changes @toudi added. Can you provide the traceback you receive, so we know where the exception occurs? |
i suppose it can be connected with the egg package You provide. The current source code needs python-gearman v. 2.x bindings, whether Your egg package has 1.5.x dependencies. I was going to notify You about this but have totally forgotten :/ I also have absolutely no idea about how the egg packages on github work so i don't know how to fix it :( Please refer to the http://packages.python.org/gearman/1to2.html page for reference - Task class was present in gearman bindings v 1.x and was removed in 2.x. best regards, |
Oh, that's a different bug then. I will have to revert commit d00dec3 for now, then, because that allowed gearman > 1.5.0. If someone wants to fix the code so it is compatible with gearman 2.0, that's fine, I can accept that pull request then. |
ekhm, i believe it's quite opposite ;) The library now works with gearman api v. 2.x, not the 1.5.0. As i mentioned, the Task class was part of 1.x bindings :) |
Okay I went too fast then. I can put the |
@klepfish, please try the following commands:
and see if the problem persists. |
Hi everyone! Did this issue ever get resolved? I'm stuck here right now, can anybody suggest a solution? Thank you very much! |
@ekid125 can you do pip freeze | grep gearman on your virtualenv ? I just started from a fresh virtualenv, installed django-gearman package and it pulled gearman v.2 as a dependency. the Task class was part of gearman v1 client API which is not supported anymore. |
Hi Toudi! The Gearman Version that I'm using is 2.0.2. So I guess it will not work. I did however change the call to: client = GearmanClient() That seemed to help a bit, however when I start "python manage.py gearman_worker" i do get the message that no gearman jobs are found! I guess that's because of my "fix"? Thank you! |
well, the above code states that you have used the gearman client directly (without using django-gearman). Have you registered the jobs, as stated in the README ? (you have to create gearman_jobs.py inside your desired application) cheers, |
Hi @toudi! Yes I did create a File called gearman_jobs.py: import os from django_gearman.decorators import gearman_job @gearman_job As far as I understood decorating means registering the job as a worker, so gearman knows about it and uses that worker as soon as a job needs to be worked on. So, I'm probably mixing django_gearman and gearman. So it's brobably best to just stick to one. Since django_gearman doesn't seem to be working with gearman 2.0 and above, I will probably have to stick with gearman. Maybe you know an alternative? Thank you! |
no, those are two separate things. If you use 'just' gearman, then you won't have your django apps integrated. I just started a plain fresh project, installed everythiing and it seems that you must use decorator calling in order to register the job, like so:
rather than
As you progress with queues you will have to use the parenthesis anyways ;) cheers, |
Hey that worked :-) with "client.submit_job" instead of "client.do_task" it works like a charm! Thank you @toudi! |
Hi @toudi I do have a question about background jobs which is not related to this topic, do you mind if I write you a pm or skype? Thank you and best regards! |
When setting this up I get the error: cannot import name Task
The text was updated successfully, but these errors were encountered: