Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 5 min read Case study mediumAdept

Scheduling Jupyter Notebooks at Meta

Meta schedules Bento (Jupyter) notebooks through a custom Dataswarm operator, BentoOperator, which keeps data lineage visible and privacy enforced even though notebook code is arbitrary. Structured SQL and upload cells are executed by transparent Dataswarm operators outside the notebook and swapped for pandas read_csv/to_csv calls. This lets the notebook itself run in a network-isolated ephemeral container, after which the outputs are uploaded to the warehouse. Scheduling is limited to ETL and analysis notebooks without other side effects, tied to a purpose policy zone, and goes through code review with the notebook checked into source control. Planned work covers more data sources, parameterized notebooks and event-based scheduling.

Assumes: Jupyter notebooksAirflow-style ETL pipelinesdata lineage

Related posts

  • SQL Notebooks: Combining the power of Jupyter and SQL editors for data analytics

    Meta Engineering mediumAdept

    Meta's SQL Notebooks extends its Daiquery SQL editor with notebook-style named cells that reference each other as tables, compiling dependent cells into self-contained CTE queries run on distributed backends like Presto and Spark rather than on a local machine. Sandboxed Python cells can post-process upstream SQL outputs as Pandas dataframes but cannot fetch data themselves. Because SQL can be statically checked against table and column ACLs, cached outputs are only shown to users who could have run the queries, so results can be shared safely and refreshed by scheduled jobs to avoid staleness. Jupyter-based notebooks (Bento) remain better for ML and service-API work, and the two tools are being merged.

  • Serverless Jupyter Notebooks at Meta

    Meta Engineering mediumAdept

    Meta's Bento notebook platform now runs "lite" workloads directly in the browser using Pyodide on WebAssembly, skipping the slow remote-compute reservation step. A kernel bridge lets the Pyodide kernel speak the Jupyter protocol like server kernels, a web worker keeps expensive kernel operations off the main thread, and middleware intercepts cell magics (%%sql, %%googlesheet, %%graphql, %%dataframe) in JavaScript and injects their results into the Python kernel. Uploads are handed off to async Tupperware jobs. The main limitation is that internal libraries not ported to Wasm are unavailable. Planned work includes auto-detecting lite workloads and falling back to server kernels when needed.

  • Data logs: The latest evolution in Meta’s access tools

    Meta Engineering mediumAdept

    Meta serves per-user data logs from its Hive data warehouse, which cannot handle per-user point queries, by batching many Download Your Information requests into one full-table scan. A scheduled job collects recent requests into a batch run on the Core Workflow Service. It writes the requester IDs to a Hive table, then runs per-table and per-partition Dataswarm jobs that INNER JOIN against each table's owner column. PySpark splits the results into per-user files, and a Hack post-processing step applies privacy filters and renders readable HTML. Lessons include checkpointing for resilience against out-of-memory and timeout failures, a user-ID verification step added after a Spark partitioning bug nearly returned data to the wrong user, and an experimentation platform for testing workflow changes.

  • Run GPU jobs from Airflow with Modal

    Modal mediumAdept

    Airflow DAGs can offload GPU-heavy tasks to Modal instead of standing up Celery or Kubernetes executors, using a two-step pipeline that scrapes Reddit ELI5 questions and answers them with an LLM as the example. One approach deploys Modal Functions separately and calls them from Airflow tasks via Function.from_name and remote(), passing intermediate data through a Modal Dict (10GB limit versus roughly 1GB for XComs on Postgres) or a Volume. The other defines a custom ModalOperator that serializes a Python function's source and runs it in a Modal Sandbox with a runtime-defined image, secrets, volumes and GPUs. Either way, task environments stay isolated from the Airflow environment without building Docker images for KubernetesPodOperator.

  • Policy Zones: How Meta enforces purpose limitation at scale in batch processing systems

    Meta Engineering mediumAdept

    Meta's Policy Zones, part of its Privacy Aware Infrastructure, applies information flow control to enforce purpose limitation across an exabyte-scale data warehouse. Datasets and loggers carry Governable Data Annotations such as MESSAGING_DATA, and downstream data must be at least as restrictive as its sources. A SQL parser (UPM) turns queries from processors like Presto into semantic trees. A Policy Evaluation Service checks each flow and issues a cryptographically signed token that the Warehouse Permission Service validates at access time. Policy Zone Manager tooling handles label creep through reclassification, letting the system run across millions of datasets, tens of millions of daily flows and trillions of consent checks per hour.

The quest for software engineering knowledge.

Look:
Layout: