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.

cannot schedule tasks on django

See original GitHub issue


I cannot schedule a task to run after a delay using the schedule after upgrading to django 1.11. this is how im testing it: my_task.schedule(args=('string1'), delay=10)

Below is the error that i get.

huey.consume.worker | Error adding task to schedule: my_app.tasks.queue_task_mark_email_message_as_failed_after_time: 64334559-08c9-43be-9a90-25c77067854e @2018-12-10 17:19:47.424274

These are my settings:

HUEY = {
    'name': 'my-tasks',
    # 'backend': 'huey.backends.redis_backend',  # required.
    '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': False,  # 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.
    'backend_class': 'huey.RedisHuey',  # Use path to redis huey by default,
    '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': 1,  # 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.
    'consumer': {
        'workers': 3,
        'worker_type': 'thread',
        'initial_delay': 0.1,  # Smallest polling interval, same as -d.
        'backoff': 1.15,  # Exponential backoff using this rate, -b.
        'max_delay': 10.0,  # Max possible polling interval, -m.
        'utc': True,  # Treat ETAs and schedules as UTC datetimes.
        'scheduler_interval': 1,  # Check schedule every second, -s.
        'periodic': True,  # Enable crontab feature.
        'check_worker_health': True,  # Enable worker health checks.
        'health_check_interval': 1,  # Check worker health every second.

I had to comment backend because it was breaking periodic tasks .

Is this a bug or is this a configuration error? Thanks, Tudor

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

coleifercommented, Dec 19, 2018

Ahh, thanks @vladlep – I didn’t realize I had not yet released the Redis-py 3.0 compatibility fixes.

I’ve pushed a new release, 1.10.5, which specifies redis-py 3.0.0 as a dependency. This should resolve the issues.

felipe3dfxcommented, Feb 1, 2019

The issue back using the following code:

        'payment_id': payment_id,
        'retries': retries - 1,
    delay=(60 * 10),

redis-server 5.0.3 django==2.1.5 huey==1.10.5 python==3.6.7 channels_redis==2.3.3 django-redis-cache==1.8.1

Any ideas?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use python to schedule tasks in a Django application
The only problem is I need my python program that gets the tweets to be run in the background every-so-often. That sounds like...
Read more >
Scheduling Tasks in Django with the Advanced Python ...
We want a consistent and reliable way to initialize a schedule once and only once.
Read more >
Schedule Tasks in Python Django App with Celery
The ability to schedule tasks inside of a Python Django application is crucial in web app development, web applications usually have to run ......
Read more >
Celery scheduled tasks sometimes not being picked up by ...
Recently, for no reason I can figure out, one django app started dropping some scheduled tasks. I set up a logger, and log...
Read more >
psu-scheduler - PyPI
Your scheduled task must be a view with a defined URL in You must prefix it with the @scheduled_job() decorator, which verifies...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found