Learn R Programming

maestro

maestro is a lightweight framework for creating and orchestrating data pipelines in R. At its core, maestro is an R script scheduler that is unique in two ways:

  1. Stateless: It does not need to be continuously running - it can be run in a serverless architecture
  2. Use of rounded scheduling: The timeliness of pipeline executions depends on how often you run your orchestrator

In maestro you create pipelines (functions) and schedule them using roxygen2 tags - these are special comments (decorators) above each function. Then you create an orchestrator containing maestro functions for scheduling and invoking the pipelines.

Installation

maestro is available on CRAN and can be installed via:

install.packages("maestro")

Or, try out the development version via:

devtools::install_github("https://github.com/whipson/maestro")

Big Picture

maestro is a framework for orchestrating multiple pipelines. The picture below imagines multiple weather-based ingestion pipelines, managed by a single orchestrator.

Project Setup

A maestro project needs at least two components:

  1. A collection of R pipelines (functions) that you want to schedule
  2. A single orchestrator script that kicks off the scripts when they’re scheduled to run

The project file structure will look something like this:

sample_project
├── orchestrator.R
└── pipelines
    ├── satellite_imagery.R
    ├── temp_readings.R
    └── weather_bulletins.R

Use maestro::create_maestro() to easily create this project structure in a blank R project.

Orchestrator

The orchestrator is a script that checks the schedules of all the pipelines in a maestro project and executes them. The orchestrator also handles global execution tasks such as collecting logs and managing shared resources like global objects and custom functions.

You have the option of using Quarto, RMarkdown, or a straight-up R script for the orchestrator, but the former two have some advantages with respect to deployment on Posit Connect.

A simple orchestrator looks like this:

library(maestro)

schedule <- build_schedule()

output <- run_schedule(
  schedule, 
  orch_frequency = "15 minutes"
)

The function build_schedule() scours through all the pipelines in the project and builds a schedule. Then run_schedule() checks each pipeline’s scheduled time against the system time within some margin of rounding and calls those pipelines to run.

Pipelines

A pipeline is task we want to run. This task may involve retrieving data from a source, performing cleaning and computation on the data, then sending it to a destination. maestro is not concerned with what your pipeline does, but rather when you want to run it. Here’s a simple pipeline in maestro:

#' Example ETL pipeline
#' @maestroFrequency daily
#' @maestroStartTime 12:30:00
my_etl <- function() {
  
  # Pretend we're getting data from a source
  message("Get data")
  extracted <- mtcars
  
  # Transform
  message("Transforming")
  transformed <- extracted |> 
    dplyr::mutate(hp_deviation = hp - mean(hp))
  
  # Load - write to a location
  message("Writing")
  # write.csv(transformed, file = paste0("transformed_mtcars_", Sys.Date(), ".csv"))
}

What makes this a maestro pipeline is the use of special roxygen-style comments above the function definition:

  • #' @maestroFrequency daily indicates that this function should execute at a daily frequency.

  • #' @maestroStartTime 12:30:00 indicates that it runs at 12:30.

In other words, we’d expect it to run every day at 12:30. There are more maestro tags than these ones and all follow the camelCase convention established by roxygen2.

Copy Link

Version

Install

install.packages('maestro')

Monthly Downloads

470

Version

1.3.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Will Hipson

Last Published

August 31st, 2026

Functions in maestro (1.3.0)

get_network

Get the network structure of pipelines in a MaestroSchedule object
.run_sequence_days_out

Number of days ahead to generate run sequences for a given frequency unit Used by the observable get_run_sequence path.
get_flags

Get the flags of pipelines in a MaestroSchedule object
.run_sequence_min_days_out

Minimum days ahead to pre-compute run sequences on initialization This small window is used at parse time; the full window is built lazily when observability functions (get_run_sequence, get_slot_usage) are called.
get_artifacts

Get the artifacts (return values) of the pipelines in a MaestroSchedule object.
get_slot_usage

Get time slot usage of a schedule
get_run_sequence

Get the run sequence of a schedule
get_labels

Get the labels of pipelines in a MaestroSchedule object
get_schedule

Get the schedule from a MaestroSchedule object
last_run_errors

Retrieve latest maestro pipeline errors
invoke

Manually run a pipeline regardless of schedule
get_status

Get the statuses of the pipelines in a MaestroSchedule object
maestro_tags

Maestro Tags
last_run_messages

Retrieve latest maestro pipeline messages
maestro_parse_cli

cli output for generate schedule table
last_run_warnings

Retrieve latest maestro pipeline warnings
get_pipeline_run_sequence

Generate a sequence of run times for a pipeline
last_build_errors

Retrieve latest maestro build errors
maestro

maestro package
is_valid_dag

Checks whether a DAG is valid (no loops)
run_schedule

Run a schedule
parse_rounding_unit

Parse a time string
suggest_orch_frequency

Suggest orchestrator frequency based on a schedule
parse_maestro_start_time

Resolve a partial @maestroStartTime string to a concrete POSIXct
create_pipeline

Create a new pipeline in a pipelines directory
create_maestro

Creates a new maestro project
create_orchestrator

Create a new orchestrator
convert_to_seconds

Convert a duration string to number of seconds
build_schedule_entry

Parse and validate tags then create and populate MaestroPipelineList
.prev_on_cycle

Find the most recent cycle point before a given time
MaestroPipeline

Class for an individual maestro pipeline A pipeline is defined as a single R script with a schedule or input
MaestroPipelineList

Class for a list of MaestroPipelines A MaestroPipelineList is created when there are multiple maestro pipelines in a single script
MaestroSchedule

Class for a schedule of pipelines
build_schedule

Build a schedule