---
title: "Kaggle Docker Image information"
author: "Laurae"
date: "September 9, 2016"
output:
  html_document:
    toc: true
    theme: united
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Kaggle container is pretty cool, let's see what we have inside!

You need to look at the code to see the workaround used to print system outputs without showing intern = TRUE. Also, Python package listing is not working properly (?). Running python help('modules') didn't seem good also.

Summary:

* We check the Linux flavor, the kernel
* We look at the processes running
* We look at the CPU
* We check in /proc the CPU / Memory / Partitions info
* We look at the disks and do a speed benchmark from R
* We look at the Linux packages installed
* We look at the Python packages installed
* We look at the R packages installed
* We look at the kernel configuration

## Linux flavor / kernel

### What's my shell name?
```{r, eval = FALSE}
system("ps -p $$ | tail -1 | awk '{ print $4 }'")
```
```{r, echo = FALSE}
cat(system("ps -p $$ | tail -1 | awk '{ print $4 }'", intern = TRUE), sep = '\n')
```

### Who am I when running on Kaggle...?
```{r, eval = FALSE}
system("uname")
system("w") #system("uptime")
```
```{r, echo = FALSE}
cat(system("uname", intern = TRUE), sep = '\n')
cat(system("w", intern = TRUE), sep = '\n') #cat(system("uptime", intern = TRUE), sep = '\n')
```

### General information on Kaggle...?
```{r, eval = FALSE}
system("uname -a")
```
```{r, echo = FALSE}
cat(system("uname -a", intern = TRUE), sep = '\n')
```

### What Linux flavor are we using on Kaggle...?
```{r, eval = FALSE}
system("cat /etc/*release*")
```
```{r, echo = FALSE}
cat(system("cat /etc/*release*", intern = TRUE), sep = '\n')
```


## What processes are running?

### What processes am I running on Kaggle...?
```{r, eval = FALSE}
system("ps aux")
```
```{r, echo = FALSE}
cat(system("ps aux", intern = TRUE), sep = '\n')
```


## What about the CPU?

### Let's check for general server configuration on Kaggle...?
```{r, eval = FALSE}
system("lscpu")
```
```{r, echo = FALSE}
cat(system("lscpu", intern = TRUE), sep = '\n')
```


## What's in /proc ?

### What CPU do we use on Kaggle...?
```{r, eval = FALSE}
system("cat /proc/cpuinfo")
```
```{r, echo = FALSE}
cat(system("cat /proc/cpuinfo", intern = TRUE), sep = '\n')
```

### How much free memory do we have on Kaggle...?
```{r, eval = FALSE}
system("cat /proc/meminfo")
```
```{r, echo = FALSE}
cat(system("cat /proc/meminfo", intern = TRUE), sep = '\n')
```

### What parititions do we have on Kaggle...?
```{r, eval = FALSE}
system("cat /proc/partitions")
```
```{r, echo = FALSE}
cat(system("cat /proc/partitions", intern = TRUE), sep = '\n')
```

### What about the kernel we are using on Kaggle...?
```{r, eval = FALSE}
system("cat /proc/version")
```
```{r, echo = FALSE}
cat(system("cat /proc/version", intern = TRUE), sep = '\n')
```


## Let's look at the disk and do a benchmark

### Benchmarking the drive: very fast!!!
```{r, eval = FALSE}
system("dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync; rm test")
```
```{r, echo = FALSE}
cat(system("dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync; rm test", intern = TRUE), sep = '\n')
```

### What is present?
```{r, eval = FALSE}
system("lsblk")
```
```{r, echo = FALSE}
cat(system("lsblk", intern = TRUE), sep = '\n')
```

### The disk usage?
```{r, eval = FALSE}
system("df")
```
```{r, echo = FALSE}
cat(system("df", intern = TRUE), sep = '\n')
```

### More details?
```{r, eval = FALSE}
system("lsblk -a")
```
```{r, echo = FALSE}
cat(system("lsblk -a", intern = TRUE), sep = '\n')
```



## The Linux packages installed
```{r, eval = FALSE}
system("dpkg --list")
```
```{r, echo = FALSE}
cat(system("dpkg --list", intern = TRUE), sep = '\n')
```


## The Python packages installed (not working properly?)
```{r, eval = FALSE}
system("pip list")
```
```{r, echo = FALSE}
cat(system("pip list", intern = TRUE), sep = '\n')
```


## The R installed packages on Kaggle
```{r}
print(installed.packages()[, c(3)])
```



## The kernel configuration?
```{r, eval = FALSE}
system("/sbin/sysctl -a")
```
```{r, echo = FALSE}
cat(system("/sbin/sysctl -a", intern = TRUE), sep = '\n')
```