Celery Received unregistered task of type (run example)
I'm trying to run example from Celery documentation.
I run: celeryd --loglevel=INFO
/usr/local/lib/python2.7/dist-packages/celery/loaders/default.py:64: NotConfigured: No 'celeryconfig' module found! Please make sure it exists and is available to Python.
"is available to Python." % (configname, )))
[2012-03-19 04:26:34,899: WARNING/MainProcess]
-------------- celery@ubuntu v2.5.1
---- **** -----
--- * *** * -- [Configuration]
-- * - **** --- . broker: amqp://guest@localhost:5672//
- ** ---------- . loader: celery.loaders.default.Loader
- ** ---------- . logfile: [stderr]@INFO
- ** ---------- . concurrency: 4
- ** ---------- . events: OFF
- *** --- * --- . beat: OFF
-- ******* ----
--- ***** ----- [Queues]
-------------- . celery: exchange:celery (direct) binding:celery
tasks.py:
# -*- coding: utf-8 -*-
from celery.task import task
@task
def add(x, y):
return x + y
run_task.py:
# -*- coding: utf-8 -*-
from tasks import add
result = add.delay(4, 4)
print (result)
print (result.ready())
print (result.get())
In same folder celeryconfig.py:
CELERY_IMPORTS = ("tasks", )
CELERY_RESULT_BACKEND = "amqp"
BROKER_URL = "amqp://guest:guest@localhost:5672//"
CELERY_TASK_RESULT_EXPIRES = 300
When I run "run_task.py":
on python console
eb503f77-b5fc-44e2-ac0b-91ce6ddbf153
False
errors on celeryd server
[2012-03-19 04:34:14,913: ERROR/MainProcess] Received unregistered task of type 'tasks.add'.
The message has been ignored and discarded.
Did you remember to import the module containing this task?
Or maybe you are using relative imports?
Please see http://bit.ly/gLye1c for more information.
The full contents of the message body was:
{'retries': 0, 'task': 'tasks.add', 'utc': False, 'args': (4, 4), 'expires': None, 'eta': None, 'kwargs': {}, 'id': '841bc21f-8124-436b-92f1-e3b62cafdfe7'}
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer.py", line 444, in receive_message
self.strategies[name](message, body, message.ack_log_error)
KeyError: 'tasks.add'
Please explain what's the problem.
python celery
add a comment |
I'm trying to run example from Celery documentation.
I run: celeryd --loglevel=INFO
/usr/local/lib/python2.7/dist-packages/celery/loaders/default.py:64: NotConfigured: No 'celeryconfig' module found! Please make sure it exists and is available to Python.
"is available to Python." % (configname, )))
[2012-03-19 04:26:34,899: WARNING/MainProcess]
-------------- celery@ubuntu v2.5.1
---- **** -----
--- * *** * -- [Configuration]
-- * - **** --- . broker: amqp://guest@localhost:5672//
- ** ---------- . loader: celery.loaders.default.Loader
- ** ---------- . logfile: [stderr]@INFO
- ** ---------- . concurrency: 4
- ** ---------- . events: OFF
- *** --- * --- . beat: OFF
-- ******* ----
--- ***** ----- [Queues]
-------------- . celery: exchange:celery (direct) binding:celery
tasks.py:
# -*- coding: utf-8 -*-
from celery.task import task
@task
def add(x, y):
return x + y
run_task.py:
# -*- coding: utf-8 -*-
from tasks import add
result = add.delay(4, 4)
print (result)
print (result.ready())
print (result.get())
In same folder celeryconfig.py:
CELERY_IMPORTS = ("tasks", )
CELERY_RESULT_BACKEND = "amqp"
BROKER_URL = "amqp://guest:guest@localhost:5672//"
CELERY_TASK_RESULT_EXPIRES = 300
When I run "run_task.py":
on python console
eb503f77-b5fc-44e2-ac0b-91ce6ddbf153
False
errors on celeryd server
[2012-03-19 04:34:14,913: ERROR/MainProcess] Received unregistered task of type 'tasks.add'.
The message has been ignored and discarded.
Did you remember to import the module containing this task?
Or maybe you are using relative imports?
Please see http://bit.ly/gLye1c for more information.
The full contents of the message body was:
{'retries': 0, 'task': 'tasks.add', 'utc': False, 'args': (4, 4), 'expires': None, 'eta': None, 'kwargs': {}, 'id': '841bc21f-8124-436b-92f1-e3b62cafdfe7'}
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer.py", line 444, in receive_message
self.strategies[name](message, body, message.ack_log_error)
KeyError: 'tasks.add'
Please explain what's the problem.
python celery
11
Hi, could you please share what the problem was and how you resolved? The accepted answer doesn't make it clear how others could solve this problem. Thanks.
– Jordan Reiter
Apr 17 '12 at 22:30
2
I'm with Jordan- this was not useful at all. Downvoted.
– Jay Taylor
Aug 24 '12 at 1:06
2
the answer of aiho is the correct one:CELERY_IMPORTS = ("tasks", )
– Alp
Nov 8 '14 at 19:35
add a comment |
I'm trying to run example from Celery documentation.
I run: celeryd --loglevel=INFO
/usr/local/lib/python2.7/dist-packages/celery/loaders/default.py:64: NotConfigured: No 'celeryconfig' module found! Please make sure it exists and is available to Python.
"is available to Python." % (configname, )))
[2012-03-19 04:26:34,899: WARNING/MainProcess]
-------------- celery@ubuntu v2.5.1
---- **** -----
--- * *** * -- [Configuration]
-- * - **** --- . broker: amqp://guest@localhost:5672//
- ** ---------- . loader: celery.loaders.default.Loader
- ** ---------- . logfile: [stderr]@INFO
- ** ---------- . concurrency: 4
- ** ---------- . events: OFF
- *** --- * --- . beat: OFF
-- ******* ----
--- ***** ----- [Queues]
-------------- . celery: exchange:celery (direct) binding:celery
tasks.py:
# -*- coding: utf-8 -*-
from celery.task import task
@task
def add(x, y):
return x + y
run_task.py:
# -*- coding: utf-8 -*-
from tasks import add
result = add.delay(4, 4)
print (result)
print (result.ready())
print (result.get())
In same folder celeryconfig.py:
CELERY_IMPORTS = ("tasks", )
CELERY_RESULT_BACKEND = "amqp"
BROKER_URL = "amqp://guest:guest@localhost:5672//"
CELERY_TASK_RESULT_EXPIRES = 300
When I run "run_task.py":
on python console
eb503f77-b5fc-44e2-ac0b-91ce6ddbf153
False
errors on celeryd server
[2012-03-19 04:34:14,913: ERROR/MainProcess] Received unregistered task of type 'tasks.add'.
The message has been ignored and discarded.
Did you remember to import the module containing this task?
Or maybe you are using relative imports?
Please see http://bit.ly/gLye1c for more information.
The full contents of the message body was:
{'retries': 0, 'task': 'tasks.add', 'utc': False, 'args': (4, 4), 'expires': None, 'eta': None, 'kwargs': {}, 'id': '841bc21f-8124-436b-92f1-e3b62cafdfe7'}
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer.py", line 444, in receive_message
self.strategies[name](message, body, message.ack_log_error)
KeyError: 'tasks.add'
Please explain what's the problem.
python celery
I'm trying to run example from Celery documentation.
I run: celeryd --loglevel=INFO
/usr/local/lib/python2.7/dist-packages/celery/loaders/default.py:64: NotConfigured: No 'celeryconfig' module found! Please make sure it exists and is available to Python.
"is available to Python." % (configname, )))
[2012-03-19 04:26:34,899: WARNING/MainProcess]
-------------- celery@ubuntu v2.5.1
---- **** -----
--- * *** * -- [Configuration]
-- * - **** --- . broker: amqp://guest@localhost:5672//
- ** ---------- . loader: celery.loaders.default.Loader
- ** ---------- . logfile: [stderr]@INFO
- ** ---------- . concurrency: 4
- ** ---------- . events: OFF
- *** --- * --- . beat: OFF
-- ******* ----
--- ***** ----- [Queues]
-------------- . celery: exchange:celery (direct) binding:celery
tasks.py:
# -*- coding: utf-8 -*-
from celery.task import task
@task
def add(x, y):
return x + y
run_task.py:
# -*- coding: utf-8 -*-
from tasks import add
result = add.delay(4, 4)
print (result)
print (result.ready())
print (result.get())
In same folder celeryconfig.py:
CELERY_IMPORTS = ("tasks", )
CELERY_RESULT_BACKEND = "amqp"
BROKER_URL = "amqp://guest:guest@localhost:5672//"
CELERY_TASK_RESULT_EXPIRES = 300
When I run "run_task.py":
on python console
eb503f77-b5fc-44e2-ac0b-91ce6ddbf153
False
errors on celeryd server
[2012-03-19 04:34:14,913: ERROR/MainProcess] Received unregistered task of type 'tasks.add'.
The message has been ignored and discarded.
Did you remember to import the module containing this task?
Or maybe you are using relative imports?
Please see http://bit.ly/gLye1c for more information.
The full contents of the message body was:
{'retries': 0, 'task': 'tasks.add', 'utc': False, 'args': (4, 4), 'expires': None, 'eta': None, 'kwargs': {}, 'id': '841bc21f-8124-436b-92f1-e3b62cafdfe7'}
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer.py", line 444, in receive_message
self.strategies[name](message, body, message.ack_log_error)
KeyError: 'tasks.add'
Please explain what's the problem.
python celery
python celery
edited Jun 27 '12 at 11:00
culebrón
14k135686
14k135686
asked Mar 19 '12 at 11:40
EchegEcheg
83011124
83011124
11
Hi, could you please share what the problem was and how you resolved? The accepted answer doesn't make it clear how others could solve this problem. Thanks.
– Jordan Reiter
Apr 17 '12 at 22:30
2
I'm with Jordan- this was not useful at all. Downvoted.
– Jay Taylor
Aug 24 '12 at 1:06
2
the answer of aiho is the correct one:CELERY_IMPORTS = ("tasks", )
– Alp
Nov 8 '14 at 19:35
add a comment |
11
Hi, could you please share what the problem was and how you resolved? The accepted answer doesn't make it clear how others could solve this problem. Thanks.
– Jordan Reiter
Apr 17 '12 at 22:30
2
I'm with Jordan- this was not useful at all. Downvoted.
– Jay Taylor
Aug 24 '12 at 1:06
2
the answer of aiho is the correct one:CELERY_IMPORTS = ("tasks", )
– Alp
Nov 8 '14 at 19:35
11
11
Hi, could you please share what the problem was and how you resolved? The accepted answer doesn't make it clear how others could solve this problem. Thanks.
– Jordan Reiter
Apr 17 '12 at 22:30
Hi, could you please share what the problem was and how you resolved? The accepted answer doesn't make it clear how others could solve this problem. Thanks.
– Jordan Reiter
Apr 17 '12 at 22:30
2
2
I'm with Jordan- this was not useful at all. Downvoted.
– Jay Taylor
Aug 24 '12 at 1:06
I'm with Jordan- this was not useful at all. Downvoted.
– Jay Taylor
Aug 24 '12 at 1:06
2
2
the answer of aiho is the correct one:
CELERY_IMPORTS = ("tasks", )– Alp
Nov 8 '14 at 19:35
the answer of aiho is the correct one:
CELERY_IMPORTS = ("tasks", )– Alp
Nov 8 '14 at 19:35
add a comment |
24 Answers
24
active
oldest
votes
You can see the current list of registered tasks in the celery.registry.TaskRegistry class. Could be that your celeryconfig (in the current directory) is not in PYTHONPATH so celery can't find it and falls back to defaults. Simply specify it explicitly when starting celery.
celeryd --loglevel=INFO --settings=celeryconfig
You can also set --loglevel=DEBUG and you should probably see the problem immediately.
3
+1 for--loglevel=DEBUG, there was a syntax error in my task.
– Jacob Valenta
Dec 11 '13 at 19:51
5
celeryd is obsolete. Now one should runcelery workere.g forDjangolike thiscelery --app=your_app.celery worker --loglevel=info
– andilabs
Jan 14 '16 at 11:25
For me (celery 3.1.23), I had to usecelery.registry.tasksto see a list of all of my current tasks. You can always check by runningdir(celery.registry).
– Nick Brady
Sep 30 '16 at 18:21
for--loglevel=DEBUGfrom my side as well
– Shobi
Aug 21 '18 at 21:11
add a comment |
I had the same problem:
The reason of "Received unregistered task of type.." was that celeryd service didn't find and register the tasks on service start (btw their list is visible when you start
./manage.py celeryd --loglevel=info ).
These tasks should be declared in CELERY_IMPORTS = ("tasks", ) in settings file.
If you have a special celery_settings.py file it has to be declared on celeryd service start as --settings=celery_settings.py as digivampire wrote.
1
Thanks, I actually had the issue because I started celery using ~/path/to/celery/celeryd instead of using the manage.py command!
– Antoine
Feb 17 '14 at 10:22
+1 This was hard to find
– cevaris
Apr 26 '14 at 13:39
add a comment |
I think you need to restart the worker server. I meet the same problem and solve it by restarting.
5
Thanks! Wish I found this an hour ago
– Nexus
Jun 24 '12 at 4:57
2
This fixed it for me. If you're using celeryd scripts, the worker imports your task module(s) at startup. Even if you then create more task functions or alter existing ones, the worker will be using its in-memory copies as they were when it read them.
– Mark
Jul 23 '13 at 8:19
1
Note: you can verify that your tasks is or is not registered by runningcelery inspect registered
– Nick Brady
Mar 8 '16 at 18:52
1
You also can start celery with option--autoreloadwhich will restart celery each time code was changed.
– Sergey
Aug 2 '16 at 15:09
add a comment |
Whether you use CELERY_IMPORTS or autodiscover_tasks, the important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch.
When you launch the Celery, say celery worker -A project --loglevel=DEBUG, you should see the name of the tasks. For example, if I have a debug_task task in my celery.py.
[tasks]
. project.celery.debug_task
. celery.backend_cleanup
. celery.chain
. celery.chord
. celery.chord_unlock
. celery.chunks
. celery.group
. celery.map
. celery.starmap
If you can't see your tasks in the list, please check your celery configuration imports the tasks correctly, either in --setting, --config, celeryconfig or config_from_object.
If you are using celery beat, make sure the task name, task, you use in CELERYBEAT_SCHEDULE matches the name in the celery task list.
This was very helpful. The name of the task needs to match the the 'task' key in your CELERYBEAT_SCHEDULE
– ss_millionaire
Dec 2 '18 at 1:23
*The important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch. * Good point!!!
– Light.G
2 days ago
add a comment |
I also had the same problem; I added
CELERY_IMPORTS=("mytasks")
in my celeryconfig.py file to solve it.
5
Note that this should be a list or a tuple:CELERY_IMPORTS = ['my_module']
– asksol
Nov 10 '13 at 20:50
add a comment |
For me this error was solved by ensuring the app containing the tasks was included under django's INSTALLED_APPS setting.
Also, the tasks needed to be accessible from <app>/tasks.py
– np8
Oct 23 '17 at 7:11
add a comment |
Using --settings did not work for me. I had to use the following to get it all to work:
celery --config=celeryconfig --loglevel=INFO
Here is the celeryconfig file that has the CELERY_IMPORTS added:
# Celery configuration file
BROKER_URL = 'amqp://'
CELERY_RESULT_BACKEND = 'amqp://'
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'America/Los_Angeles'
CELERY_ENABLE_UTC = True
CELERY_IMPORTS = ("tasks",)
My setup was a little bit more tricky because I'm using supervisor to launch celery as a daemon.
add a comment |
app = Celery('proj',
broker='amqp://',
backend='amqp://',
include=['proj.tasks'])
please include=['proj.tasks']
You need go to the top dir, then exec this
celery -A app.celery_module.celeryapp worker --loglevel=info
not
celery -A celeryapp worker --loglevel=info
in your celeryconfig.py input imports = ("path.ptah.tasks",)
please in other module invoke task!!!!!!!!
Theincludeparam need to be add if you're using relative imports. I've solved my issue by adding it
– CK.Nguyen
Sep 28 '18 at 11:32
Voted your answer for this stringplease in other module invoke task!!!!!!!!. It helped.
– VolArt
Jan 14 at 10:47
add a comment |
I had this problem mysteriously crop up when I added some signal handling to my django app. In doing so I converted the app to use an AppConfig, meaning that instead of simply reading as 'booking' in INSTALLED_APPS, it read 'booking.app.BookingConfig'.
Celery doesn't understand what that means, so I added, INSTALLED_APPS_WITH_APPCONFIGS = ('booking',) to my django settings, and modified my celery.py from
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
to
app.autodiscover_tasks(
lambda: settings.INSTALLED_APPS + settings.INSTALLED_APPS_WITH_APPCONFIGS
)
add a comment |
I had the same problem running tasks from Celery Beat. Celery doesn't like relative imports so in my celeryconfig.py, I had to explicitly set the full package name:
app.conf.beat_schedule = {
'add-every-30-seconds': {
'task': 'full.path.to.add',
'schedule': 30.0,
'args': (16, 16)
},
}
I wish the celery docs had more examples with full package names. After seeing full.path.to.add in this answer, I found out I did not need the imports. I knew the solution was simple, and just needed to have a better example of the app.conf.beat_schedule.
– zerocog
Aug 11 '17 at 17:26
add a comment |
I did not have any issue with Django. But encountered this when I was using Flask. The solution was setting the config option.
celery worker -A app.celery --loglevel=DEBUG --config=settings
while with Django, I just had:
python manage.py celery worker -c 2 --loglevel=info
add a comment |
What worked for me, was to add explicit name to celery task decorator. I changed my task declaration from @app.tasks to @app.tasks(name='module.submodule.task')
Here is an example
# test_task.py
@celery.task
def test_task():
print("Celery Task !!!!")
# test_task.py
@celery.task(name='tasks.test.test_task')
def test_task():
print("Celery Task !!!!")
add a comment |
This, strangely, can also be because of a missing package. Run pip to install all necessary packages:
pip install -r requirements.txt
autodiscover_tasks wasn't picking up tasks that used missing packages.
I had a similar issue. I think what happens is an exception during import causes parts of the auto-discovery to not complete.
– Tim Tisdall
Dec 19 '18 at 14:42
Ahh yeah, makes sense. Thanks
– kakoma
Dec 20 '18 at 10:33
add a comment |
I encountered this problem as well, but it is not quite the same, so just FYI. Recent upgrades causes this error message due to this decorator syntax.
ERROR/MainProcess] Received unregistered task of type 'my_server_check'.
@task('my_server_check')
Had to be change to just
@task()
No clue why.
add a comment |
If you are running into this kind of error, there are a number of possible causes but the solution I found was that my celeryd config file in /etc/defaults/celeryd was configured for standard use, not for my specific django project. As soon as I converted it to the format specified in the celery docs, all was well.
add a comment |
The solution for me to add this line to /etc/default/celeryd
CELERYD_OPTS="-A tasks"
Because when I run these commands:
celery worker --loglevel=INFO
celery worker -A tasks --loglevel=INFO
Only the latter command was showing task names at all.
I have also tried adding CELERY_APP line /etc/default/celeryd but that didn't worked either.
CELERY_APP="tasks"
add a comment |
I had the issue with PeriodicTask classes in django-celery, while their names showed up fine when starting the celery worker every execution triggered:
KeyError: u'my_app.tasks.run'
My task was a class named 'CleanUp', not just a method called 'run'.
When I checked table 'djcelery_periodictask' I saw outdated entries and deleting them fixed the issue.
add a comment |
Just to add my two cents for my case with this error...
My path is /vagrant/devops/test with app.py and __init__.py in it.
When I run cd /vagrant/devops/ && celery worker -A test.app.celery --loglevel=info I am getting this error.
But when I run it like cd /vagrant/devops/test && celery worker -A app.celery --loglevel=info everything is OK.
add a comment |
I've found that one of our programmers added the following line to one of the imports:
os.chdir(<path_to_a_local_folder>)
This caused the Celery worker to change its working directory from the projects' default working directory (where it could find the tasks) to a different directory (where it couldn't find the tasks).
After removing this line of code, all tasks were found and registered.
add a comment |
Celery doesn't support relative imports so in my celeryconfig.py, you need absolute import.
CELERYBEAT_SCHEDULE = {
'add_num': {
'task': 'app.tasks.add_num.add_nums',
'schedule': timedelta(seconds=10),
'args': (1, 2)
}
}
add a comment |
An additional item to a really useful list.
I have found Celery unforgiving in relation to errors in tasks (or at least I haven't been able to trace the appropriate log entries) and it doesn't register them. I have had a number of issues with running Celery as a service, which have been predominantly permissions related.
The latest related to permissions writing to a log file. I had no issues in development or running celery at the command line, but the service reported the task as unregistered.
I needed to change the log folder permissions to enable the service to write to it.
add a comment |
My 2 cents
I was getting this in a docker image using alpine. The django settings referenced /dev/log for logging to syslog. The django app and celery worker were both based on the same image. The entrypoint of the django app image was launching syslogd on start, but the one for the celery worker was not. This was causing things like ./manage.py shell to fail because there wouldn't be any /dev/log. The celery worker was not failing. Instead, it was silently just ignoring the rest of the app launch, which included loading shared_task entries from applications in the django project
add a comment |
In my case the error was because one container created files in a folder that were mounted on the host file-system with docker-compose.
I just had to do remove the files created by the container on the host system and I was able to launch my project again.
sudo rm -Rf foldername
(I had to use sudo because the files were owned by the root user)
Docker version: 18.03.1
add a comment |
If you use autodiscover_tasks, make sure that your functions to be registered stay in the tasks.py, not any other file. Or celery can not find the functions you want to register.
Use app.register_task will also do the job, but seems a little naive.
Please refer to this official specification of autodiscover_tasks.
def autodiscover_tasks(self, packages=None, related_name='tasks', force=False):
"""Auto-discover task modules.
Searches a list of packages for a "tasks.py" module (or use
related_name argument).
If the name is empty, this will be delegated to fix-ups (e.g., Django).
For example if you have a directory layout like this:
.. code-block:: text
foo/__init__.py
tasks.py
models.py
bar/__init__.py
tasks.py
models.py
baz/__init__.py
models.py
Then calling ``app.autodiscover_tasks(['foo', bar', 'baz'])`` will
result in the modules ``foo.tasks`` and ``bar.tasks`` being imported.
Arguments:
packages (List[str]): List of packages to search.
This argument may also be a callable, in which case the
value returned is used (for lazy evaluation).
related_name (str): The name of the module to find. Defaults
to "tasks": meaning "look for 'module.tasks' for every
module in ``packages``."
force (bool): By default this call is lazy so that the actual
auto-discovery won't happen until an application imports
the default modules. Forcing will cause the auto-discovery
to happen immediately.
"""
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9769496%2fcelery-received-unregistered-task-of-type-run-example%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
24 Answers
24
active
oldest
votes
24 Answers
24
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can see the current list of registered tasks in the celery.registry.TaskRegistry class. Could be that your celeryconfig (in the current directory) is not in PYTHONPATH so celery can't find it and falls back to defaults. Simply specify it explicitly when starting celery.
celeryd --loglevel=INFO --settings=celeryconfig
You can also set --loglevel=DEBUG and you should probably see the problem immediately.
3
+1 for--loglevel=DEBUG, there was a syntax error in my task.
– Jacob Valenta
Dec 11 '13 at 19:51
5
celeryd is obsolete. Now one should runcelery workere.g forDjangolike thiscelery --app=your_app.celery worker --loglevel=info
– andilabs
Jan 14 '16 at 11:25
For me (celery 3.1.23), I had to usecelery.registry.tasksto see a list of all of my current tasks. You can always check by runningdir(celery.registry).
– Nick Brady
Sep 30 '16 at 18:21
for--loglevel=DEBUGfrom my side as well
– Shobi
Aug 21 '18 at 21:11
add a comment |
You can see the current list of registered tasks in the celery.registry.TaskRegistry class. Could be that your celeryconfig (in the current directory) is not in PYTHONPATH so celery can't find it and falls back to defaults. Simply specify it explicitly when starting celery.
celeryd --loglevel=INFO --settings=celeryconfig
You can also set --loglevel=DEBUG and you should probably see the problem immediately.
3
+1 for--loglevel=DEBUG, there was a syntax error in my task.
– Jacob Valenta
Dec 11 '13 at 19:51
5
celeryd is obsolete. Now one should runcelery workere.g forDjangolike thiscelery --app=your_app.celery worker --loglevel=info
– andilabs
Jan 14 '16 at 11:25
For me (celery 3.1.23), I had to usecelery.registry.tasksto see a list of all of my current tasks. You can always check by runningdir(celery.registry).
– Nick Brady
Sep 30 '16 at 18:21
for--loglevel=DEBUGfrom my side as well
– Shobi
Aug 21 '18 at 21:11
add a comment |
You can see the current list of registered tasks in the celery.registry.TaskRegistry class. Could be that your celeryconfig (in the current directory) is not in PYTHONPATH so celery can't find it and falls back to defaults. Simply specify it explicitly when starting celery.
celeryd --loglevel=INFO --settings=celeryconfig
You can also set --loglevel=DEBUG and you should probably see the problem immediately.
You can see the current list of registered tasks in the celery.registry.TaskRegistry class. Could be that your celeryconfig (in the current directory) is not in PYTHONPATH so celery can't find it and falls back to defaults. Simply specify it explicitly when starting celery.
celeryd --loglevel=INFO --settings=celeryconfig
You can also set --loglevel=DEBUG and you should probably see the problem immediately.
answered Mar 19 '12 at 11:55
astevanovicastevanovic
3,9932123
3,9932123
3
+1 for--loglevel=DEBUG, there was a syntax error in my task.
– Jacob Valenta
Dec 11 '13 at 19:51
5
celeryd is obsolete. Now one should runcelery workere.g forDjangolike thiscelery --app=your_app.celery worker --loglevel=info
– andilabs
Jan 14 '16 at 11:25
For me (celery 3.1.23), I had to usecelery.registry.tasksto see a list of all of my current tasks. You can always check by runningdir(celery.registry).
– Nick Brady
Sep 30 '16 at 18:21
for--loglevel=DEBUGfrom my side as well
– Shobi
Aug 21 '18 at 21:11
add a comment |
3
+1 for--loglevel=DEBUG, there was a syntax error in my task.
– Jacob Valenta
Dec 11 '13 at 19:51
5
celeryd is obsolete. Now one should runcelery workere.g forDjangolike thiscelery --app=your_app.celery worker --loglevel=info
– andilabs
Jan 14 '16 at 11:25
For me (celery 3.1.23), I had to usecelery.registry.tasksto see a list of all of my current tasks. You can always check by runningdir(celery.registry).
– Nick Brady
Sep 30 '16 at 18:21
for--loglevel=DEBUGfrom my side as well
– Shobi
Aug 21 '18 at 21:11
3
3
+1 for
--loglevel=DEBUG, there was a syntax error in my task.– Jacob Valenta
Dec 11 '13 at 19:51
+1 for
--loglevel=DEBUG, there was a syntax error in my task.– Jacob Valenta
Dec 11 '13 at 19:51
5
5
celeryd is obsolete. Now one should run
celery worker e.g for Django like this celery --app=your_app.celery worker --loglevel=info– andilabs
Jan 14 '16 at 11:25
celeryd is obsolete. Now one should run
celery worker e.g for Django like this celery --app=your_app.celery worker --loglevel=info– andilabs
Jan 14 '16 at 11:25
For me (celery 3.1.23), I had to use
celery.registry.tasks to see a list of all of my current tasks. You can always check by running dir(celery.registry).– Nick Brady
Sep 30 '16 at 18:21
For me (celery 3.1.23), I had to use
celery.registry.tasks to see a list of all of my current tasks. You can always check by running dir(celery.registry).– Nick Brady
Sep 30 '16 at 18:21
for
--loglevel=DEBUG from my side as well– Shobi
Aug 21 '18 at 21:11
for
--loglevel=DEBUG from my side as well– Shobi
Aug 21 '18 at 21:11
add a comment |
I had the same problem:
The reason of "Received unregistered task of type.." was that celeryd service didn't find and register the tasks on service start (btw their list is visible when you start
./manage.py celeryd --loglevel=info ).
These tasks should be declared in CELERY_IMPORTS = ("tasks", ) in settings file.
If you have a special celery_settings.py file it has to be declared on celeryd service start as --settings=celery_settings.py as digivampire wrote.
1
Thanks, I actually had the issue because I started celery using ~/path/to/celery/celeryd instead of using the manage.py command!
– Antoine
Feb 17 '14 at 10:22
+1 This was hard to find
– cevaris
Apr 26 '14 at 13:39
add a comment |
I had the same problem:
The reason of "Received unregistered task of type.." was that celeryd service didn't find and register the tasks on service start (btw their list is visible when you start
./manage.py celeryd --loglevel=info ).
These tasks should be declared in CELERY_IMPORTS = ("tasks", ) in settings file.
If you have a special celery_settings.py file it has to be declared on celeryd service start as --settings=celery_settings.py as digivampire wrote.
1
Thanks, I actually had the issue because I started celery using ~/path/to/celery/celeryd instead of using the manage.py command!
– Antoine
Feb 17 '14 at 10:22
+1 This was hard to find
– cevaris
Apr 26 '14 at 13:39
add a comment |
I had the same problem:
The reason of "Received unregistered task of type.." was that celeryd service didn't find and register the tasks on service start (btw their list is visible when you start
./manage.py celeryd --loglevel=info ).
These tasks should be declared in CELERY_IMPORTS = ("tasks", ) in settings file.
If you have a special celery_settings.py file it has to be declared on celeryd service start as --settings=celery_settings.py as digivampire wrote.
I had the same problem:
The reason of "Received unregistered task of type.." was that celeryd service didn't find and register the tasks on service start (btw their list is visible when you start
./manage.py celeryd --loglevel=info ).
These tasks should be declared in CELERY_IMPORTS = ("tasks", ) in settings file.
If you have a special celery_settings.py file it has to be declared on celeryd service start as --settings=celery_settings.py as digivampire wrote.
edited May 18 '16 at 15:31
Community♦
11
11
answered Jul 2 '12 at 14:33
aihoaiho
887912
887912
1
Thanks, I actually had the issue because I started celery using ~/path/to/celery/celeryd instead of using the manage.py command!
– Antoine
Feb 17 '14 at 10:22
+1 This was hard to find
– cevaris
Apr 26 '14 at 13:39
add a comment |
1
Thanks, I actually had the issue because I started celery using ~/path/to/celery/celeryd instead of using the manage.py command!
– Antoine
Feb 17 '14 at 10:22
+1 This was hard to find
– cevaris
Apr 26 '14 at 13:39
1
1
Thanks, I actually had the issue because I started celery using ~/path/to/celery/celeryd instead of using the manage.py command!
– Antoine
Feb 17 '14 at 10:22
Thanks, I actually had the issue because I started celery using ~/path/to/celery/celeryd instead of using the manage.py command!
– Antoine
Feb 17 '14 at 10:22
+1 This was hard to find
– cevaris
Apr 26 '14 at 13:39
+1 This was hard to find
– cevaris
Apr 26 '14 at 13:39
add a comment |
I think you need to restart the worker server. I meet the same problem and solve it by restarting.
5
Thanks! Wish I found this an hour ago
– Nexus
Jun 24 '12 at 4:57
2
This fixed it for me. If you're using celeryd scripts, the worker imports your task module(s) at startup. Even if you then create more task functions or alter existing ones, the worker will be using its in-memory copies as they were when it read them.
– Mark
Jul 23 '13 at 8:19
1
Note: you can verify that your tasks is or is not registered by runningcelery inspect registered
– Nick Brady
Mar 8 '16 at 18:52
1
You also can start celery with option--autoreloadwhich will restart celery each time code was changed.
– Sergey
Aug 2 '16 at 15:09
add a comment |
I think you need to restart the worker server. I meet the same problem and solve it by restarting.
5
Thanks! Wish I found this an hour ago
– Nexus
Jun 24 '12 at 4:57
2
This fixed it for me. If you're using celeryd scripts, the worker imports your task module(s) at startup. Even if you then create more task functions or alter existing ones, the worker will be using its in-memory copies as they were when it read them.
– Mark
Jul 23 '13 at 8:19
1
Note: you can verify that your tasks is or is not registered by runningcelery inspect registered
– Nick Brady
Mar 8 '16 at 18:52
1
You also can start celery with option--autoreloadwhich will restart celery each time code was changed.
– Sergey
Aug 2 '16 at 15:09
add a comment |
I think you need to restart the worker server. I meet the same problem and solve it by restarting.
I think you need to restart the worker server. I meet the same problem and solve it by restarting.
answered Mar 30 '12 at 15:43
Wei AnWei An
7781717
7781717
5
Thanks! Wish I found this an hour ago
– Nexus
Jun 24 '12 at 4:57
2
This fixed it for me. If you're using celeryd scripts, the worker imports your task module(s) at startup. Even if you then create more task functions or alter existing ones, the worker will be using its in-memory copies as they were when it read them.
– Mark
Jul 23 '13 at 8:19
1
Note: you can verify that your tasks is or is not registered by runningcelery inspect registered
– Nick Brady
Mar 8 '16 at 18:52
1
You also can start celery with option--autoreloadwhich will restart celery each time code was changed.
– Sergey
Aug 2 '16 at 15:09
add a comment |
5
Thanks! Wish I found this an hour ago
– Nexus
Jun 24 '12 at 4:57
2
This fixed it for me. If you're using celeryd scripts, the worker imports your task module(s) at startup. Even if you then create more task functions or alter existing ones, the worker will be using its in-memory copies as they were when it read them.
– Mark
Jul 23 '13 at 8:19
1
Note: you can verify that your tasks is or is not registered by runningcelery inspect registered
– Nick Brady
Mar 8 '16 at 18:52
1
You also can start celery with option--autoreloadwhich will restart celery each time code was changed.
– Sergey
Aug 2 '16 at 15:09
5
5
Thanks! Wish I found this an hour ago
– Nexus
Jun 24 '12 at 4:57
Thanks! Wish I found this an hour ago
– Nexus
Jun 24 '12 at 4:57
2
2
This fixed it for me. If you're using celeryd scripts, the worker imports your task module(s) at startup. Even if you then create more task functions or alter existing ones, the worker will be using its in-memory copies as they were when it read them.
– Mark
Jul 23 '13 at 8:19
This fixed it for me. If you're using celeryd scripts, the worker imports your task module(s) at startup. Even if you then create more task functions or alter existing ones, the worker will be using its in-memory copies as they were when it read them.
– Mark
Jul 23 '13 at 8:19
1
1
Note: you can verify that your tasks is or is not registered by running
celery inspect registered– Nick Brady
Mar 8 '16 at 18:52
Note: you can verify that your tasks is or is not registered by running
celery inspect registered– Nick Brady
Mar 8 '16 at 18:52
1
1
You also can start celery with option
--autoreload which will restart celery each time code was changed.– Sergey
Aug 2 '16 at 15:09
You also can start celery with option
--autoreload which will restart celery each time code was changed.– Sergey
Aug 2 '16 at 15:09
add a comment |
Whether you use CELERY_IMPORTS or autodiscover_tasks, the important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch.
When you launch the Celery, say celery worker -A project --loglevel=DEBUG, you should see the name of the tasks. For example, if I have a debug_task task in my celery.py.
[tasks]
. project.celery.debug_task
. celery.backend_cleanup
. celery.chain
. celery.chord
. celery.chord_unlock
. celery.chunks
. celery.group
. celery.map
. celery.starmap
If you can't see your tasks in the list, please check your celery configuration imports the tasks correctly, either in --setting, --config, celeryconfig or config_from_object.
If you are using celery beat, make sure the task name, task, you use in CELERYBEAT_SCHEDULE matches the name in the celery task list.
This was very helpful. The name of the task needs to match the the 'task' key in your CELERYBEAT_SCHEDULE
– ss_millionaire
Dec 2 '18 at 1:23
*The important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch. * Good point!!!
– Light.G
2 days ago
add a comment |
Whether you use CELERY_IMPORTS or autodiscover_tasks, the important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch.
When you launch the Celery, say celery worker -A project --loglevel=DEBUG, you should see the name of the tasks. For example, if I have a debug_task task in my celery.py.
[tasks]
. project.celery.debug_task
. celery.backend_cleanup
. celery.chain
. celery.chord
. celery.chord_unlock
. celery.chunks
. celery.group
. celery.map
. celery.starmap
If you can't see your tasks in the list, please check your celery configuration imports the tasks correctly, either in --setting, --config, celeryconfig or config_from_object.
If you are using celery beat, make sure the task name, task, you use in CELERYBEAT_SCHEDULE matches the name in the celery task list.
This was very helpful. The name of the task needs to match the the 'task' key in your CELERYBEAT_SCHEDULE
– ss_millionaire
Dec 2 '18 at 1:23
*The important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch. * Good point!!!
– Light.G
2 days ago
add a comment |
Whether you use CELERY_IMPORTS or autodiscover_tasks, the important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch.
When you launch the Celery, say celery worker -A project --loglevel=DEBUG, you should see the name of the tasks. For example, if I have a debug_task task in my celery.py.
[tasks]
. project.celery.debug_task
. celery.backend_cleanup
. celery.chain
. celery.chord
. celery.chord_unlock
. celery.chunks
. celery.group
. celery.map
. celery.starmap
If you can't see your tasks in the list, please check your celery configuration imports the tasks correctly, either in --setting, --config, celeryconfig or config_from_object.
If you are using celery beat, make sure the task name, task, you use in CELERYBEAT_SCHEDULE matches the name in the celery task list.
Whether you use CELERY_IMPORTS or autodiscover_tasks, the important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch.
When you launch the Celery, say celery worker -A project --loglevel=DEBUG, you should see the name of the tasks. For example, if I have a debug_task task in my celery.py.
[tasks]
. project.celery.debug_task
. celery.backend_cleanup
. celery.chain
. celery.chord
. celery.chord_unlock
. celery.chunks
. celery.group
. celery.map
. celery.starmap
If you can't see your tasks in the list, please check your celery configuration imports the tasks correctly, either in --setting, --config, celeryconfig or config_from_object.
If you are using celery beat, make sure the task name, task, you use in CELERYBEAT_SCHEDULE matches the name in the celery task list.
answered Mar 7 '14 at 7:20
Shih-Wen SuShih-Wen Su
1,1651316
1,1651316
This was very helpful. The name of the task needs to match the the 'task' key in your CELERYBEAT_SCHEDULE
– ss_millionaire
Dec 2 '18 at 1:23
*The important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch. * Good point!!!
– Light.G
2 days ago
add a comment |
This was very helpful. The name of the task needs to match the the 'task' key in your CELERYBEAT_SCHEDULE
– ss_millionaire
Dec 2 '18 at 1:23
*The important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch. * Good point!!!
– Light.G
2 days ago
This was very helpful. The name of the task needs to match the the 'task' key in your CELERYBEAT_SCHEDULE
– ss_millionaire
Dec 2 '18 at 1:23
This was very helpful. The name of the task needs to match the the 'task' key in your CELERYBEAT_SCHEDULE
– ss_millionaire
Dec 2 '18 at 1:23
*The important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch. * Good point!!!
– Light.G
2 days ago
*The important point is the tasks are able to be found and the name of the tasks registered in Celery should match the names the workers try to fetch. * Good point!!!
– Light.G
2 days ago
add a comment |
I also had the same problem; I added
CELERY_IMPORTS=("mytasks")
in my celeryconfig.py file to solve it.
5
Note that this should be a list or a tuple:CELERY_IMPORTS = ['my_module']
– asksol
Nov 10 '13 at 20:50
add a comment |
I also had the same problem; I added
CELERY_IMPORTS=("mytasks")
in my celeryconfig.py file to solve it.
5
Note that this should be a list or a tuple:CELERY_IMPORTS = ['my_module']
– asksol
Nov 10 '13 at 20:50
add a comment |
I also had the same problem; I added
CELERY_IMPORTS=("mytasks")
in my celeryconfig.py file to solve it.
I also had the same problem; I added
CELERY_IMPORTS=("mytasks")
in my celeryconfig.py file to solve it.
edited Nov 16 '12 at 9:48
Martijn Pieters♦
706k13524662290
706k13524662290
answered Aug 24 '12 at 12:37
Rohitashv SinghalRohitashv Singhal
2,835104282
2,835104282
5
Note that this should be a list or a tuple:CELERY_IMPORTS = ['my_module']
– asksol
Nov 10 '13 at 20:50
add a comment |
5
Note that this should be a list or a tuple:CELERY_IMPORTS = ['my_module']
– asksol
Nov 10 '13 at 20:50
5
5
Note that this should be a list or a tuple:
CELERY_IMPORTS = ['my_module']– asksol
Nov 10 '13 at 20:50
Note that this should be a list or a tuple:
CELERY_IMPORTS = ['my_module']– asksol
Nov 10 '13 at 20:50
add a comment |
For me this error was solved by ensuring the app containing the tasks was included under django's INSTALLED_APPS setting.
Also, the tasks needed to be accessible from <app>/tasks.py
– np8
Oct 23 '17 at 7:11
add a comment |
For me this error was solved by ensuring the app containing the tasks was included under django's INSTALLED_APPS setting.
Also, the tasks needed to be accessible from <app>/tasks.py
– np8
Oct 23 '17 at 7:11
add a comment |
For me this error was solved by ensuring the app containing the tasks was included under django's INSTALLED_APPS setting.
For me this error was solved by ensuring the app containing the tasks was included under django's INSTALLED_APPS setting.
answered Jun 12 '13 at 10:33
carscars
179316
179316
Also, the tasks needed to be accessible from <app>/tasks.py
– np8
Oct 23 '17 at 7:11
add a comment |
Also, the tasks needed to be accessible from <app>/tasks.py
– np8
Oct 23 '17 at 7:11
Also, the tasks needed to be accessible from <app>/tasks.py
– np8
Oct 23 '17 at 7:11
Also, the tasks needed to be accessible from <app>/tasks.py
– np8
Oct 23 '17 at 7:11
add a comment |
Using --settings did not work for me. I had to use the following to get it all to work:
celery --config=celeryconfig --loglevel=INFO
Here is the celeryconfig file that has the CELERY_IMPORTS added:
# Celery configuration file
BROKER_URL = 'amqp://'
CELERY_RESULT_BACKEND = 'amqp://'
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'America/Los_Angeles'
CELERY_ENABLE_UTC = True
CELERY_IMPORTS = ("tasks",)
My setup was a little bit more tricky because I'm using supervisor to launch celery as a daemon.
add a comment |
Using --settings did not work for me. I had to use the following to get it all to work:
celery --config=celeryconfig --loglevel=INFO
Here is the celeryconfig file that has the CELERY_IMPORTS added:
# Celery configuration file
BROKER_URL = 'amqp://'
CELERY_RESULT_BACKEND = 'amqp://'
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'America/Los_Angeles'
CELERY_ENABLE_UTC = True
CELERY_IMPORTS = ("tasks",)
My setup was a little bit more tricky because I'm using supervisor to launch celery as a daemon.
add a comment |
Using --settings did not work for me. I had to use the following to get it all to work:
celery --config=celeryconfig --loglevel=INFO
Here is the celeryconfig file that has the CELERY_IMPORTS added:
# Celery configuration file
BROKER_URL = 'amqp://'
CELERY_RESULT_BACKEND = 'amqp://'
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'America/Los_Angeles'
CELERY_ENABLE_UTC = True
CELERY_IMPORTS = ("tasks",)
My setup was a little bit more tricky because I'm using supervisor to launch celery as a daemon.
Using --settings did not work for me. I had to use the following to get it all to work:
celery --config=celeryconfig --loglevel=INFO
Here is the celeryconfig file that has the CELERY_IMPORTS added:
# Celery configuration file
BROKER_URL = 'amqp://'
CELERY_RESULT_BACKEND = 'amqp://'
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'America/Los_Angeles'
CELERY_ENABLE_UTC = True
CELERY_IMPORTS = ("tasks",)
My setup was a little bit more tricky because I'm using supervisor to launch celery as a daemon.
answered May 31 '13 at 0:12
Jarie BolanderJarie Bolander
31433
31433
add a comment |
add a comment |
app = Celery('proj',
broker='amqp://',
backend='amqp://',
include=['proj.tasks'])
please include=['proj.tasks']
You need go to the top dir, then exec this
celery -A app.celery_module.celeryapp worker --loglevel=info
not
celery -A celeryapp worker --loglevel=info
in your celeryconfig.py input imports = ("path.ptah.tasks",)
please in other module invoke task!!!!!!!!
Theincludeparam need to be add if you're using relative imports. I've solved my issue by adding it
– CK.Nguyen
Sep 28 '18 at 11:32
Voted your answer for this stringplease in other module invoke task!!!!!!!!. It helped.
– VolArt
Jan 14 at 10:47
add a comment |
app = Celery('proj',
broker='amqp://',
backend='amqp://',
include=['proj.tasks'])
please include=['proj.tasks']
You need go to the top dir, then exec this
celery -A app.celery_module.celeryapp worker --loglevel=info
not
celery -A celeryapp worker --loglevel=info
in your celeryconfig.py input imports = ("path.ptah.tasks",)
please in other module invoke task!!!!!!!!
Theincludeparam need to be add if you're using relative imports. I've solved my issue by adding it
– CK.Nguyen
Sep 28 '18 at 11:32
Voted your answer for this stringplease in other module invoke task!!!!!!!!. It helped.
– VolArt
Jan 14 at 10:47
add a comment |
app = Celery('proj',
broker='amqp://',
backend='amqp://',
include=['proj.tasks'])
please include=['proj.tasks']
You need go to the top dir, then exec this
celery -A app.celery_module.celeryapp worker --loglevel=info
not
celery -A celeryapp worker --loglevel=info
in your celeryconfig.py input imports = ("path.ptah.tasks",)
please in other module invoke task!!!!!!!!
app = Celery('proj',
broker='amqp://',
backend='amqp://',
include=['proj.tasks'])
please include=['proj.tasks']
You need go to the top dir, then exec this
celery -A app.celery_module.celeryapp worker --loglevel=info
not
celery -A celeryapp worker --loglevel=info
in your celeryconfig.py input imports = ("path.ptah.tasks",)
please in other module invoke task!!!!!!!!
edited Oct 3 '18 at 2:58
answered Sep 28 '18 at 6:13
heyueheyue
766
766
Theincludeparam need to be add if you're using relative imports. I've solved my issue by adding it
– CK.Nguyen
Sep 28 '18 at 11:32
Voted your answer for this stringplease in other module invoke task!!!!!!!!. It helped.
– VolArt
Jan 14 at 10:47
add a comment |
Theincludeparam need to be add if you're using relative imports. I've solved my issue by adding it
– CK.Nguyen
Sep 28 '18 at 11:32
Voted your answer for this stringplease in other module invoke task!!!!!!!!. It helped.
– VolArt
Jan 14 at 10:47
The
include param need to be add if you're using relative imports. I've solved my issue by adding it– CK.Nguyen
Sep 28 '18 at 11:32
The
include param need to be add if you're using relative imports. I've solved my issue by adding it– CK.Nguyen
Sep 28 '18 at 11:32
Voted your answer for this string
please in other module invoke task!!!!!!!!. It helped.– VolArt
Jan 14 at 10:47
Voted your answer for this string
please in other module invoke task!!!!!!!!. It helped.– VolArt
Jan 14 at 10:47
add a comment |
I had this problem mysteriously crop up when I added some signal handling to my django app. In doing so I converted the app to use an AppConfig, meaning that instead of simply reading as 'booking' in INSTALLED_APPS, it read 'booking.app.BookingConfig'.
Celery doesn't understand what that means, so I added, INSTALLED_APPS_WITH_APPCONFIGS = ('booking',) to my django settings, and modified my celery.py from
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
to
app.autodiscover_tasks(
lambda: settings.INSTALLED_APPS + settings.INSTALLED_APPS_WITH_APPCONFIGS
)
add a comment |
I had this problem mysteriously crop up when I added some signal handling to my django app. In doing so I converted the app to use an AppConfig, meaning that instead of simply reading as 'booking' in INSTALLED_APPS, it read 'booking.app.BookingConfig'.
Celery doesn't understand what that means, so I added, INSTALLED_APPS_WITH_APPCONFIGS = ('booking',) to my django settings, and modified my celery.py from
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
to
app.autodiscover_tasks(
lambda: settings.INSTALLED_APPS + settings.INSTALLED_APPS_WITH_APPCONFIGS
)
add a comment |
I had this problem mysteriously crop up when I added some signal handling to my django app. In doing so I converted the app to use an AppConfig, meaning that instead of simply reading as 'booking' in INSTALLED_APPS, it read 'booking.app.BookingConfig'.
Celery doesn't understand what that means, so I added, INSTALLED_APPS_WITH_APPCONFIGS = ('booking',) to my django settings, and modified my celery.py from
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
to
app.autodiscover_tasks(
lambda: settings.INSTALLED_APPS + settings.INSTALLED_APPS_WITH_APPCONFIGS
)
I had this problem mysteriously crop up when I added some signal handling to my django app. In doing so I converted the app to use an AppConfig, meaning that instead of simply reading as 'booking' in INSTALLED_APPS, it read 'booking.app.BookingConfig'.
Celery doesn't understand what that means, so I added, INSTALLED_APPS_WITH_APPCONFIGS = ('booking',) to my django settings, and modified my celery.py from
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
to
app.autodiscover_tasks(
lambda: settings.INSTALLED_APPS + settings.INSTALLED_APPS_WITH_APPCONFIGS
)
answered Aug 24 '16 at 17:20
Adam BarnesAdam Barnes
1,5891014
1,5891014
add a comment |
add a comment |
I had the same problem running tasks from Celery Beat. Celery doesn't like relative imports so in my celeryconfig.py, I had to explicitly set the full package name:
app.conf.beat_schedule = {
'add-every-30-seconds': {
'task': 'full.path.to.add',
'schedule': 30.0,
'args': (16, 16)
},
}
I wish the celery docs had more examples with full package names. After seeing full.path.to.add in this answer, I found out I did not need the imports. I knew the solution was simple, and just needed to have a better example of the app.conf.beat_schedule.
– zerocog
Aug 11 '17 at 17:26
add a comment |
I had the same problem running tasks from Celery Beat. Celery doesn't like relative imports so in my celeryconfig.py, I had to explicitly set the full package name:
app.conf.beat_schedule = {
'add-every-30-seconds': {
'task': 'full.path.to.add',
'schedule': 30.0,
'args': (16, 16)
},
}
I wish the celery docs had more examples with full package names. After seeing full.path.to.add in this answer, I found out I did not need the imports. I knew the solution was simple, and just needed to have a better example of the app.conf.beat_schedule.
– zerocog
Aug 11 '17 at 17:26
add a comment |
I had the same problem running tasks from Celery Beat. Celery doesn't like relative imports so in my celeryconfig.py, I had to explicitly set the full package name:
app.conf.beat_schedule = {
'add-every-30-seconds': {
'task': 'full.path.to.add',
'schedule': 30.0,
'args': (16, 16)
},
}
I had the same problem running tasks from Celery Beat. Celery doesn't like relative imports so in my celeryconfig.py, I had to explicitly set the full package name:
app.conf.beat_schedule = {
'add-every-30-seconds': {
'task': 'full.path.to.add',
'schedule': 30.0,
'args': (16, 16)
},
}
edited Dec 13 '16 at 1:07
Unheilig
12k165386
12k165386
answered Dec 13 '16 at 0:44
Justin RegeleJustin Regele
291
291
I wish the celery docs had more examples with full package names. After seeing full.path.to.add in this answer, I found out I did not need the imports. I knew the solution was simple, and just needed to have a better example of the app.conf.beat_schedule.
– zerocog
Aug 11 '17 at 17:26
add a comment |
I wish the celery docs had more examples with full package names. After seeing full.path.to.add in this answer, I found out I did not need the imports. I knew the solution was simple, and just needed to have a better example of the app.conf.beat_schedule.
– zerocog
Aug 11 '17 at 17:26
I wish the celery docs had more examples with full package names. After seeing full.path.to.add in this answer, I found out I did not need the imports. I knew the solution was simple, and just needed to have a better example of the app.conf.beat_schedule.
– zerocog
Aug 11 '17 at 17:26
I wish the celery docs had more examples with full package names. After seeing full.path.to.add in this answer, I found out I did not need the imports. I knew the solution was simple, and just needed to have a better example of the app.conf.beat_schedule.
– zerocog
Aug 11 '17 at 17:26
add a comment |
I did not have any issue with Django. But encountered this when I was using Flask. The solution was setting the config option.
celery worker -A app.celery --loglevel=DEBUG --config=settings
while with Django, I just had:
python manage.py celery worker -c 2 --loglevel=info
add a comment |
I did not have any issue with Django. But encountered this when I was using Flask. The solution was setting the config option.
celery worker -A app.celery --loglevel=DEBUG --config=settings
while with Django, I just had:
python manage.py celery worker -c 2 --loglevel=info
add a comment |
I did not have any issue with Django. But encountered this when I was using Flask. The solution was setting the config option.
celery worker -A app.celery --loglevel=DEBUG --config=settings
while with Django, I just had:
python manage.py celery worker -c 2 --loglevel=info
I did not have any issue with Django. But encountered this when I was using Flask. The solution was setting the config option.
celery worker -A app.celery --loglevel=DEBUG --config=settings
while with Django, I just had:
python manage.py celery worker -c 2 --loglevel=info
answered Apr 6 '18 at 14:44
Nihal SharmaNihal Sharma
1,06042747
1,06042747
add a comment |
add a comment |
What worked for me, was to add explicit name to celery task decorator. I changed my task declaration from @app.tasks to @app.tasks(name='module.submodule.task')
Here is an example
# test_task.py
@celery.task
def test_task():
print("Celery Task !!!!")
# test_task.py
@celery.task(name='tasks.test.test_task')
def test_task():
print("Celery Task !!!!")
add a comment |
What worked for me, was to add explicit name to celery task decorator. I changed my task declaration from @app.tasks to @app.tasks(name='module.submodule.task')
Here is an example
# test_task.py
@celery.task
def test_task():
print("Celery Task !!!!")
# test_task.py
@celery.task(name='tasks.test.test_task')
def test_task():
print("Celery Task !!!!")
add a comment |
What worked for me, was to add explicit name to celery task decorator. I changed my task declaration from @app.tasks to @app.tasks(name='module.submodule.task')
Here is an example
# test_task.py
@celery.task
def test_task():
print("Celery Task !!!!")
# test_task.py
@celery.task(name='tasks.test.test_task')
def test_task():
print("Celery Task !!!!")
What worked for me, was to add explicit name to celery task decorator. I changed my task declaration from @app.tasks to @app.tasks(name='module.submodule.task')
Here is an example
# test_task.py
@celery.task
def test_task():
print("Celery Task !!!!")
# test_task.py
@celery.task(name='tasks.test.test_task')
def test_task():
print("Celery Task !!!!")
answered Jun 20 '18 at 16:12
Lukasz DynowskiLukasz Dynowski
1,6541835
1,6541835
add a comment |
add a comment |
This, strangely, can also be because of a missing package. Run pip to install all necessary packages:
pip install -r requirements.txt
autodiscover_tasks wasn't picking up tasks that used missing packages.
I had a similar issue. I think what happens is an exception during import causes parts of the auto-discovery to not complete.
– Tim Tisdall
Dec 19 '18 at 14:42
Ahh yeah, makes sense. Thanks
– kakoma
Dec 20 '18 at 10:33
add a comment |
This, strangely, can also be because of a missing package. Run pip to install all necessary packages:
pip install -r requirements.txt
autodiscover_tasks wasn't picking up tasks that used missing packages.
I had a similar issue. I think what happens is an exception during import causes parts of the auto-discovery to not complete.
– Tim Tisdall
Dec 19 '18 at 14:42
Ahh yeah, makes sense. Thanks
– kakoma
Dec 20 '18 at 10:33
add a comment |
This, strangely, can also be because of a missing package. Run pip to install all necessary packages:
pip install -r requirements.txt
autodiscover_tasks wasn't picking up tasks that used missing packages.
This, strangely, can also be because of a missing package. Run pip to install all necessary packages:
pip install -r requirements.txt
autodiscover_tasks wasn't picking up tasks that used missing packages.
answered Oct 13 '18 at 8:17
kakomakakoma
1,0011014
1,0011014
I had a similar issue. I think what happens is an exception during import causes parts of the auto-discovery to not complete.
– Tim Tisdall
Dec 19 '18 at 14:42
Ahh yeah, makes sense. Thanks
– kakoma
Dec 20 '18 at 10:33
add a comment |
I had a similar issue. I think what happens is an exception during import causes parts of the auto-discovery to not complete.
– Tim Tisdall
Dec 19 '18 at 14:42
Ahh yeah, makes sense. Thanks
– kakoma
Dec 20 '18 at 10:33
I had a similar issue. I think what happens is an exception during import causes parts of the auto-discovery to not complete.
– Tim Tisdall
Dec 19 '18 at 14:42
I had a similar issue. I think what happens is an exception during import causes parts of the auto-discovery to not complete.
– Tim Tisdall
Dec 19 '18 at 14:42
Ahh yeah, makes sense. Thanks
– kakoma
Dec 20 '18 at 10:33
Ahh yeah, makes sense. Thanks
– kakoma
Dec 20 '18 at 10:33
add a comment |
I encountered this problem as well, but it is not quite the same, so just FYI. Recent upgrades causes this error message due to this decorator syntax.
ERROR/MainProcess] Received unregistered task of type 'my_server_check'.
@task('my_server_check')
Had to be change to just
@task()
No clue why.
add a comment |
I encountered this problem as well, but it is not quite the same, so just FYI. Recent upgrades causes this error message due to this decorator syntax.
ERROR/MainProcess] Received unregistered task of type 'my_server_check'.
@task('my_server_check')
Had to be change to just
@task()
No clue why.
add a comment |
I encountered this problem as well, but it is not quite the same, so just FYI. Recent upgrades causes this error message due to this decorator syntax.
ERROR/MainProcess] Received unregistered task of type 'my_server_check'.
@task('my_server_check')
Had to be change to just
@task()
No clue why.
I encountered this problem as well, but it is not quite the same, so just FYI. Recent upgrades causes this error message due to this decorator syntax.
ERROR/MainProcess] Received unregistered task of type 'my_server_check'.
@task('my_server_check')
Had to be change to just
@task()
No clue why.
edited Nov 13 '18 at 15:53
markwalker_
4,62453774
4,62453774
answered Mar 17 '14 at 20:10
stonefurystonefury
41646
41646
add a comment |
add a comment |
If you are running into this kind of error, there are a number of possible causes but the solution I found was that my celeryd config file in /etc/defaults/celeryd was configured for standard use, not for my specific django project. As soon as I converted it to the format specified in the celery docs, all was well.
add a comment |
If you are running into this kind of error, there are a number of possible causes but the solution I found was that my celeryd config file in /etc/defaults/celeryd was configured for standard use, not for my specific django project. As soon as I converted it to the format specified in the celery docs, all was well.
add a comment |
If you are running into this kind of error, there are a number of possible causes but the solution I found was that my celeryd config file in /etc/defaults/celeryd was configured for standard use, not for my specific django project. As soon as I converted it to the format specified in the celery docs, all was well.
If you are running into this kind of error, there are a number of possible causes but the solution I found was that my celeryd config file in /etc/defaults/celeryd was configured for standard use, not for my specific django project. As soon as I converted it to the format specified in the celery docs, all was well.
answered Dec 16 '12 at 5:00
tufelkindertufelkinder
592829
592829
add a comment |
add a comment |
The solution for me to add this line to /etc/default/celeryd
CELERYD_OPTS="-A tasks"
Because when I run these commands:
celery worker --loglevel=INFO
celery worker -A tasks --loglevel=INFO
Only the latter command was showing task names at all.
I have also tried adding CELERY_APP line /etc/default/celeryd but that didn't worked either.
CELERY_APP="tasks"
add a comment |
The solution for me to add this line to /etc/default/celeryd
CELERYD_OPTS="-A tasks"
Because when I run these commands:
celery worker --loglevel=INFO
celery worker -A tasks --loglevel=INFO
Only the latter command was showing task names at all.
I have also tried adding CELERY_APP line /etc/default/celeryd but that didn't worked either.
CELERY_APP="tasks"
add a comment |
The solution for me to add this line to /etc/default/celeryd
CELERYD_OPTS="-A tasks"
Because when I run these commands:
celery worker --loglevel=INFO
celery worker -A tasks --loglevel=INFO
Only the latter command was showing task names at all.
I have also tried adding CELERY_APP line /etc/default/celeryd but that didn't worked either.
CELERY_APP="tasks"
The solution for me to add this line to /etc/default/celeryd
CELERYD_OPTS="-A tasks"
Because when I run these commands:
celery worker --loglevel=INFO
celery worker -A tasks --loglevel=INFO
Only the latter command was showing task names at all.
I have also tried adding CELERY_APP line /etc/default/celeryd but that didn't worked either.
CELERY_APP="tasks"
answered Mar 7 '14 at 2:52
fatihpensefatihpense
40559
40559
add a comment |
add a comment |
I had the issue with PeriodicTask classes in django-celery, while their names showed up fine when starting the celery worker every execution triggered:
KeyError: u'my_app.tasks.run'
My task was a class named 'CleanUp', not just a method called 'run'.
When I checked table 'djcelery_periodictask' I saw outdated entries and deleting them fixed the issue.
add a comment |
I had the issue with PeriodicTask classes in django-celery, while their names showed up fine when starting the celery worker every execution triggered:
KeyError: u'my_app.tasks.run'
My task was a class named 'CleanUp', not just a method called 'run'.
When I checked table 'djcelery_periodictask' I saw outdated entries and deleting them fixed the issue.
add a comment |
I had the issue with PeriodicTask classes in django-celery, while their names showed up fine when starting the celery worker every execution triggered:
KeyError: u'my_app.tasks.run'
My task was a class named 'CleanUp', not just a method called 'run'.
When I checked table 'djcelery_periodictask' I saw outdated entries and deleting them fixed the issue.
I had the issue with PeriodicTask classes in django-celery, while their names showed up fine when starting the celery worker every execution triggered:
KeyError: u'my_app.tasks.run'
My task was a class named 'CleanUp', not just a method called 'run'.
When I checked table 'djcelery_periodictask' I saw outdated entries and deleting them fixed the issue.
answered Jul 25 '14 at 5:58
djangonautdjangonaut
3,26822433
3,26822433
add a comment |
add a comment |
Just to add my two cents for my case with this error...
My path is /vagrant/devops/test with app.py and __init__.py in it.
When I run cd /vagrant/devops/ && celery worker -A test.app.celery --loglevel=info I am getting this error.
But when I run it like cd /vagrant/devops/test && celery worker -A app.celery --loglevel=info everything is OK.
add a comment |
Just to add my two cents for my case with this error...
My path is /vagrant/devops/test with app.py and __init__.py in it.
When I run cd /vagrant/devops/ && celery worker -A test.app.celery --loglevel=info I am getting this error.
But when I run it like cd /vagrant/devops/test && celery worker -A app.celery --loglevel=info everything is OK.
add a comment |
Just to add my two cents for my case with this error...
My path is /vagrant/devops/test with app.py and __init__.py in it.
When I run cd /vagrant/devops/ && celery worker -A test.app.celery --loglevel=info I am getting this error.
But when I run it like cd /vagrant/devops/test && celery worker -A app.celery --loglevel=info everything is OK.
Just to add my two cents for my case with this error...
My path is /vagrant/devops/test with app.py and __init__.py in it.
When I run cd /vagrant/devops/ && celery worker -A test.app.celery --loglevel=info I am getting this error.
But when I run it like cd /vagrant/devops/test && celery worker -A app.celery --loglevel=info everything is OK.
answered May 5 '17 at 8:06
Kostas DemirisKostas Demiris
1,1261843
1,1261843
add a comment |
add a comment |
I've found that one of our programmers added the following line to one of the imports:
os.chdir(<path_to_a_local_folder>)
This caused the Celery worker to change its working directory from the projects' default working directory (where it could find the tasks) to a different directory (where it couldn't find the tasks).
After removing this line of code, all tasks were found and registered.
add a comment |
I've found that one of our programmers added the following line to one of the imports:
os.chdir(<path_to_a_local_folder>)
This caused the Celery worker to change its working directory from the projects' default working directory (where it could find the tasks) to a different directory (where it couldn't find the tasks).
After removing this line of code, all tasks were found and registered.
add a comment |
I've found that one of our programmers added the following line to one of the imports:
os.chdir(<path_to_a_local_folder>)
This caused the Celery worker to change its working directory from the projects' default working directory (where it could find the tasks) to a different directory (where it couldn't find the tasks).
After removing this line of code, all tasks were found and registered.
I've found that one of our programmers added the following line to one of the imports:
os.chdir(<path_to_a_local_folder>)
This caused the Celery worker to change its working directory from the projects' default working directory (where it could find the tasks) to a different directory (where it couldn't find the tasks).
After removing this line of code, all tasks were found and registered.
edited May 11 '17 at 0:22
Nathaniel Ford
13.6k145473
13.6k145473
answered Nov 16 '16 at 9:03
Amit ZitzmanAmit Zitzman
3116
3116
add a comment |
add a comment |
Celery doesn't support relative imports so in my celeryconfig.py, you need absolute import.
CELERYBEAT_SCHEDULE = {
'add_num': {
'task': 'app.tasks.add_num.add_nums',
'schedule': timedelta(seconds=10),
'args': (1, 2)
}
}
add a comment |
Celery doesn't support relative imports so in my celeryconfig.py, you need absolute import.
CELERYBEAT_SCHEDULE = {
'add_num': {
'task': 'app.tasks.add_num.add_nums',
'schedule': timedelta(seconds=10),
'args': (1, 2)
}
}
add a comment |
Celery doesn't support relative imports so in my celeryconfig.py, you need absolute import.
CELERYBEAT_SCHEDULE = {
'add_num': {
'task': 'app.tasks.add_num.add_nums',
'schedule': timedelta(seconds=10),
'args': (1, 2)
}
}
Celery doesn't support relative imports so in my celeryconfig.py, you need absolute import.
CELERYBEAT_SCHEDULE = {
'add_num': {
'task': 'app.tasks.add_num.add_nums',
'schedule': timedelta(seconds=10),
'args': (1, 2)
}
}
answered Oct 16 '17 at 9:14
Eds_kEds_k
7114
7114
add a comment |
add a comment |
An additional item to a really useful list.
I have found Celery unforgiving in relation to errors in tasks (or at least I haven't been able to trace the appropriate log entries) and it doesn't register them. I have had a number of issues with running Celery as a service, which have been predominantly permissions related.
The latest related to permissions writing to a log file. I had no issues in development or running celery at the command line, but the service reported the task as unregistered.
I needed to change the log folder permissions to enable the service to write to it.
add a comment |
An additional item to a really useful list.
I have found Celery unforgiving in relation to errors in tasks (or at least I haven't been able to trace the appropriate log entries) and it doesn't register them. I have had a number of issues with running Celery as a service, which have been predominantly permissions related.
The latest related to permissions writing to a log file. I had no issues in development or running celery at the command line, but the service reported the task as unregistered.
I needed to change the log folder permissions to enable the service to write to it.
add a comment |
An additional item to a really useful list.
I have found Celery unforgiving in relation to errors in tasks (or at least I haven't been able to trace the appropriate log entries) and it doesn't register them. I have had a number of issues with running Celery as a service, which have been predominantly permissions related.
The latest related to permissions writing to a log file. I had no issues in development or running celery at the command line, but the service reported the task as unregistered.
I needed to change the log folder permissions to enable the service to write to it.
An additional item to a really useful list.
I have found Celery unforgiving in relation to errors in tasks (or at least I haven't been able to trace the appropriate log entries) and it doesn't register them. I have had a number of issues with running Celery as a service, which have been predominantly permissions related.
The latest related to permissions writing to a log file. I had no issues in development or running celery at the command line, but the service reported the task as unregistered.
I needed to change the log folder permissions to enable the service to write to it.
answered Dec 28 '17 at 14:26
MurrayAusUKMurrayAusUK
11
11
add a comment |
add a comment |
My 2 cents
I was getting this in a docker image using alpine. The django settings referenced /dev/log for logging to syslog. The django app and celery worker were both based on the same image. The entrypoint of the django app image was launching syslogd on start, but the one for the celery worker was not. This was causing things like ./manage.py shell to fail because there wouldn't be any /dev/log. The celery worker was not failing. Instead, it was silently just ignoring the rest of the app launch, which included loading shared_task entries from applications in the django project
add a comment |
My 2 cents
I was getting this in a docker image using alpine. The django settings referenced /dev/log for logging to syslog. The django app and celery worker were both based on the same image. The entrypoint of the django app image was launching syslogd on start, but the one for the celery worker was not. This was causing things like ./manage.py shell to fail because there wouldn't be any /dev/log. The celery worker was not failing. Instead, it was silently just ignoring the rest of the app launch, which included loading shared_task entries from applications in the django project
add a comment |
My 2 cents
I was getting this in a docker image using alpine. The django settings referenced /dev/log for logging to syslog. The django app and celery worker were both based on the same image. The entrypoint of the django app image was launching syslogd on start, but the one for the celery worker was not. This was causing things like ./manage.py shell to fail because there wouldn't be any /dev/log. The celery worker was not failing. Instead, it was silently just ignoring the rest of the app launch, which included loading shared_task entries from applications in the django project
My 2 cents
I was getting this in a docker image using alpine. The django settings referenced /dev/log for logging to syslog. The django app and celery worker were both based on the same image. The entrypoint of the django app image was launching syslogd on start, but the one for the celery worker was not. This was causing things like ./manage.py shell to fail because there wouldn't be any /dev/log. The celery worker was not failing. Instead, it was silently just ignoring the rest of the app launch, which included loading shared_task entries from applications in the django project
answered Jan 3 '18 at 9:01
shadishadi
4,52031934
4,52031934
add a comment |
add a comment |
In my case the error was because one container created files in a folder that were mounted on the host file-system with docker-compose.
I just had to do remove the files created by the container on the host system and I was able to launch my project again.
sudo rm -Rf foldername
(I had to use sudo because the files were owned by the root user)
Docker version: 18.03.1
add a comment |
In my case the error was because one container created files in a folder that were mounted on the host file-system with docker-compose.
I just had to do remove the files created by the container on the host system and I was able to launch my project again.
sudo rm -Rf foldername
(I had to use sudo because the files were owned by the root user)
Docker version: 18.03.1
add a comment |
In my case the error was because one container created files in a folder that were mounted on the host file-system with docker-compose.
I just had to do remove the files created by the container on the host system and I was able to launch my project again.
sudo rm -Rf foldername
(I had to use sudo because the files were owned by the root user)
Docker version: 18.03.1
In my case the error was because one container created files in a folder that were mounted on the host file-system with docker-compose.
I just had to do remove the files created by the container on the host system and I was able to launch my project again.
sudo rm -Rf foldername
(I had to use sudo because the files were owned by the root user)
Docker version: 18.03.1
answered May 9 '18 at 14:08
jjacobijjacobi
636
636
add a comment |
add a comment |
If you use autodiscover_tasks, make sure that your functions to be registered stay in the tasks.py, not any other file. Or celery can not find the functions you want to register.
Use app.register_task will also do the job, but seems a little naive.
Please refer to this official specification of autodiscover_tasks.
def autodiscover_tasks(self, packages=None, related_name='tasks', force=False):
"""Auto-discover task modules.
Searches a list of packages for a "tasks.py" module (or use
related_name argument).
If the name is empty, this will be delegated to fix-ups (e.g., Django).
For example if you have a directory layout like this:
.. code-block:: text
foo/__init__.py
tasks.py
models.py
bar/__init__.py
tasks.py
models.py
baz/__init__.py
models.py
Then calling ``app.autodiscover_tasks(['foo', bar', 'baz'])`` will
result in the modules ``foo.tasks`` and ``bar.tasks`` being imported.
Arguments:
packages (List[str]): List of packages to search.
This argument may also be a callable, in which case the
value returned is used (for lazy evaluation).
related_name (str): The name of the module to find. Defaults
to "tasks": meaning "look for 'module.tasks' for every
module in ``packages``."
force (bool): By default this call is lazy so that the actual
auto-discovery won't happen until an application imports
the default modules. Forcing will cause the auto-discovery
to happen immediately.
"""
add a comment |
If you use autodiscover_tasks, make sure that your functions to be registered stay in the tasks.py, not any other file. Or celery can not find the functions you want to register.
Use app.register_task will also do the job, but seems a little naive.
Please refer to this official specification of autodiscover_tasks.
def autodiscover_tasks(self, packages=None, related_name='tasks', force=False):
"""Auto-discover task modules.
Searches a list of packages for a "tasks.py" module (or use
related_name argument).
If the name is empty, this will be delegated to fix-ups (e.g., Django).
For example if you have a directory layout like this:
.. code-block:: text
foo/__init__.py
tasks.py
models.py
bar/__init__.py
tasks.py
models.py
baz/__init__.py
models.py
Then calling ``app.autodiscover_tasks(['foo', bar', 'baz'])`` will
result in the modules ``foo.tasks`` and ``bar.tasks`` being imported.
Arguments:
packages (List[str]): List of packages to search.
This argument may also be a callable, in which case the
value returned is used (for lazy evaluation).
related_name (str): The name of the module to find. Defaults
to "tasks": meaning "look for 'module.tasks' for every
module in ``packages``."
force (bool): By default this call is lazy so that the actual
auto-discovery won't happen until an application imports
the default modules. Forcing will cause the auto-discovery
to happen immediately.
"""
add a comment |
If you use autodiscover_tasks, make sure that your functions to be registered stay in the tasks.py, not any other file. Or celery can not find the functions you want to register.
Use app.register_task will also do the job, but seems a little naive.
Please refer to this official specification of autodiscover_tasks.
def autodiscover_tasks(self, packages=None, related_name='tasks', force=False):
"""Auto-discover task modules.
Searches a list of packages for a "tasks.py" module (or use
related_name argument).
If the name is empty, this will be delegated to fix-ups (e.g., Django).
For example if you have a directory layout like this:
.. code-block:: text
foo/__init__.py
tasks.py
models.py
bar/__init__.py
tasks.py
models.py
baz/__init__.py
models.py
Then calling ``app.autodiscover_tasks(['foo', bar', 'baz'])`` will
result in the modules ``foo.tasks`` and ``bar.tasks`` being imported.
Arguments:
packages (List[str]): List of packages to search.
This argument may also be a callable, in which case the
value returned is used (for lazy evaluation).
related_name (str): The name of the module to find. Defaults
to "tasks": meaning "look for 'module.tasks' for every
module in ``packages``."
force (bool): By default this call is lazy so that the actual
auto-discovery won't happen until an application imports
the default modules. Forcing will cause the auto-discovery
to happen immediately.
"""
If you use autodiscover_tasks, make sure that your functions to be registered stay in the tasks.py, not any other file. Or celery can not find the functions you want to register.
Use app.register_task will also do the job, but seems a little naive.
Please refer to this official specification of autodiscover_tasks.
def autodiscover_tasks(self, packages=None, related_name='tasks', force=False):
"""Auto-discover task modules.
Searches a list of packages for a "tasks.py" module (or use
related_name argument).
If the name is empty, this will be delegated to fix-ups (e.g., Django).
For example if you have a directory layout like this:
.. code-block:: text
foo/__init__.py
tasks.py
models.py
bar/__init__.py
tasks.py
models.py
baz/__init__.py
models.py
Then calling ``app.autodiscover_tasks(['foo', bar', 'baz'])`` will
result in the modules ``foo.tasks`` and ``bar.tasks`` being imported.
Arguments:
packages (List[str]): List of packages to search.
This argument may also be a callable, in which case the
value returned is used (for lazy evaluation).
related_name (str): The name of the module to find. Defaults
to "tasks": meaning "look for 'module.tasks' for every
module in ``packages``."
force (bool): By default this call is lazy so that the actual
auto-discovery won't happen until an application imports
the default modules. Forcing will cause the auto-discovery
to happen immediately.
"""
edited May 31 '18 at 12:55
answered May 31 '18 at 12:49
W.PerrinW.Perrin
38128
38128
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9769496%2fcelery-received-unregistered-task-of-type-run-example%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
11
Hi, could you please share what the problem was and how you resolved? The accepted answer doesn't make it clear how others could solve this problem. Thanks.
– Jordan Reiter
Apr 17 '12 at 22:30
2
I'm with Jordan- this was not useful at all. Downvoted.
– Jay Taylor
Aug 24 '12 at 1:06
2
the answer of aiho is the correct one:
CELERY_IMPORTS = ("tasks", )– Alp
Nov 8 '14 at 19:35