Skip to content

invoking pipeline programmatically #585

Closed Answered by wlandau
gofford asked this question in Help
Discussion options

You must be logged in to vote

I recommend other strategies such as batching, maybe multiple labels per target. Sketch with 10 reps within 10 batches:

# _targets.R
library(targets)
library(tarchetypes)
library(tibble)
list(
  tar_group_by(
    label_df,
    tibble(
      labels = sprintf("label%s", seq_len(100)),
      batch_id = rep(seq_len(10), each = 10)
    ),
    batch_id
  ),
  tar_target(
    per_batch,
    apply(label_df, 1, length), # Loop over the rows to do something for each label within batch.
    pattern = map(label_df) # One dynamic branch target per batch.
  )
)

As explained at https://books.ropensci.org/targets/practices.html#how-to-define-good-targets, there are tradeoffs in terms of how work is divid…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@wlandau
Comment options

@gofford
Comment options

@wlandau
Comment options

@wlandau
Comment options

@gofford
Comment options

Answer selected by gofford
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants