question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

task not found in TaskRegistry

See original GitHub issue

I just upgraded to the latest version in master to make use of the fix for closing the db but it seems huey is no longer finding the tasks after the update for some reason. I was already running a pretty recent version so not sure what could have changed… i upgraded huey and restarted the workers which should recreate the task registry in redis again right?

QueueException: queuecmd_create_initial_notifications not found in TaskRegistry
  File "huey/bin/huey_consumer.py", line 124, in check_message
    task = self.huey.dequeue()
  File "huey/api.py", line 211, in dequeue
    return registry.get_task_for_message(message)
  File "huey/registry.py", line 70, in get_task_for_message
    klass = self.get_task_class(klass_str)
  File "huey/registry.py", line 60, in get_task_class
    raise QueueException('%s not found in TaskRegistry' % klass_str)

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
vindarelcommented, Sep 19, 2016

Found it. I’m so thankfull to a comment on another project:

Must be named tasks.py and be in the top level of an INSTALLED_APPS directory for Huey to find it.

Mine wasn’t at the top level but alongside a models directory.

Would you add a note about this in the doc ?

0reactions
vindarelcommented, Sep 18, 2016

I had not seen this example, but it’s similar to the doc. I can make it work in a new django project, but not in mine 😦

I have huey.contrib.djhuey in my settings.py:

DEBUG = False

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_extensions',
    'bootstrap3',
    'bootstrap_admin',
    'django.contrib.admin',
    # Custom:
    'mod_wsgi.server',
    'huey.contrib.djhuey',

    'myapp',
)

HUEY = {
    'name': DATABASES['default']['NAME'],  # Use db name for huey.
    'result_store': True,  # Store return values of tasks.
    'events': True,  # Consumer emits events allowing real-time monitoring.
    'store_none': False,  # If a task returns None, do not save to results.
    'always_eager': DEBUG,  # If DEBUG=True, run synchronously.
    'store_errors': True,  # Store error info if task throws exception.
    'blocking': False,  # Poll the queue rather than do blocking pop.
    'connection': {
        'host': 'localhost',
        'port': 6379,
        'db': 0,
        'connection_pool': None,  # Definitely you should use pooling!
        # ... tons of other options, see redis-py for details.

        # huey-specific connection parameters.
        'read_timeout': 5,  # If not polling (blocking pop), use timeout.
        'max_errors': 1000,  # Only store the 1000 most recent errors.
        # 'url': None,  # Allow Redis config via a DSN.
    },
}

in tasks.py

from huey.contrib.djhuey import crontab, periodic_task, db_task
from models import Inventory

@db_task()
def longtask(pk):
    print "long task"
    import ipdb; ipdb.set_trace()

and in my api.py I just from tasks import longtask, but anyway with shell or run_server (I run run_huey first) it throws

ERROR [huey.consumer.Worker] Queue exception
Traceback (most recent call last):
  File "/home/vince/.virtualenvs/abelujo/local/lib/python2.7/site-packages/huey/consumer.py", line 94, in loop
    task = self.huey.dequeue()
  File "/home/vince/.virtualenvs/abelujo/local/lib/python2.7/site-packages/huey/api.py", line 225, in dequeue
    return registry.get_task_for_message(message)
  File "/home/vince/.virtualenvs/abelujo/local/lib/python2.7/site-packages/huey/registry.py", line 70, in get_task_for_message
    klass = self.get_task_class(klass_str)
  File "/home/vince/.virtualenvs/abelujo/local/lib/python2.7/site-packages/huey/registry.py", line 60, in get_task_class
    raise QueueException('%s not found in TaskRegistry' % klass_str)
QueueException: queuecmd_longtask not found in TaskRegistry

I really think this is the same configuration and layout as the simple working project…

Any hints ? Thanks again.

(I could point to my project if needed)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Huey throws huey.exceptions.HueyException
py file I'm getting an exception huey.exceptions.HueyException: xxxxxxx not found in TaskRegistry. I have followed all the steps mentioned in ...
Read more >
Troubleshooting and Common Pitfalls - Huey - Read the Docs
The most common cause of tasks not running is that they are not being loaded, in which case you will see HueyException “XXX...
Read more >
Image not showing after adding ST_HUEY_SCHEDULE - Spirit
Is there a huey.exceptions.HueyException: spirit.core.tasks.search_index_update not found in TaskRegistry error in your log file? Is there a new spirit.core.
Read more >
[solved]-python huey throws huey.exceptions.hueyexception
[solved]-python huey throws huey.exceptions.hueyexception: yyyyyy not found in taskregistry-django ... Your consumer isn't finding your tasks. Assuming that you' ...
Read more >
Distributed processing — Celery 5.2.7 documentation
tasks (Union[str, Type[TaskRegistry]]) – A task registry, or the name of a registry ... Differs from current_task in that it's not affected by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found