View source: R/create_task_makefile.R
| create_task_makefile | R Documentation | 
Create a .yml makefile (for use with remake or scipiper) for a set of tasks
that together form a single job.  The default target will be named after
makefile (specifically,
indicatorfile=tools::file_path_sans_ext(basename(makefile))) and can be
evoked from another remake file as
make(I('indicatorfile'),remake_file='thismakefile.yml') after replacing
indicatorfile and thismakefile.yml with their values.
create_task_makefile(
  task_plan,
  makefile,
  include = c(),
  packages = "scipiper",
  sources = c(),
  file_extensions = c("ind"),
  template_file = system.file("extdata/task_makefile.mustache", package = "scipiper"),
  final_targets,
  finalize_funs = "combine_to_ind",
  as_promises = TRUE,
  tickquote_combinee_objects = TRUE
)
task_plan | 
 a task plan as produced by   | 
makefile | 
 character name of the remake file to create  | 
include | 
 character vector of any remake .yml files to include within
this one. If any files must be quoted in the remake file, quote them with
inner single quotes, e.g.   | 
packages | 
 character vector of any packages to load before running steps  | 
sources | 
 character vector of any files that should be sourced before
running steps. If any files must be quoted in the remake file, quote them
with inner single quotes, e.g.   | 
file_extensions | 
 character vector of file extensions to be added to the
defaults at   | 
template_file | 
 character name of the mustache template to render into
  | 
final_targets | 
 a file path or object name (or vector of either) specifying final target(s)
to be created by   | 
finalize_funs | 
 a string function name (or vector of function names, of equal
length to   | 
as_promises | 
 hides the actual   | 
tickquote_combinee_objects | 
 TRUE by default  | 
the file name of the makefile that was created, or the string output (if makefile = NULL)
task_config <- data.frame(
  id=c('AZ','CO','CA'),
  capital=c('Phoeniz','Denver','Sacramento')
)
step1 <- create_task_step(
  step_name = 'prep',
  target = function(task_name, step_name, ...) {
    sprintf('%s_%s', task_name, step_name)
  },
  depends = c('A','B'),
  command = "process(target_name, I('C'))"
)
step2 <- create_task_step(
  step_name = 'plot',
  command = function(target_name, task_name, ...) {
    capital <- task_config[task_config$id == task_name, 'capital']
    sprintf('visualize(\'%s\', \'%s\')', task_name, capital)
  }
)
step3 <- create_task_step('report')
task_plan <- create_task_plan(c('AZ','CA','CO'), list(step1, step2, step3),
  final_steps='report', ind_dir='states/log')
task_makefile <- create_task_makefile(
  task_plan, makefile=file.path(tempdir(), 'states.yml'),
  file_extensions=c('ind'), packages='mda.streams')
cat(readLines(task_makefile), sep='\n')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.