PyData Amsterdam 2025

Resource Monitoring and Optimization with Metaflow
2025-09-26 , Nebula

Metaflow is a powerful workflow management framework for data science, but optimizing its cloud resource usage still involves guesswork. We have extended Metaflow with a lightweight resource tracking tool that automatically monitors CPU, memory, GPU, and more, then recommends the most cost-effective cloud instance type for future runs. A single line of code can save you from overprovisioned costs or painful job failures!


Metaflow empowers data scientists with reproducible workflows, versioned artifacts, and scalable executions on AWS Batch or Kubernetes. While data scientists can request CPU, memory, etc. with the @resources Python decorator, Metaflow doesn't track what's actually tracked at runtime -- leading to overprovisioning, wasted money, or job that crash due to underestimated memory/GPU constraints.

We built the @track_resources decorator to address this, which automatically profiles CPU, memory, GPU, VRAM, traffic, storage, and I/O usage at both the process-level and system-wide for each workflow step, whether running locally or in the cloud.

With zero-effort and zero dependencies, this tool:
- Auto-generates Metaflow Cards with temporal resource charts, per-instance-type cost projections, and cloud server recommendations.
- Provides actionable insights for optimizing resource allocation.
- Requires just a single line of code to integrate.

Check it out on GitHub: https://github.com/SpareCores/resource-tracker

Gergely Daroczi, PhD, is a passionate R/Python user and package developer for two decades. With over 15 years in the industry, he has expertise in data science, engineering, cloud infrastructure, and data operations across SaaS, fintech, adtech, and healthtech startups in California and Hungary, focusing on building scalable data platforms. Gergely maintains a dozen open-source R and Python projects and organizes a tech meetup with 1,800 members in Hungary – along with other open-source and data conferences.