Skip to content
This repository has been archived by the owner on Oct 31, 2019. It is now read-only.

Commit

Permalink
Replace cat() with message() #49
Browse files Browse the repository at this point in the history
  • Loading branch information
andrie committed Feb 13, 2017
1 parent 11f2997 commit 1682a1e
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 134 deletions.
10 changes: 5 additions & 5 deletions R/AzureHDI.R
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ azureResizeHDI <- function(azureActiveContext, clustername, role = "worker",
rc <- azureListHDI(azureActiveContext, clustername = clustername)
rc1 <- rc[9, 1]
if (rc1 == "Running") {
cat("R")
message("R")
writeLines("")
writeLines(paste("Finished Resizing Sucessfully: ", Sys.time()))
(break)()
Expand All @@ -297,7 +297,7 @@ azureResizeHDI <- function(azureActiveContext, clustername, role = "worker",
if (rc1 == "HdInsightConfiguration") {
rc1 <- "R"
}
cat(rc1)
message(rc1)

if (a > 500)
(break)()
Expand Down Expand Up @@ -436,7 +436,7 @@ azureCreateHDI <- function(azureActiveContext, clustername, location, kind = "sp
stop("Error: No resourceGroup provided: Use resourceGroup argument or set in AzureContext")
}

cat("Fetching Storage Key..")
message("Fetching Storage Key..")
storageKey <- azureSAGetKey(azureActiveContext, resourceGroup = RGI, storageAccount = storageAccount)

HIVE <- FALSE
Expand Down Expand Up @@ -620,7 +620,7 @@ azureCreateHDI <- function(azureActiveContext, clustername, location, kind = "sp
rc <- azureListHDI(azureActiveContext, clustername = clustername)
rc1 <- rc[8, 1]
if (rc1 == "Succeeded") {
cat("S")
message("S")
writeLines("")
writeLines(paste("Finished Creating Sucessfully: ", Sys.time()))
(break)()
Expand All @@ -634,7 +634,7 @@ azureCreateHDI <- function(azureActiveContext, clustername, location, kind = "sp
if (rc1 == "InProgress") {
rc1 <- "R"
}
cat(rc1)
message(rc1)
if (a > 500)
(break)()
Sys.sleep(5)
Expand Down
14 changes: 6 additions & 8 deletions R/AzureHive.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ azureHiveSQL <- function(azureActiveContext, CMD, clustername, hdiAdmin,
if (DUR < 5)
DUR <- DUR + 1
if (df$status$state == "PREP")
cat("P")
message("P")
if (df$status$state == "RUNNING")
cat("R")
message("R")
# print(df$status$state)

r <- GET(URL, add_headers(.headers = c(`Content-type` = "application/json")),
Expand All @@ -142,13 +142,11 @@ azureHiveSQL <- function(azureActiveContext, CMD, clustername, hdiAdmin,
df <- fromJSON(rl)
}
if (df$status$state == "SUCCEEDED")
cat("S")
message("S")
if (df$status$state == "FAILED")
cat("F")
message("F")

STATE <- df$status$state
writeLines("")
writeLines(paste("Finished Running statement: ", Sys.time()))
# print(df)
return("Done")
message("Finished Running statement: ", Sys.time())
return(TRUE)
}
11 changes: 5 additions & 6 deletions R/AzureSpark.R
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,16 @@ azureSparkCMD <- function(azureActiveContext, CMD, clustername, hdiAdmin,
Sys.sleep(DUR)
if (DUR < 5)
DUR <- DUR + 1
cat("R")
message("R")
r <- GET(URL, add_headers(.headers = c(`Content-type` = "application/json")),
authenticate(HA, HP))
rl <- content(r, "text", encoding = "UTF-8")
rh <- headers(r)
df <- fromJSON(rl)

}
cat("C")
writeLines("")
writeLines(paste("Finished Running statement: ", Sys.time()))
message("C")
message("Finished Running statement: ", Sys.time())
RET <- df$output$data[1]
# rownames(RET) <- 'Return Value'
return(toString(RET))
Expand Down Expand Up @@ -382,7 +381,7 @@ azureSparkJob <- function(azureActiveContext, FILE, clustername, hdiAdmin,
Sys.sleep(DUR)
if (DUR < 5)
DUR <- DUR + 1
cat("R")
message("R")
r <- GET(URL, add_headers(.headers = c(`Content-type` = "application/json")),
authenticate(HA, HP), verbosity)
rl <- content(r, "text", encoding = "UTF-8")
Expand All @@ -391,7 +390,7 @@ azureSparkJob <- function(azureActiveContext, FILE, clustername, hdiAdmin,
if (length(df$appInfo$driverlogUrl))
LOGURL2 <- df$appInfo$driverlogUrl
}
cat("C")
message("C")
STATE <- df$state
writeLines("")
writeLines(paste("Finished Running statement: ", Sys.time()))
Expand Down
Loading

0 comments on commit 1682a1e

Please sign in to comment.