Skip to content
Permalink
Browse files

ENH: Plot top 5 users

  • Loading branch information
pan14001 committed Mar 29, 2018
1 parent 3106a14 commit cf017b1284bcdcd67a7bdf141e02e0c73850e5c9
Showing with 38 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +37 −0 plot-top5-core-count.R
@@ -1,6 +1,7 @@
# Output
index.html
index_files/
*.png

# Emacs
*~
@@ -0,0 +1,37 @@
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 %>%
group_by(day, Partition, User) %>%
summarize(ncpus = sum(NCPUS))
top5 <- cores %>% group_by(User) %>%
summarize(ncpus = sum(ncpus)) %>% top_n(5) %>% pull(User)
other <- "other"
cores <- cores %>% mutate(top_user = ifelse(User %in% top5, User, other))

gg_cores <- ggplot(cores,
aes(day, ncpus, fill = factor(top_user,
c(top5, other) %>% rev()))) +
geom_bar(position = "stack", stat = "identity") +
## geom_text(aes(label = ifelse(User %in% top5, ncpus, NA))) +
labs(fill = "Top 5 users") +
facet_wrap(~ Partition)
ggsave("tmp.png", width = 10)

0 comments on commit cf017b1

Please sign in to comment.
You can’t perform that action at this time.