Spinner: The Mass Migration to Pinterest’s New Workflow Platform

Pinterest Engineering
18 min readintermediate
--
View Original

Overview

The article discusses Pinterest's migration from its legacy workflow system, Pinball, to a new platform called Spinner, built on Apache Airflow. It outlines the design, challenges, and strategies involved in migrating over 3000 workflows, emphasizing the importance of user communication, migration tooling, and system health monitoring.

What You'll Learn

1

How to effectively migrate workflows from a legacy system to Apache Airflow

2

Why user communication and onboarding materials are crucial during migration

3

How to implement a migration layer that translates legacy workflows into Airflow DAGs

4

When to utilize Kubernetes for scalable workflow execution

Prerequisites & Requirements

  • Understanding of Apache Airflow and workflow management systems
  • Familiarity with Kubernetes and CI/CD pipelines(optional)

Key Questions Answered

How did Pinterest manage the migration of over 3000 workflows to Airflow?
Pinterest managed the migration by developing a migration layer that translates legacy workflow definitions into Airflow Directed Acyclic Graphs (DAGs) without requiring user code changes. This approach minimized user involvement and ensured a seamless transition while maintaining the execution environment of the legacy system.
What are the key challenges faced during the migration process?
Key challenges included aligning the scheduling mechanisms between the old and new systems, managing resource provisioning for tasks, and addressing the Kubernetes pod warm-up costs. The team also had to ensure continuous user support and education throughout the migration.
What role does the PinterestDagBag play in the migration?
The PinterestDagBag is a custom class that parses migration metadata files instead of traditional Python DAG files. It retrieves workflow definitions from the legacy system's Token Fetcher and translates them into native Airflow DAGs, facilitating a smooth migration process.
How does Pinterest ensure the health of the migrated workflows?
Pinterest maintains health checks and comprehensive metrics with alerting mechanisms to monitor the performance of migrated workflows. This approach helps fine-tune the system as loads increase and ensures that the service level objectives (SLOs) are met.

Key Statistics & Figures

Number of workflows migrated
3000+
This figure highlights the scale of the migration effort undertaken by Pinterest.
Uptime target for the system
98%
This target is set to ensure that the migrated workflows maintain high availability and reliability.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Key Actionable Insights

1
Implement a migration layer to facilitate seamless transitions from legacy systems to modern platforms like Apache Airflow.
This approach minimizes user disruption and leverages existing infrastructure, allowing for a smoother transition and reduced tech debt.
2
Prioritize user communication and provide comprehensive onboarding materials during migration.
Clear communication helps users understand changes and reduces resistance, ensuring a more successful adoption of the new system.
3
Utilize Kubernetes for scalable and isolated execution of workflows.
Kubernetes allows for efficient resource management and scaling, which is essential for handling increased workloads during migration.

Common Pitfalls

1
Failing to align scheduling mechanisms between the legacy and new systems can lead to missed or overlapping runs.
It's crucial to understand the differences in how each system defines and manages schedules to prevent operational issues during and after migration.
2
Underestimating the resource requirements for migrated tasks can lead to failures during execution.
Proper resource allocation is essential to ensure that tasks have the necessary memory and compute power to run successfully in the new environment.

Related Concepts

Workflow Management Systems
Container Orchestration With Kubernetes
CI/CD Pipelines And Their Role In Deployment