Skip to content

Instantly share code, notes, and snippets.

@mfoll
Created May 11, 2016 07:57
Show Gist options
  • Save mfoll/a0338614a1f399878e387b96bf767e09 to your computer and use it in GitHub Desktop.
Save mfoll/a0338614a1f399878e387b96bf767e09 to your computer and use it in GitHub Desktop.
Summary of jobs launched by all users for LSF cluster
#! /usr/bin/env Rscript
data=read.table(pipe("bjobs -u all -w | grep RUN | awk '{print $2\" \"$6}'"),stringsAsFactors = F,col.names = c("username","cpus"))
data[,2]=gsub("^cn.+$",1,data[,2])
data[,2]=as.numeric(gsub("^(.+)\\*cn.+$","\\1",data[,2]))
res=aggregate(cpus ~ username, data, sum)
print(res[order(res$cpus,decreasing = T),],row.names = FALSE)
@mfoll
Copy link
Author

mfoll commented May 11, 2016

Output example:

          username cpus
 vinayanuwattikunc  144
            lsaadm   96
           leblayn   37
       robitaillea    3
              free    8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment