Scheduling Jupyter Notebooks at Meta

At Meta, Bento is our internal Jupyter notebooks platform that is leveraged by many internal users. Notebooks are also being used widely for creating reports and workflows (for example, performing …

Steve Dini
6 min readintermediate
--
View Original

Overview

The article discusses the implementation of scheduled Jupyter notebooks at Meta, focusing on the integration of Bento with the Dataswarm batch ETL pipeline framework. It highlights the challenges faced in scheduling notebooks, the design of the BentoOperator for privacy-aware execution, and the overall user workflow for scheduling notebooks.

What You'll Learn

1

How to integrate Jupyter notebooks with a batch ETL pipeline

2

Why privacy considerations are crucial in scheduling notebooks

3

How to utilize custom cells for data fetching in scheduled notebooks

Prerequisites & Requirements

  • Understanding of Jupyter notebooks and ETL processes
  • Familiarity with Meta's internal tools like Bento and Dataswarm(optional)

Key Questions Answered

How does Meta ensure privacy in scheduled notebook executions?
Meta integrates the BentoOperator within its data purpose framework, ensuring that data is used only for its intended purpose. This involves supplying a 'purpose policy zone' during notebook scheduling, which aligns with the privacy standards and regulations Meta adheres to.
What are the main components of scheduled notebooks at Meta?
The scheduled notebooks at Meta consist of a user interface for setting up schedules, a debugging interface for scheduled notebooks, and the BentoOperator, which integrates with Meta's internal scheduler to execute notebooks securely.
What challenges does Meta face with scheduled notebooks?
Meta faces challenges such as dynamic code content that complicates static analysis, the opaque nature of arbitrary code execution in production, and the need for thorough reviews before production deployment, particularly for notebooks with side effects.
How does the BentoOperator handle data fetching and writing?
The BentoOperator fetches data using structured custom cells, writes it to local CSV files, and then processes these files post-execution to upload data to the warehouse. This approach ensures that notebook execution occurs without network access, enhancing security.

Technologies & Tools

Frontend
Jupyter
Used as the platform for creating and executing notebooks at Meta.
Backend
Dataswarm
Serves as the batch ETL pipeline framework integrated with Bento for scheduling notebooks.
Frontend
Bento
Meta's internal Jupyter notebooks platform utilized for data analysis and reporting.

Key Actionable Insights

1
Implementing scheduled notebooks can significantly reduce manual workload and errors in data processing.
By automating the execution of Jupyter notebooks, teams can ensure that critical ETL processes run consistently without relying on manual intervention, which is particularly beneficial as the number of notebooks grows.
2
Utilizing a privacy-aware framework for data processing is essential for compliance and user trust.
Integrating privacy considerations into the scheduling process not only meets regulatory requirements but also builds confidence among users regarding data handling practices.
3
Custom cells in Jupyter notebooks can streamline data operations and enhance security.
By using custom cells for data fetching and writing, teams can ensure that sensitive data is handled securely and efficiently, minimizing the risk of exposure during notebook execution.

Common Pitfalls

1
Notebooks with arbitrary code can lead to opaque execution in production, making it difficult to track data lineage.
This occurs because dynamic content in notebooks complicates static analysis, which is essential for understanding how data flows through the system. To avoid this, limit scheduled notebooks to those performing ETL and data transformations.
2
Manual reviews of notebook code can be non-trivial and time-consuming.
Given the complexity of reviewing dynamic code, teams should establish clear guidelines and tools to facilitate efficient code reviews before notebooks are scheduled for production execution.