From d420b02c208f5a6d8bd00bf60e6a5c9778f49510 Mon Sep 17 00:00:00 2001 From: Erik de Vries Date: Mon, 3 Jun 2019 16:12:19 +0200 Subject: [PATCH] elasticizer: Added more verbosity to investigate error handling --- R/elasticizer.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/R/elasticizer.R b/R/elasticizer.R index dab75a2..9eb2555 100644 --- a/R/elasticizer.R +++ b/R/elasticizer.R @@ -69,6 +69,7 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw res <- NULL attempt <- 0 while( is.null(res) && attempt <= retries ) { + print(paste0('Attempt ',attempt, ' out of ',retries)) if (attempt > 0) { Sys.sleep(sleep) } @@ -76,12 +77,14 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw try( res <- Search(conn = conn, index = index, time_scroll=time_scroll,body = query, size = batch_size, raw=T) ) + print(paste0('Successful after ',attempt,' attempts')) } } if (src == F) { res <- NULL attempt <- 0 while( is.null(res) && attempt <= retries ) { + print(paste0('Attempt ',attempt, ' out of ',retries)) if (attempt > 0) { Sys.sleep(sleep) } @@ -89,6 +92,7 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw try( res <- Search(conn = conn, index = index, time_scroll=time_scroll,body = query, size = batch_size, raw=T, source = F) ) + print(paste0('Successful after ',attempt,' attempts')) } } json <- fromJSON(res) @@ -108,6 +112,7 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw res <- NULL attempt <- 0 while( is.null(res) && attempt <= retries ) { + print(paste0('Attempt ',attempt, ' out of ',retries)) if (attempt > 0) { Sys.sleep(sleep) } @@ -115,6 +120,7 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw try( res <- scroll(conn = conn, json$`_scroll_id`, time_scroll=time_scroll, raw=T) ) + print(paste0('Successful after ',attempt,' attempts')) } json <- fromJSON(res) hits <- length(json$hits$hits)