Skip to contents

Execute a parameterized RMD on cluster

Usage

execute_on_cluster(
  renv_directory,
  rmd_file,
  iterable,
  iter_to_params,
  output_file = "output.log",
  image_id = "ami-0438747454de030f3",
  security_group_ids = c("sg-01f269087c271cf61", "sg-0f0e8b61aa72dbdef"),
  instance_type = "t2.small",
  terminate = TRUE,
  upload_s3_prefix = "upload-rstudio-server-ubuntu-task",
  upload_s3_bucket = "gcpd",
  renv_directory_cmds = NULL,
  renv_directory_cmds_post = NULL
)

Arguments

renv_directory

Path to a directory on the host machine that is managed by renv and where all dependencies have been installed into the AMI image.

rmd_file

Path to a RMD script relative to renv_directory.

iterable

Vector or list. A separate instance is launched for each element.

iter_to_params

Function that transforms an element of iterable into a list of parameters that are passed to rmarkdown::render in the params argument.

image_id

AMI image id. Each instance will be based on this image.

instance_type

EC2 instance type.

terminate

If TRUE terminate the instance after script completes.

upload_s3_prefix

Path to which the JSON file describing the cluster is uploaded. The default will upload it to a preconfigured folder in S3 that will trigger a lambda which will eventually create the requested instances.

upload_s3_bucket

S3 bucket.