library(metaflow)

start <- function(self){
    print("Starting flow...")
}

analysis <- function(self) {
    library(benchlingr)
}

end <- function(self){
    print("Done")
}

metaflow("Example_Flow") %>%
    step(step = "start",
         r_function = start,
         next_step = "analysis") %>%
    step(step = "analysis",
         r_function = analysis,
         next_step = "end") %>%
    step(step = "end",
         r_function = end) %>%
    run()

# Code above will return this:
# =======================================================
# Metaflow 2.3.0 executing Example_Flow for user:taylor
# Validating your flow...
#     The graph looks good!
# 2023-02-17 12:26:55.915 Workflow starting (run-id 1676636815882340):
# 2023-02-17 12:26:55.944 [1676636815882340/start/1 (pid 217126)] Task is starting.
# 2023-02-17 12:26:57.764 [1676636815882340/start/1 (pid 217126)] Error in python_config_impl(python) :
# 2023-02-17 12:26:57.765 [1676636815882340/start/1 (pid 217126)] Error 134 occurred running /home/taylor/Software/Benchling/venv/bin/python3:
# 2023-02-17 12:26:57.765 [1676636815882340/start/1 (pid 217126)] Calls: <Anonymous> ... py_discover_config -> python_config -> python_config_impl
# 2023-02-17 12:26:57.765 [1676636815882340/start/1 (pid 217126)] In addition: Warning message:
# 2023-02-17 12:26:57.766 [1676636815882340/start/1 (pid 217126)] In system2(command = python, args = shQuote(script), stdout = TRUE,  :
# 2023-02-17 12:26:57.796 [1676636815882340/start/1 (pid 217126)] running command ''/home/taylor/Software/Benchling/venv/bin/python3' '/home/taylor/R/x86_64-pc-linux-gnu-library/4.0/reticulate/config/config.py' 2>/dev/null' had status 134
# 2023-02-17 12:26:57.796 [1676636815882340/start/1 (pid 217126)] Execution halted
# 2023-02-17 12:26:57.797 [1676636815882340/start/1 (pid 217126)] Task failed.
# 2023-02-17 12:26:57.798 Workflow failed.
# 2023-02-17 12:26:57.798 Terminating 0 active tasks...
# 2023-02-17 12:26:57.799 Flushing logs...
#     Step failure:
#     Step start (task-id 1) failed.