Skip to content

Commit

Permalink
Region setting outside loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Seibelt committed Jun 22, 2018
1 parent 21fc283 commit 8b7d295
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ uploadToS3 = function (data, bucket, split_files, key, secret, region){

#' @importFrom "aws.s3" "delete_object"
deletePrefix = function(prefix, bucket, split_files, key, secret, region){
prev_reg=Sys.getenv('AWS_DEFAULT_REGION')
Sys.setenv( 'AWS_DEFAULT_REGION'=region)
for (i in 1:split_files) {
s3Name=paste(prefix, ".", formatC(i, width = 4, format = "d", flag = "0"), sep="")
print(paste("Deleting", s3Name))
prev_reg=Sys.getenv('AWS_DEFAULT_REGION')
Sys.setenv( 'AWS_DEFAULT_REGION'=region)
delete_object(s3Name, bucket, key=key, secret=secret, region=region)
Sys.setenv( 'AWS_DEFAULT_REGION'=prev_reg)
}
Sys.setenv( 'AWS_DEFAULT_REGION'=prev_reg)
}

#' @importFrom DBI dbGetQuery
Expand Down

0 comments on commit 8b7d295

Please sign in to comment.