Skip to content
Permalink
Browse files

ENH: Generate interactive HTML using plotly

  • Loading branch information
pan14001 committed Mar 20, 2018
1 parent b663983 commit 7e8c7fd70cf98e09838ea9614418852b34c7f14d
Showing with 54 additions and 8 deletions.
  1. +6 −1 .gitignore
  2. +40 −0 README.md
  3. +8 −7 sacct.R
@@ -1 +1,6 @@
*.pdf
# Output
index.html
index_files/

# Emacs
*~
@@ -0,0 +1,40 @@
# SLURM stats

Generate interactive HTML plots of SLURM data.

Build the HTML file on the Storrs HPC cluster:


```sh
module load gcc/5.4.0-alt r/3.4.2-540a
Rscript sacct.R
```

Spawn web server to view output on your workstation as you change the
R code:


```sh
# Server side setup
python -m SimpleHTTPServer
```

Connect to the server and see your web browser. Assumes port 8000 was
opened by the python web server on login1, tunnel to the server from
your workstation:

```sh
# Client side setup
ssh -NL 8000:localhost:8000 login1
xdg-open http://localhost:8000
```

...where login1 is an ssh_config alias such as:

```conf
# ~/.ssh/config
Host login1
HostName login1.storrs.hpc.uconn.edu
User NETIDadmin # Put your ID here!
IdentityFile ~/.ssh/id_rsa # Or similar. Copy with `ssh-copy-id`
```
15 sacct.R
@@ -1,7 +1,7 @@
suppressPackageStartupMessages({
library(dplyr)
library(readr)
library(ggplot2)
library(plotly)
library(lubridate)
})

@@ -11,8 +11,8 @@ priority_partitions <- c("HaswellPreempt", "HaswellPriority",
tbl <- read_delim('sacct-week.psv.gz',
delim = '|',
na = 'Unknown') %>%
na.omit() %>%
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,
@@ -23,12 +23,13 @@ counts <- tbl %>%
group_by(day, priority) %>%
summarize(count = n(), wait_hours = median(wait_hours))

plot <- ggplot(tbl, aes(day, wait_hours)) +
gg <- ggplot(tbl, aes(day, wait_hours)) +
geom_hline(yintercept = 12) +
geom_boxplot(aes(group = day)) +
geom_jitter(aes(size = NCPUS, color = Partition), alpha = 0.3) +
geom_label(data = counts, aes(label = count)) +
facet_grid(~ priority)
ggsave('sacct-week.pdf', plot, width = 15)
plot <- plot + scale_y_log10()
ggsave('log-sacct-week.pdf', plot, width = 15)
facet_grid(~ priority) +
scale_y_log10()
gg <- ggplotly(gg)

htmlwidgets::saveWidget(gg, "index.html", selfcontained = FALSE)

0 comments on commit 7e8c7fd

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