Learn Python with Talk Python's 270 hours of courses

Solving Negative Engineering Problems with Prefect

Episode #365, published Thu, May 12, 2022, recorded Mon, May 9, 2022

How much time do you spend solving negative engineering problems? And can a framework solve them for you? Think of negative engineering as things you do to avoid bad outcomes in software. At the lowest level, this can be writing good error handling with try / except. But it's broader than that: logging, observability (like Sentry tools), retries, failover (as in what you might get from Kubernetes), and so on. We have a great chat with Chris White about Prefect, a tool for data engineers and data scientists meaning to solve many of these problems automatically. But it's a conversation applicable to a broader software development community as well.

Watch this episode on YouTube
Play on YouTube
Watch the live stream version

Episode Deep Dive

Guests introduction and background

Chris White is a seasoned mathematician, data scientist, and backend engineer who helped found Prefect. Coming from a research and finance background (working in banks and academia), Chris spent years solving data engineering and data science problems across large organizations. As the CTO of Prefect, he and his team build open-source and commercial tools to help developers handle what they call “negative engineering” more effectively. In this episode, he shares his insights on automating and managing workflows in Python and beyond.

What to Know If You're New to Python

Below are a few recommendations and ideas from the conversation to help you get ready:

  • Understanding basic function usage, decorators (@something), and Python’s packaging is important to follow how Prefect’s decorators and tasks work.
  • Knowing about error handling with try/except will clarify how "negative engineering" is basically scaled-up defensive programming.
  • Becoming familiar with simple concurrency in Python (such as using async and await) will help you follow the discussion about distributing tasks efficiently.

Key points and takeaways

1) Negative Engineering Explained
Negative engineering refers to the extra code and processes you have to build just to avoid unwanted outcomes, rather than to achieve your primary goal. This includes retries, logging, error handling, observability, and more. Prefect is designed to reduce or eliminate this layer of code for data scientists, data engineers, and other Python developers. By explicitly naming these “defensive” tasks as negative engineering, developers can better pinpoint and automate them.

2) Data Engineering and Workflow Challenges
Data engineering involves moving, cleaning, and preparing data—often in diverse or distributed environments. Common pitfalls include job scheduling, error-prone data transfers, schema mismatches, and debugging ephemeral failures. Many organizations still rely on crontab or legacy scheduling tools, which can quietly fail and leave you with broken data pipelines. Addressing these pain points, Prefect handles dependencies, retries, and logging so engineers can focus on data rather than plumbing.

  • Links and tools:
    • Airflow (earlier workflow tool mentioned)
    • Luigi and Azkaban (legacy data pipeline orchestrators)

3) Prefect’s Approach to Negative Engineering
Prefect automatically handles issues such as task failures, retries, logging, caching, and alerts. Instead of rewriting the same defensive code, you simply apply Python decorators (like @task and @flow) to your existing functions. This gives you “invisible” negative engineering coverage so your code focuses on business logic. By bridging local development (on your laptop) with production-scale orchestration, Prefect reduces friction and unifies many scattered tasks under one system.

4) Prefect 1.0 vs. 2.0
Early Prefect used a context manager style (with Flow(...) as f:) to build a Directed Acyclic Graph (DAG). In Prefect 2.0, flows and tasks are defined purely with decorators, removing the need for a DAG-building context manager. This new approach is more flexible, allowing conditionals, loops, and dynamic code flow in plain Python. It also simplifies local development, automatically tying into the Prefect Cloud or an on-prem API if desired.

5) Async Capabilities and Modern Python
Prefect 2.0 adds robust support for Python’s async and await, enabling highly concurrent tasks—particularly for I/O-bound operations like API calls and database queries. Data engineers can drastically speed up tasks like extracting data from multiple APIs in parallel. Prefect takes care of the event loop complexities, letting you just write async def tasks as normal Python code.

  • Links and tools:
    • FastAPI (async web frameworks mentioned)
    • Celery (another Python background jobs library for comparison)

6) Open-Source Licensing and Business Model
Prefect is Apache 2.0 licensed, meaning developers can freely use and modify the core engine. The company’s commercial model is built around offering a managed cloud service, extra features (e.g., role-based permissions, enterprise support), and scaling. Chris explained that their revenue model is not about selling the code, but selling the service and support—crucially important for regulated industries and large-scale enterprise teams.

7) Bridging Local Development and Cloud Orchestration
A major insight from Prefect is that orchestration can be seen as metadata—where tasks live, how they connect, and how they’re scheduled. Prefect Cloud only deals with metadata; your real code and data can stay in private infrastructure. This “hybrid” approach is especially appealing to industries with strict data regulations and helps teams scale up from a local machine to large Kubernetes clusters without rewriting logic.

  • Links and tools:
    • Zapier (mentioned as a simpler “no-code” consumer-friendly orchestrator)
    • Prefect Cloud (managed service)

8) Incremental Adoption of Prefect
Chris described how you can start small, simply wrapping one Python function in a @flow decorator, while continuing to use your existing crontab or scheduler. Over time, you can move more tasks into Prefect, until it fully replaces your old scheduling or workflow systems. This approach keeps developer friction low and shows immediate value, rather than forcing a large-scale migration in one go.

9) Observability and Visibility
Prefect’s UI and dashboard give a visual overview of each flow’s runs, states, and logs. This single pane of glass makes diagnosing problems—like an out-of-memory error or an unexpected network blip—easier to track and fix. The UI is built so that if everything is going well, you barely need it. But when there is a problem, you can dive deep with logs and failure states at your fingertips.

  • Links and tools:

10) Building an Open-Source Community
Prefect invests in open-source across multiple fronts: sponsoring conferences, sending pizza to local user groups, and even investing in other open-source projects (like Textualize’s Rich and Textual). They also run a vibrant Slack community with thousands of members, plus a dedicated “Club 42” advocate program. All these efforts make the workflow and data orchestration community stronger while bringing more feedback into Prefect’s own ecosystem.

Interesting quotes and stories

“Negative engineering got this sentiment like it’s just anything I don’t want to do. Actually, it’s much more specific: it’s any code you write to ensure outcomes you already expect.” – Chris White

“You can literally add a single @flow decorator to your existing code and, in seconds, you’re getting all the reporting, logging, and reliability you didn’t even know you needed.” – Chris White

Key definitions and terms

  • Negative Engineering: The work done to avoid bad outcomes, such as error handling, retries, and logging, rather than focusing on the main objective of an application.
  • DAG (Directed Acyclic Graph): A structure many workflow tools create, where tasks are represented as nodes and dependencies as edges, ensuring no cycles.
  • Observability: The practice of collecting metrics and logs to diagnose and understand complex systems at runtime.
  • Flow (in Prefect): A container for tasks and their dependencies, capable of being scheduled, retried, and monitored.
  • Task (in Prefect): The smallest unit of work, usually a function, decorated to allow caching, retries, and advanced orchestration features.

Learning resources

Overall takeaway

Prefect aims to automate and minimize the “negative engineering” baggage that often accompanies data pipelines and complex workflows in Python. Through simple decorators, robust scheduling, and a hybrid on-prem-plus-cloud architecture, developers can focus on their core logic rather than endless scaffolding code. As Chris emphasizes, solving these pain points for data engineering and beyond is about leveraging tools that reduce repetitive defensive tasks and offer rich observability—ultimately freeing teams to spend more time on innovation and less time chasing errors.

Links from the show

Chris White: @markov_gainz
Prefect: prefect.io
Fermat's Enigma Book (mentioned by Michael): amazon.com
Prefect Docs (2.0): orion-docs.prefect.io
Prefect source code: github.com
A Brief History of Dataflow Automation: prefect.io/blog
Watch this episode on YouTube: youtube.com
Episode transcripts: talkpython.fm

--- Stay in touch with us ---
Subscribe to Talk Python on YouTube: youtube.com
Talk Python on Bluesky: @talkpython.fm at bsky.app
Talk Python on Mastodon: talkpython
Michael on Bluesky: @mkennedy.codes at bsky.app
Michael on Mastodon: mkennedy

Talk Python's Mastodon Michael Kennedy's Mastodon