library(plotly)
## Loading required package: ggplot2
## Registered S3 methods overwritten by 'ggplot2':
##   method         from 
##   [.quosures     rlang
##   c.quosures     rlang
##   print.quosures rlang
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
source("/home/and/Documents/PhD/Research/Scripts/R/R13/tasksMetrics.R")
## Registered S3 method overwritten by 'rvest':
##   method            from
##   read_xml.response xml2
## ── Attaching packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ tibble  2.1.1       ✔ purrr   0.3.2  
## ✔ tidyr   0.8.3       ✔ dplyr   0.8.0.1
## ✔ readr   1.3.1       ✔ stringr 1.4.0  
## ✔ tibble  2.1.1       ✔ forcats 0.4.0
## ── Conflicts ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks plotly::filter(), stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
appsE1_1 = "/home/and/Documents/PhD/Research/Scripts/Misc/tmp/apps/app-0282_info.tsv"
appsE1_2 = "/home/and/Documents/PhD/Research/Scripts/Misc/tmp/apps/app-0284_info.tsv"
appsE1_3 = "/home/and/Documents/PhD/Research/Scripts/Misc/tmp/apps/app-0286_info.tsv"
appsE1_4 = "/home/and/Documents/PhD/Research/Scripts/Misc/tmp/apps/app-0288_info.tsv"
appsE1_5 = "/home/and/Documents/PhD/Research/Scripts/Misc/tmp/apps/app-0290_info.tsv"
stagesE1 = rbind(getStages(appsE1_1),getStages(appsE1_2),getStages(appsE1_3),getStages(appsE1_4),getStages(appsE1_5))
## Warning: Calling `as_tibble()` on a vector is discouraged, because the behavior is likely to change in the future. Use `tibble::enframe(name = NULL)` instead.
## This warning is displayed once per session.
appsE3_1 = "/home/and/Documents/PhD/Research/Scripts/Misc/tmp/apps/app-0281_info.tsv"
appsE3_2 = "/home/and/Documents/PhD/Research/Scripts/Misc/tmp/apps/app-0283_info.tsv"
appsE3_3 = "/home/and/Documents/PhD/Research/Scripts/Misc/tmp/apps/app-0285_info.tsv"
appsE3_4 = "/home/and/Documents/PhD/Research/Scripts/Misc/tmp/apps/app-0287_info.tsv"
appsE3_5 = "/home/and/Documents/PhD/Research/Scripts/Misc/tmp/apps/app-0289_info.tsv"
stagesE3 = rbind(getStages(appsE3_1),getStages(appsE3_2),getStages(appsE3_3),getStages(appsE3_4),getStages(appsE3_5))

stages = rbind(stagesE1, stagesE3) %>% select(StageId, Stage, Executors, Duration) %>%
  mutate(Stage = paste(str_pad(StageId,5,"left"), Stage)) %>%
  select(Stage, Executors, Duration) %>%
  group_by(Stage, Executors) %>% summarise(Duration = mean(Duration))

head(stages)
p = ggplot(data = stages, aes(x = Stage, y = Duration, fill = Executors)) +
  geom_bar(stat="identity", position=position_dodge(width = 0.75), width = 0.7) + 
  theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
  labs(x="Stages", y="Duration(s)")
ggplotly(p)