Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Ability to register tasks individually, not via modules

Aperta
#463 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
testing-qa

Direzione di ricerca

Inizia con i fixture esistenti default_worker_tasks e default_worker_app, quindi esamina come un’istanza di celery.Task viene registrata nel worker. Definisci il fixture register_task attorno all’API proposta e aggiungi una copertura che dimostri che un task registrato singolarmente può essere individuato ed eseguito dal worker.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

feature

Checklist

  • I have checked the issues list
    for similar or identical feature requests.
  • I have checked the pull requests list
    for existing proposed implementations of this feature.
  • I have checked the commit log
    to find out if the same feature was already implemented in the
    main branch.
  • I have included all related issues and possible duplicate issues in this issue
    (If there are none, check this box anyway).

Related Issues and Possible Duplicates

Related Issues
  • None
Possible Duplicates
  • None

Brief Summary

I am currently trying to build an abstraction over celery that would allow registering and running tasks.

However, my tests do not work because the worker doesn't find the tasks, and even using the default_worker_tasks doesn't work because the decorator used to define the tasks isn't the celery.Celery(...).task one, but a custom decorator that returns a custom Task class which completely abstracts celery away.

It would be very helpful to have a way to register tasks in the worker individually, by passing an instance of the celery.Task class to some fixture

Design

Have a fixture called something like register_task that would look like this


@pytest.fixture
def register_task():
    def _register(task: celery.Task):
         ...  # do something to register
     
     return _register

# in the test

@pytest.fixture
def register_test_tasks(default_worker_app, register_task):
     task = default_worker_app.task(some_callable, name="task_name"))
     register_task(task)
 

Proposed Behavior

The behaviour is simply being able to register tasks individually in the worker, by passing an instance of celery.Task the the fixture defined above.

Proposed UI/UX

Diagrams

N/A

Alternatives

None

Lingua principale
Python
Stelle
82
Fork
17
Merge medio
2g 6h
PR unite (30g)
26

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di celery/pytest-celery

Tutte le issue di celery/pytest-celery

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.