elasticizer: Added more verbosity to investigate error handling

master
Erik de Vries 6 years ago
parent 48b589dda0
commit d420b02c20

@ -69,6 +69,7 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
res <- NULL res <- NULL
attempt <- 0 attempt <- 0
while( is.null(res) && attempt <= retries ) { while( is.null(res) && attempt <= retries ) {
print(paste0('Attempt ',attempt, ' out of ',retries))
if (attempt > 0) { if (attempt > 0) {
Sys.sleep(sleep) Sys.sleep(sleep)
} }
@ -76,12 +77,14 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
try( try(
res <- Search(conn = conn, index = index, time_scroll=time_scroll,body = query, size = batch_size, raw=T) 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) { if (src == F) {
res <- NULL res <- NULL
attempt <- 0 attempt <- 0
while( is.null(res) && attempt <= retries ) { while( is.null(res) && attempt <= retries ) {
print(paste0('Attempt ',attempt, ' out of ',retries))
if (attempt > 0) { if (attempt > 0) {
Sys.sleep(sleep) Sys.sleep(sleep)
} }
@ -89,6 +92,7 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
try( try(
res <- Search(conn = conn, index = index, time_scroll=time_scroll,body = query, size = batch_size, raw=T, source = F) 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) json <- fromJSON(res)
@ -108,6 +112,7 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
res <- NULL res <- NULL
attempt <- 0 attempt <- 0
while( is.null(res) && attempt <= retries ) { while( is.null(res) && attempt <= retries ) {
print(paste0('Attempt ',attempt, ' out of ',retries))
if (attempt > 0) { if (attempt > 0) {
Sys.sleep(sleep) Sys.sleep(sleep)
} }
@ -115,6 +120,7 @@ elasticizer <- function(query, src = T, index = 'maml', es_pwd = .rs.askForPassw
try( try(
res <- scroll(conn = conn, json$`_scroll_id`, time_scroll=time_scroll, raw=T) res <- scroll(conn = conn, json$`_scroll_id`, time_scroll=time_scroll, raw=T)
) )
print(paste0('Successful after ',attempt,' attempts'))
} }
json <- fromJSON(res) json <- fromJSON(res)
hits <- length(json$hits$hits) hits <- length(json$hits$hits)

Loading…
Cancel
Save