I'm pretty new to Shiny and Spark.
I want to deploy a ShinyApp with a spark connection. Everything works how it should when I just hit RunApp, but whenever I try to publish it, I get the error: "Error in value[3L] :
SPARK_HOME directory '/usr/lib/spark' not found
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
Execution halted"
This directory exists on my cluster, so I'm not sure why it's not finding it.
Here's the code I'm trying to publish.
library(sparklyr)
library(shiny)
library(ggplot2)
library(rmarkdown)
Sys.setenv(SPARK_HOME = '/usr/lib/spark')
config<- spark_config()
spark_install(version = "2.2.0")
sc<-spark_connect(master = 'yarn-client', version = '2.2.0')
tbl_cache(sc, 'output_final_v2')
output_tbl2<-tbl(sc, 'output_final_v2')
ui <- fluidPage(
textInput("name", "Enter Shortname", "furycat"),
#selectInput("shortname", "Choose Shortname", choices = l),
textInput("item_name", "Enter Item Name"),
selectInput("month", "Choose Month", choice= c("January","February","March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December")),
selectInput("dow","Choose Day of Week", choice = c("Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Sunday")),
numericInput("count_customers", "Enter Number of Customers:", 2),
numericInput("views", "Enter Number of View Book Form:", 30),
plotOutput("plot1"),
plotOutput("plot2"),
plotOutput("plot3")
)
server <- function(input, output, session) {
C2<-reactive( output_tbl2 %>%
mutate(views = input$views)%>%
filter(input$name == shortname)%>%
filter(input$dow== dow)%>%
filter (input$month == month)%>%
filter (input$item_name == item)%>%
filter (input$count_customers == count_customers)%>%
collect)
output$plot1 <- renderPlot({
p1<-ggplot2::ggplot(data = C2() , aes(x=price_per_customer, y=final_probability)) + geom_line() + ggtitle("Probability of Purchase") + labs(y="Probability",x= "Item Price")
print(p1)
})
output$plot2 <- renderPlot({
p2<-ggplot2::ggplot(data=C2(), aes(x=price_per_customer, y=((views*final_probability)*price_per_customer))) + geom_line() + geom_hline(aes(yintercept = max((views*final_probability)*price_per_customer))) + ggtitle("Projected Revenue") + labs(y="Expected Revenue",x="Item Price")
print(p2)
})
output$plot3<-renderPlot({
p3<-ggplot2::ggplot(data=C2(), aes(x=price_per_customer))+ geom_line(aes(y=(views*final_probability)*price_per_customer)) + geom_line(aes(y= (((views*final_probability)/price_per_customer)))) + ggtitle("Iso-Profit vs Expected Volume")
print(p3)
})
}
shinyApp(ui, server)