GithubHelp home page GithubHelp logo

Comments (8)

philippeowagner avatar philippeowagner commented on June 15, 2024

Have you something that keeps the background tasks up and running according to the README (see https://github.com/arteria/django-background-tasks#running-tasks)?

from django-background-tasks.

zhaochy1990 avatar zhaochy1990 commented on June 15, 2024

yes, I followed the README.

I tried to solve this problem today, with python manage.py process_tasks -v 3 --log-level=DEBUG. what I discovered is when django-background-tasks query for the tasks from database, it found no task. But in fact, all the tasks are stored in database.

I execute the query clause in my db console. the result shows all my tasks, this means the query is correct, but django-background-tasks find no task.

The following is the query clause:

QUERY = u'SELECT "background_task"."id", "background_task"."task_name", "background_task"."task_params", "background_task"."task_hash", "background_task"."priority", "background_task"."run_at", "background_task"."queue", "background_task"."attempts", "background_task"."failed_at", "background_task"."last_error", "background_task"."locked_by", "background_task"."locked_at" FROM "background_task" WHERE (("background_task"."locked_by" IS NULL OR "background_task"."locked_at" < %s) AND "background_task"."failed_at" IS NULL AND "background_task"."run_at" <= %s) ORDER BY "background_task"."priority" DESC, "background_task"."run_at" ASC' - PARAMS = (u'2016-07-11 14:37:59.072193', u'2016-07-11 15:37:59.072193'); args=(u'2016-07-11 14:37:59.072193', u'2016-07-11 15:37:59.072193')

after this query, it prints debug message

DEBUG:root:waiting for tasks

and then repeat this status again and again...

By the way, I'm using postgresql. Thank you very much.

from django-background-tasks.

philippeowagner avatar philippeowagner commented on June 15, 2024

What happens if you call python manage.py process_tasks in the production (virtual) env?
Basically 2 tasks must be running

  • 1 for processing requests and
  • 1 to process the tasks in the queue.

from django-background-tasks.

zhaochy1990 avatar zhaochy1990 commented on June 15, 2024

I'm not quite understand what you said "2 tasks", you mean 2 process?
What I said above is on my production env, the background tasks works fine with my develop env.

When i call python manage.py process_tasks, it shows nothing in the console.
And when i checking the running process, I only find one running process
zhaochy 24639 24616 0 00:26 pts/21 00:00:01 python ./manage.py process_tasks

from django-background-tasks.

philippeowagner avatar philippeowagner commented on June 15, 2024

Yes, you're right – two processes, not two tasks.

from django-background-tasks.

philippeowagner avatar philippeowagner commented on June 15, 2024

@zhaochy1990 could you manage to make it work? Please close the filed issue in this case or provide more information about your setup, settings, source, ..
Thank you.

from django-background-tasks.

pstragli avatar pstragli commented on June 15, 2024

Hi I'm running into the same issue stated by @zhaochy1990.
Tasks are being created correctly in the background_tasks table but when I run python manage.py process_tasks they are actually processed on dev environment only, while they are not processed in the production env (though by debugging, the generated SQL queries result in being correct).
I also see only one running process:
1055 11152 0.0 0.1 287480 42952 pts/2 S+ 09:19 0:02 python2.7 manage.py process_tasks

@zhaochy1990 how did you solve the problem? Thanks in advance.

from django-background-tasks.

zhaochy1990 avatar zhaochy1990 commented on June 15, 2024

I use celery instead

from django-background-tasks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.