elasticizer: added additional verbosity on errors

master
Erik de Vries 6 years ago
parent d420b02c20
commit 176a8f6de4

@ -69,7 +69,6 @@ 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)
} }
@ -77,14 +76,15 @@ 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 (attempt > 1) {
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)
} }
@ -92,7 +92,9 @@ 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')) if (attempt > 1) {
print(paste0('Successful after ',attempt,' attempts'))
}
} }
} }
json <- fromJSON(res) json <- fromJSON(res)
@ -112,7 +114,6 @@ 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)
} }
@ -120,7 +121,9 @@ 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')) if (attempt > 1) {
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