Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

292
Visualizações
How to dynamically schedule tasks in Django?

I need to build an app in Django that lets the user do some task everyday at the time they specify at runtime.

I have looked at Celery but couldn't​ find anything that will help. I found apply_async and I can get the task to execute once at the specificied duration but not recurrent. I am missing something but don't know what.

Please suggest how can I achieve this.

about 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Advanced Python Scheduler might be a solution for you.

https://github.com/agronholm/apscheduler

https://apscheduler.readthedocs.io/en/latest/

APScheduler can dynamically add jobs.

You can look my github example: https://github.com/easytrader/Apscheduler_for_django/blob/master/trips/views.py

about 4 years ago · Santiago Trujillo Relatório

0

There is django-celery-beat package which allows you to dynamicly add tasks to database and then they are executed as you defined in database.(e.g. every 5 minutes) But currently they have bug which causes that task is not appended to celery queue when added to database. One suggested workaround is to restart celery process every time that new task is added.
I solved it with Dan Baders schedule package. I scheduled task on every minute which checks database for tasks that need to be executed in current minute. Then I start each of this tasks in new thread.
Hope this helps.

about 4 years ago · Santiago Trujillo Relatório

0

A simple solution which will prevent using heavy AMQP stack, preventing external dependencies like Celery, One thing you can do is that you can write a custom management command,

python manage.py my_daily_cmd

If you are using windows use cron, if you are using windows use at or schtasks.exe,

with cron/at/schtasks.exe, you can run your my_daily_cmd at your desired time.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda