What do chain, group, and chord express?
Simple meaning
chain runs tasks sequentially, passing return values forward.
Open the full page for Why, Steps, Example and Key takeaway.
Panel-ready Python & Django questions for freshers and experienced developers. Practice at Coding Cadre in Faridabad, or Online from Delhi NCR.
chain runs tasks sequentially, passing return values forward.
Open the full page for Why, Steps, Example and Key takeaway.
prefork (default) uses processes and is the safe choice for CPU and for C extensions that are not greenlet-safe.
Open the full page for Why, Steps, Example and Key takeaway.
Cap retries, catch expected exceptions, and route failures to a dead-letter queue or an error table.
Open the full page for Why, Steps, Example and Key takeaway.
A stampede is many requests missing the same expired key and all recomputing it at once.
Open the full page for Why, Steps, Example and Key takeaway.
Prefer versioned keys or a per-object cache generation stored on the model or in Redis so you bump a number instead of scanning keys.
Open the full page for Why, Steps, Example and Key takeaway.
UpdateCacheMiddleware/FetchFromCacheMiddleware store responses keyed by path plus the Vary-derived header values.
Open the full page for Why, Steps, Example and Key takeaway.
Use the cache framework for pickled Python objects with timeouts.
Open the full page for Why, Steps, Example and Key takeaway.
SimpleTestCase has no database and is for pure units and request factory tests that mock the ORM.
Open the full page for Why, Steps, Example and Key takeaway.
Set CELERY_TASK_ALWAYS_EAGER (or the modern task_always_eager) in test settings so delay() runs in-process.
Open the full page for Why, Steps, Example and Key takeaway.
@pytest.mark.django_db requests a test database and transaction rollback by default.
Open the full page for Why, Steps, Example and Key takeaway.
CPython's pymalloc arenas allocate many small objects itself and may not return that memory to the OS after frees.
Open the full page for Why, Steps, Example and Key takeaway.
Start tracemalloc early, snapshot before and after a request batch, and compare top statistics by traceback.
Open the full page for Why, Steps, Example and Key takeaway.
Evaluating a queryset stores the result list on the queryset object.
Open the full page for Why, Steps, Example and Key takeaway.
weakref.WeakValueDictionary drops entries when no strong references remain, so a memoizer does not pin models forever.
Open the full page for Why, Steps, Example and Key takeaway.
__getattribute__ runs on every attribute access and is easy to recurse infinitely if you are not careful
Open the full page for Why, Steps, Example and Key takeaway.
For a + b, Python tries a.__add__(b)
Open the full page for Why, Steps, Example and Key takeaway.
tee buffers items that one branch has consumed but the other has not, which can grow to the full stream.
Open the full page for Why, Steps, Example and Key takeaway.
They are lazy, so constructing the iterator looks cheap, but iterating can explode combinatorially and hang a worker.
Open the full page for Why, Steps, Example and Key takeaway.
Default ORM calls are blocking and must not run on the event loop.
Open the full page for Why, Steps, Example and Key takeaway.
gather can return exceptions if return_exceptions=True, otherwise the first exception fails the gather while sibling tasks may keep running unless you cancel them.
Open the full page for Why, Steps, Example and Key takeaway.