Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (39 sloc) 1.56 KB
suppressPackageStartupMessages({
library(dplyr)
library(readr)
library(plotly)
library(lubridate)
})
priority_partitions <- c("HaswellPreempt", "HaswellPriority",
"SandyBridgePriority", "IvyBridgePriority",
"Haswell192Priority", "Broadwell44Priority")
tbl <- read_delim('sacct-week.psv.gz',
delim = '|',
na = 'Unknown') %>%
filter(Submit >= '2018-03-13',
!is.na(Start),
Partition != 'debug') %>%
mutate(wait_hours= as.numeric(Start - Submit, unit = "hours"),
priority = ifelse(Partition %in% priority_partitions,
"priority", "open access"),
day = date(Submit))
cores <- tbl %>%
filter(Partition == "general") %>%
group_by(day, User) %>%
summarize(ncpus = sum(NCPUS))
top <- cores %>% group_by(User) %>%
summarize(ncpus = sum(ncpus)) %>% top_n(5) %>%
arrange(-ncpus) %>% pull(User)
other <- "others"
cores <- cores %>%
mutate(top_user = ifelse(User %in% top, User, other)) %>%
## Set the factor order for the plot.
mutate(top_user = factor(top_user,
c(top, other) %>% rev()))
gg_cores <- ggplot(cores, aes(day, ncpus, fill = top_user)) +
geom_bar(position = "stack", stat = "identity") +
geom_text(aes(label = ifelse(User %in% top, ncpus, NA)),
position = "stack", check_overlap = TRUE) +
labs(fill = "Top 5 users")
suppressWarnings( # Yes, label in geom_text has NAs to reduce overplotting.
ggsave("tmp.png", width = 10))
You can’t perform that action at this time.