🔥 Comfy-Org / workflow_templates - ComfyUI template workflows
GitHub热门项目 | ComfyUI template workflows | Stars: 710 | 9 stars today | 语言: Python
找到 1123 篇相关文章
GitHub热门项目 | ComfyUI template workflows | Stars: 710 | 9 stars today | 语言: Python
Originally published at Programming Tech Lab . Welcome to the Garage: What is Linear Regression? Step away from the kitchen counter and step into a bustling auto garage. Imagine you are an experienced mechanic evaluating used cars brought in for trade-ins. A customer drives in a sedan with 50,000 miles on the odometer and asks: "How much is my car worth?" Without needing a complex computer program, your brain instantly draws a connection: as the mileage on a car goes up, its resale price goes down. If a car has 0 miles (brand new), it commands peak market price. If it has 200,000 miles, it drops significantly toward scrap value. This straight-line relationship between two factors—where changes in one variable cause a predictable increase or decrease in another—is the core concept behind Linear Regression . Deconstructing the Formula (Without the Headache) In high school math, you probably saw the classic line equation: y = mx + b In machine learning, Linear Regression uses this exact same formula to make predictions: Predicted Value (y) = ( Slope m × Input Feature x ) + Starting Point b Let's map this directly to our mechanic's garage evaluation: Target (y): The estimated resale price of the car ($). Input Feature (x): The total miles on the odometer. Starting Point / Intercept (b): The price of the car when mileage is 0 (Brand New MSRP). Slope / Weight (m): The rate of depreciation (e.g., losing $0.10 in value for every 1 mile driven). If a car starts at a baseline price of $30,000 and depreciates by $0.10 per mile, a car with 50,000 miles is predicted to be worth: Predicted Price = $30,000 - ($0.10 × 50,000) = $25,000 How the Algorithm Draws the Perfect Line: Least Squares If you plot 100 used cars on a graph where the horizontal axis (X) is Mileage and the vertical axis (Y) is Price, the dots won't form a perfectly straight laser line. Some owners took great care of their vehicles; others had minor scratches. So how does a Linear Regression algorithm draw the sin
Hey everyone, it's your friendly neighborhood dev-dad here. Mid-thirties, full-time engineer by day, battling AI trading bots by night (weekends, really). Today, I want to share a subtle but potentially catastrophic bug I found in my bot. Seriously glad I caught this before deploying with real money. The symptom: Discord notifications for order fills just weren't arriving. The culprit: I forgot to load my .env variables consistently across multiple Python scripts. This is a super common pitfall when you're linking several Python scripts in a personal project, and it can be a real headache. What Happened: A "Silent Failure" Uncovered by a DRY_RUN Last weekend, I was running my usual DRY_RUN tests for my FX bot. My bot's logic is split into two main parts: planner.py , which strategizes trades, and executor.py , which actually sends orders to the exchange. The console logs looked perfectly normal. executor.py seemed to be doing its job: I saw messages like "[DRY_RUN] Order placed: ...". But the Discord notifications, which should have been firing, never appeared. At first, I thought it was a Discord outage or just a delay. But after 30 minutes, nothing. Something was definitely wrong. Thinking about what would have happened if this were real money sent shivers down my spine. "I thought I placed an order, but it never went through." "I thought I closed a position, but I was still holding it." Bugs in notification systems are terrifying because they create these silent failures. You think everything is okay, but it's not. This is precisely how real money gets lost. The Investigation: Unmasking the Culprit To narrow things down, I first tried calling notify.py (which handles all notifications) directly. It worked flawlessly; the Discord notification came through. This pointed to an issue within executor.py , which calls notify.py . I re-examined executor.py 's logs more carefully and immediately saw it: the webhook URL being passed to the notification function was None .
Hey everyone, it's your friendly neighborhood senior dev here. I'm 38, working as a full-time engineer during the week, and tinkering with AI-powered algorithmic trading bots on the weekends. Today, I want to share a story about a subtle but potentially catastrophic bug I found in my bot. Seriously, thank goodness I caught this before deploying with real capital. The TL;DR: My Discord notifications for order confirmations weren't firing, and the culprit was a forgotten .env load across multiple Python scripts. I think this is a pretty common pitfall when you're working on personal projects with several interconnected Python scripts. What Happened: A "Silent Failure" Uncovered by DRY_RUN Over the weekend, I was running my usual DRY_RUN tests for my forex bot. My bot's architecture splits responsibilities: planner.py handles strategy logic, and executor.py executes actual trades on the exchange. Looking at the console logs, executor.py seemed to be working perfectly. I saw logs like [DRY_RUN] Order placed: ... . But the Discord notifications, which are supposed to arrive after an order, simply weren't showing up. Initially, I thought it might be a Discord issue or just a delay. But after 30 minutes, still nothing. This felt wrong. The thought of this happening with real money sent shivers down my spine: "I thought I placed the order, but it never went through." "I was sure I closed that position, but it's still open." Bugs in notification systems are notorious for creating these kinds of silent failures, and they're genuinely scary. The Investigation: Aha! Found You... My first step was to isolate the problem. I directly invoked notify.py , the script responsible for sending notifications. It worked perfectly, sending a test message to Discord. This strongly suggested the issue was upstream, likely within executor.py , which calls notify.py . I took a closer look at executor.py 's logs. And there it was: the webhook URL, which should have been passed to the notificati
Use multimodal chat with a strict JSON schema when your policy needs explainable labels for uploaded images; otherwise reach for a managed, fixed-taxonomy service. There is no dedicated image moderation endpoint here, so the practical design is a policy prompt, a vision-capable chat model, schema validation, and a conservative fallback. That is my short answer. I would not ship the model's prose directly into an allow/block decision. I keep the original decision for audits, translate it into a small internal status, and make the eval set the release gate. The model is one component of the policy system — not the policy system itself. What should a Python image upload moderation example classify for NSFW and violence? The categories should come from the app's actual rules. For a general user-content product, I start with nudity, graphic violence, hate symbols, drugs, and minors-risk. I don't pretend those labels are universal: a medical forum and a marketplace need different thresholds, and a historical archive may legitimately show symbols that a profile-photo product should reject. My first notebook pass is deliberately boring. I assemble a small set of allowed, blocked, and ambiguous pictures; write the expected category labels; and record the policy reason in plain English. Then I run the same prompt and schema across every candidate model. The score I care about first is false negatives on the block set, followed by false positives on harmless uploads. Overall accuracy can hide both. This is also where a JSON schema earns its keep. A response containing "graphic_violence": "high" can be validated, stored, and compared. A paragraph such as “this appears concerning” can't reliably drive a queue or an appeal. Keep the provider response beside a normalized status such as allow , review , or block ; when policy changes, you can replay the raw decisions without migrating every old record. I learned the cost side the annoying way: one evaluation run consumed 18.7 milli
Is your snoring just a nuisance, or is it a health warning? Obstructive Sleep Apnea (OSA) affects nearly 1 billion people worldwide, yet most remain undiagnosed due to the high cost of clinical polysomnography. Today, we are pushing the boundaries of AI Healthcare by repurposing OpenAI Whisper from a speech-to-text powerhouse into a clinical screening tool. In this tutorial, we will explore how to leverage Audio Signal Processing , Hugging Face Transformers , and Librosa to detect breathing patterns. By fine-tuning Whisper on non-speech acoustic events, we can transform a standard smartphone recording into a high-precision OSA screening device. Pro-Tip : If you're looking for more production-ready examples and advanced architectural patterns for AI-driven health monitoring, be sure to check out the deep-dives over at WellAlly Tech Blog . The Architecture: From Raw Audio to Clinical Insight To build an OSA screening algorithm, we don't just need to hear the sounds; we need to understand the rhythm and absence of sound. We use Whisper's robust encoder to capture the spectral features and a custom classification head to identify Apnea-Hypopnea events. graph TD A[Raw Sleep Audio .wav] --> B[Preprocessing: Librosa] B --> C[Noise Reduction & VAD] C --> D[Segmenting: 30s Windows] D --> E[OpenAI Whisper Encoder] E --> F{Event Classification} F -->|Normal| G[Healthy Breathing] F -->|Snore| H[Snore Phase Analysis] F -->|Silence/Choke| I[Apnea Event Detected] I --> J[AHI Index Calculation] J --> K[Final OSA Risk Report] Prerequisites To follow this advanced guide, you'll need: Tech Stack : Python 3.9+, transformers , librosa , torch , and evaluate . Dataset : Ideally, the UCD Snore Database or similar PSG-synchronized audio data. Step 1: Audio Preprocessing with Librosa Before feeding audio into Whisper, we need to clean the signal. Sleep environments are noisy (fans, traffic, etc.). We use librosa to normalize the audio and detect "Voice" (or in our case, Breath) Activity. im
I built a debugging-practice site where student code runs entirely in the browser . Python via Pyodide , JavaScript in a worker. No server executes anything. No execution bill, no queue, no sandbox to maintain. But four things bit me hard. 1. Your arguments aren't Python objects Pass a JS object into Python and you get this: TypeError: 'pyodide.ffi.JsProxy' object is not subscriptable It's not a dict . It's a live view of the JS object, and it supports neither obj[key] nor .get() . Convert explicitly: const pyArgs = input . map (( arg ) => pyodide . toPy ( arg )); const result = fn (... pyArgs ); 2. null is not None This one passed my entire test suite while being broken in production. pyodide . toPy ( null ) check result type(v) JsNull bool(v) False ✅ falsy, as expected v is None False ❌ the surprise It's falsy, so truthiness checks work fine. But is None fails — which was exactly what my code was checking. Why my tests missed it: the harness used json.loads . The app used toPy . Different conversion paths, different answers. If you need a real None , create it in Python. Don't pass one across. 3. sys.settrace is a free step debugger Want to show users their code running line by line? Python basically hands it to you: def _tracer ( frame , event , arg ): if frame . f_code . co_name != target : return None # skip library frames if event == " line " : steps . append ({ " line " : frame . f_lineno , " locals " : dict ( frame . f_locals ), }) return _tracer Two things this naive version gets wrong: Add a step cap. A tight loop generates steps faster than it burns a 5-second timeout. You need both guards. Handle exception . During unwinding, the return event still fires with arg=None . Miss it and your trace says "returned None" for code that crashed. 4. Your snapshots are lying A user screenshot exposed this one. Every step in the trace showed the final state of a list. Step 1 included mutations that hadn't happened yet. tracing: nums = []; nums.append(1); nums.append(
Hay muchísimo escrito sobre qué tiene que reportar una organización: guías de Supersalud, de Supersociedades, de SAGRILAFT, de PTEE, de SST, de reportes ambientales. Todas contestan la misma pregunta — ¿qué me aplica? — y la contestan bien. Casi nadie escribe sobre la pregunta que de verdad hace fallar a las organizaciones: ¿cómo no perder ninguno, todos los años, cuando son treinta? Porque los incumplimientos que he visto de cerca casi nunca vienen de que alguien ignorara la obligación. Vienen de que la obligación se conocía perfectamente y aun así se pasó la fecha. Este artículo va del problema operativo —fechas, evidencia, responsables— no de cuáles normas le aplican a su entidad. Eso es otra conversación, y no es esta. Por qué el archivo de Excel deja de servir Con tres obligaciones, una hoja de cálculo sobra. El dolor no empieza por el número: empieza cuando el calendario hay que derivarlo . 1. Las fechas no son fechas, son reglas. Muchos vencimientos no están escritos como un día del calendario: dependen del último dígito del NIT, de días hábiles, o de un plazo contado desde un hecho. Eso significa que alguien recalcula el calendario entero cada año, a mano . Cada enero se reintroduce la misma oportunidad de equivocarse, y basta con un festivo mal contado. 2. El calendario vive en una persona. Casi siempre hay alguien que "sabe cómo es la cosa". Mientras esté, funciona. Cuando se va de vacaciones —o se va de la empresa— se va con ella el contexto que nunca estuvo escrito. La hoja sobrevive; el criterio para llenarla, no. 3. La hoja dice que se entregó, no lo prueba. La celda en verde es una afirmación de alguien. La evidencia real —el radicado, el archivo exacto que se subió, la hora— está en el correo de alguien. El día que hay que demostrarlo, empieza la arqueología en bandejas de entrada. 4. Los terceros que le reportan a usted. Si recibe información de contratistas, sedes o filiales, ahora administra dos problemas: sus propios vencimientos y los de ellos.
Most of the validation work on vaas-x so far had been industrial sensor data — turbofans, machine telemetry. I wanted to know if the same zero-config channel classifier actually transfers to a completely different domain: a wearable IMU strapped to a moving human. No feature engineering, no per-sport tuning, no hints about what any channel means. I'm writing this one up slightly differently than my other posts, because the first version of this test gave me a wrong answer, and I think the reason it was wrong is more useful than the result itself. The dataset UCI's Daily and Sports Activities set (Altun, Barshan & Tunçel, 2010): 8 subjects, each wearing five Xsens IMU units — torso, both arms, both legs — 9 axes per unit (accelerometer, gyroscope, magnetometer × x/y/z), sampled at 25Hz. 45 channels total. It includes both a sedentary activity (sitting) and dynamic sport activities (basketball, rowing), which gives a clean, checkable question: does a classifier that's never seen this data correctly tell apart "person sitting still" from "person playing basketball," using channel statistics alone? import pandas as pd # Mirrored subset: github.com/AniMadurkar/Daily-Activities-and-Sports-Biomechanics-Analysis df = pd . read_csv ( " sports_science_dataset_subset.csv " ) channels = [ c for c in df . columns if c not in ( " subject " , " activity " , " timestamp " )] print ( len ( channels ), " channels " ) # 45 First attempt — and the mistake My first pass pooled all 8 subjects together per activity and ran it through the profiler in one shot. The result came back backwards: sitting showed up with more "significant" channels than basketball. That's not just unexpected, it's physically nonsensical — a person sitting still should be one of the lowest-variance activities in the entire dataset. The bug wasn't in the classifier. It was in the test. Pooling subjects together means each subject's own sensor baseline and IMU orientation differences get mixed into the between-subje
Almost every tool-governance layer I have looked at writes its log after the call returns. Some write it in a finally . Some batch it. Some hand it to a logging framework that flushes on its own schedule. That ordering quietly decides what your log can be used for. If the record is written after the body runs, then a record that is missing has two possible explanations, and nothing in the file distinguishes them: The call was never authorised, so it never ran. The call was authorised, ran, did its work, and the process died before the log line reached disk. Those are not close together. One is the control working. The other is an unlogged deletion. When someone asks you six weeks later what your agent was permitted to do at 03:14, "there is no line for it" answers nothing. So I wrote a small library that inverts the order. obstat obstat is an auditable decision record for agent tool calls. Nihil obstat — nothing stands in the way — was the formal clearance a censor granted in writing, before publication . That is the whole idea. from obstat import guard @guard ( resource = " doc:{doc_id} " ) def delete_document ( doc_id : str ) -> str : ... An agent asks to do something, a rule decides, and the decision goes to disk — written and fsync ed — before the tool body executes. If the process dies mid-call, the record still says what was authorised, for whom, against which resource, and why. record.decision() returns only after the fsync returns. Not flushed after, not deferred, not batched. Everything else in the library is convenience; this is the part an examiner relies on. The claim has a test, not a paragraph An architectural promise nobody can falsify is marketing. This one is checked by reading the log from inside the tool body — the one place where anything buffered, deferred, or written afterwards is invisible: def test_record_is_durable_before_the_body_runs ( workspace ): workspace ( ALLOW_ALL ) seen : dict [ str , list ] = {} @guard () def read_thing ( what : st
GitHub热门项目 | The OWASP Cheat Sheet Series was created to provide a concise collection of high value information on specific application security topics. | Stars: 32,791 | 111 stars this week | 语言: Python
GitHub热门项目 | ❄️ Firmware and simulator for Coldcard Hardware Wallet | Stars: 747 | 11 stars today | 语言: Python
GitHub热门项目 | Lightweight loop engineering state kernel for long-running AI agent teams. Agent-loop agnostic across Codex, Claude Code, and other coding agents, with durable goals, quota-aware auto-wake, executable todos, evidence logs, and verifiable handoffs. | Stars: 1,436 | 618 stars today | 语言: Python
GitHub热门项目 | ADR secures enterprise AI agents through observability, security benchmarking, and threat detection. Deployed at Uber. | Stars: 534 | 140 stars today | 语言: Python
Vista previa técnica: Iter todavía no está publicado en PyPI y no existe un paquete oficial instalable. Abrir un recurso, convertir datos o cambiar de backend suele exigir aprender una interfaz diferente y repetir código de integración. Iter nace de una idea sencilla: Aprende una vez. Usa cualquier biblioteca. iter convert data.json to data.csv El usuario expresa una sola intención. Iter se encarga de abrir el recurso, detectar los formatos, seleccionar un adaptador compatible, convertir los datos y guardar el resultado. Una intención. Una instrucción. ¿Qué busca cambiar Iter? Actualmente, una tarea sencilla puede exigir: importar bibliotecas; aprender APIs diferentes; configurar formatos manualmente; escribir código de integración; seleccionar cada backend. Con Iter, el usuario indica principalmente qué quiere conseguir: iter analyze sales.csv Iter selecciona automáticamente una herramienta compatible. Si el usuario necesita controlar la biblioteca, puede indicarla: iter analyze sales.csv with pandas La automatización es el comportamiento predeterminado. El control detallado sigue siendo opcional. Everything is a Resource Iter representa archivos, datos y recursos web mediante una estructura común llamada Resource . El sistema está organizado alrededor de cinco componentes: Resource : representa el recurso. Resolver : identifica formatos, tipos y backends. Registry : registra y selecciona adaptadores. Adapter : ejecuta operaciones concretas. Engine : coordina el proceso. La meta no es afirmar que todas las bibliotecas son idénticas. La meta es unificar intenciones comunes y conservar las diferencias importantes cuando sean necesarias. Estado actual Iter 0.3.0-rc.2 está en fase de corrección de errores y validación privada. Actualmente: el código principal permanece privado; Iter todavía no está publicado en PyPI; no existe un paquete demostrativo; la sintaxis puede ajustarse antes del lanzamiento; solamente se anunciarán como disponibles las funciones implementadas
Pandas is an open-source library for data analysis and manipulation in Python. It provides fast, flexible and expressive data structures for working with relational and labelled data. Originally developed by Wes McKinney in 2008, it has become a foundational tool in modern data science and serves as a highly programmable analogue to spreadsheet software. Key characteristics NumPy foundation: Built on top of NumPy, it inherits highly optimised, array-based computational performance. Label-driven alignment: Data are automatically aligned according to explicit row and column labels, thereby improving the reliability of calculations involving partially mismatched datasets. Heterogeneous typing: Unlike strict numerical arrays, Pandas can accommodate mixed data types, including integers, strings, floats and booleans, within a single tabular structure. Missing-data resilience: It provides native support for detecting, representing and handling missing values, such as NaN. Core data structures Series: A one-dimensional labelled array capable of holding any data type. In practical terms, it resembles a single column in a spreadsheet. DataFrame: A two-dimensional tabular data structure with labelled rows and columns. It may be regarded as a collection of Series sharing a common index, analogous to a table in SQL or a worksheet in Excel. Core features and capabilities Robust input/output parsing: Pandas supports efficient reading and writing across multiple formats, including CSV, Excel, SQL databases, JSON and Parquet. Advanced data cleaning: Built-in methods enable users to identify, filter and remove duplicates, and to impute missing values. Flexible wrangling and reshaping: The library facilitates pivoting, melting, slicing and subsetting operations based on conditional logic. High-performance merging: Relational operations such as inner, outer, left and right joins, as well as concatenation, can be executed in concise code. Split-apply-combine (GroupBy): Data may be group
NumPy (Numerical Python) is a foundational open-source Python library for numerical and mathematical computation. It introduces the N-dimensional array ( ndarray ), a high-performance data structure for storing and manipulating large datasets efficiently. NumPy forms the computational foundation of the Python data-science ecosystem; major libraries such as Pandas, SciPy, scikit-learn, and TensorFlow build directly upon it. This tutorial is designed to provide a concise yet practical overview of NumPy and to support day-to-day technical work through clear, task-oriented examples. Key characteristics High performance: NumPy operations are implemented in highly optimised C, enabling many numerical workloads to run substantially faster than equivalent operations on standard Python lists. Vectorisation: NumPy reduces reliance on explicit Python loops by applying operations across entire arrays in a single expression. Memory efficiency: NumPy arrays store homogeneous data in contiguous memory blocks, typically reducing memory overhead relative to Python lists. Core features and capabilities NumPy provides a broad suite of tools for numerical computation, including: Multidimensional arrays: Creation and manipulation of 1D vectors, 2D matrices, and higher-dimensional structures. Broadcasting: Arithmetic operations between arrays of different, but compatible, shapes. Linear algebra: Built-in routines for matrix multiplication, determinants, inverses, and systems of linear equations. Random number generation: Utilities for generating random samples from common statistical distributions. Mathematical functions: Fast element-wise operations for trigonometric, logarithmic, exponential, and statistical calculations (for example, mean, median, and standard deviation). Python lists vs NumPy ndarrays Python lists can store heterogeneous data types (for example, strings, integers, and objects) in a single container. This flexibility is useful, but lists are comparatively inefficient
Part 1 : Understanding Token Economics, Hidden Costs, and the Fundamentals Every AI Engineer Must Know Table of Contents Introduction Why Token Cost Optimization Matters More Than Ever Understanding What a Token Really Is How LLM Providers Charge for Tokens Input Tokens vs Output Tokens Why "Cheap Prompts" Can Become Expensive Hidden Sources of Token Costs The Real Cost of Production AI Systems How Token Costs Scale with Users The Cost Optimization Mindset Key Takeaways Introduction If you have ever built an AI application using GPT, Claude, Gemini, Llama, or another large language model, you've probably celebrated the moment your first prompt worked. The model answered intelligently, users loved the experience, and everything seemed perfect. Then came the cloud bill. What initially looked inexpensive suddenly became one of the largest operational costs in your application. Many developers assume AI infrastructure is expensive because of GPUs. Surprisingly, for many production applications, tokens—not GPUs—become the biggest recurring expense . Every prompt, every response, every retrieved document, every conversation history, and every AI agent interaction consumes tokens. Those tokens translate directly into cost. Imagine building an AI customer support chatbot. It serves 500 users during testing, and costs seem negligible. After launch, the application attracts 50,000 daily users. Each interaction now includes system prompts, conversation history, retrieved documents, tool outputs, and generated responses. Without careful optimization, token usage grows exponentially—and so does your bill. This is why token cost optimization is no longer just a performance concern. It has become a core engineering discipline. Just as software engineers optimize CPU and memory, AI engineers must optimize tokens. This guide is designed to help you understand the economics behind token usage before diving into optimization techniques. By mastering these fundamentals, you'll be able
In an era where privacy is the ultimate luxury, our most sensitive data—heart rates, sleep cycles, and activity levels—is often shipped off to black-box cloud servers for "analysis." But what if you could keep that data strictly on your local machine? Today, we are building a Private Health Brain . By leveraging the MLX framework (Apple's dedicated machine learning library) and Llama-3 , we will transform raw XML exports from Apple HealthKit into actionable health insights—all running locally on your MacBook. We’ll cover everything from parsing messy XML with Pandas to running high-performance local AI inference without an internet connection. If you are interested in privacy-preserving AI , Edge computing , or just want to squeeze every bit of power out of your Apple Silicon chip, this guide is for you. The Architecture: Local Data Flow To ensure 100% privacy, the data never leaves your local environment. Here is how the pipeline works: graph TD A[Apple Health Export.zip] -->|Extract| B(export.xml) B -->|Python + Pandas| C{Data Cleaning} C -->|Structured JSON/CSV| D[Local Context Window] E[MLX Framework] -->|Load Weights| F[Llama-3 Model] D -->|RAG / Prompt Injection| G[Inference Engine] F --> G G -->|Result| H[Private Health Insights] style H fill:#f96,stroke:#333,stroke-width:2px Prerequisites 🛠️ Before we dive in, ensure you have an Apple Silicon (M1/M2/M3) Mac . MLX : Apple’s framework for machine learning on Apple Silicon. Llama-3 : We’ll use the 8B-Instruct version for a balance of speed and intelligence. Python 3.10+ Pandas : For data manipulation. Install the necessary libraries: pip install mlx-lm pandas lxml Step 1: Parsing the HealthKit XML Monster Apple Health exports data in a massive export.xml file. It’s nested, verbose, and a nightmare to read manually. We’ll use Python to extract specific metrics like Step Count or Heart Rate Variablity (HRV) . import pandas as pd import xml.etree.ElementTree as ET def parse_health_data ( xml_path ): print ( " 🚀 Pa
The first time we deployed Celery to production on a client project, we thought we had done everything right. We had workers running, tasks queuing, and Redis as the broker. Six weeks later, the task queue was backed up with 40,000 unprocessed jobs, the workers had silently died, nobody knew, and a batch of client invoices had not been generated for two weeks. That was four years ago. Since then we have deployed Celery on dozens of projects and we have learned what actually goes wrong — not in development, where everything works, but in production, where things fail in ways you do not anticipate. This post covers the configuration and operational patterns we now use on every Celery deployment. Why tasks fail silently (and how to stop it) The most dangerous thing about Celery is how quietly it can fail. A worker process dies, the task queue fills up, and your application keeps accepting work and sending it to a queue that nobody is processing. No exception is raised. No alert fires. Users notice eventually, or you notice when a daily report does not arrive. The fix has two parts: monitoring and task acknowledgement configuration. Task acknowledgement By default, Celery acknowledges a task (removes it from the queue) as soon as a worker picks it up, before the task runs. If the worker dies mid-task, the task is lost. # celery.py app = Celery ( ' myproject ' ) app . conf . update ( # Only acknowledge after the task completes successfully task_acks_late = True , # If a worker dies, reject the task back to the queue task_reject_on_worker_lost = True , # Limit memory — workers that leak memory will restart cleanly worker_max_memory_per_child = 200_000 , # 200MB in KB # Limit tasks per child process to prevent long-running workers # from accumulating state worker_max_tasks_per_child = 1000 , ) With task_acks_late=True , a task that is picked up by a dying worker will be requeued and picked up by another worker. The task might run twice (more on that shortly), but it will n