R/temp_save_to_hdfs.R

Defines functions temp_save_to_hdfs

Documented in temp_save_to_hdfs

#' @title Save to hadoop file system
#' 
#' @description Saves a db to HDFS. This function should be perform regularly during the merging process. 
#' 
#' @author Briac LE RAY (briac.leray@partnre.com)
#' 
#' @return Does not return anything.
#' @param db The dataframe to be saved to HDFS. Type = character
#' @param path_hdfs The path in HDFS to save to. Type = character
#' @param file_path The file to the path to write the code in. Type = character
#' @examples temp_save_to_hdfs(db = "my_dataframe", path_hdfs = "/path/to/file/file_name.rds", file_path = "path/to/the/file/file_name.extension")

temp_save_to_hdfs <- function(db, path_hdfs, file_path) {
  text_to_add = glue("# Save to HDFS ----
                     saveRDSToHDFS(object = {db}, filename = \"{path_hdfs}\", overwrite = TRUE, delete = FALSE)")
  add_to_file(text = text_to_add, file_path = file_path, append = TRUE)
}
Tiipiac/StressTestOptimization documentation built on Dec. 18, 2021, 5:08 p.m.