slurm-2sql.ipynb 1.28 KB
Newer Older
1
2
3
4
{
 "cells": [
  {
   "cell_type": "code",
William Monroe's avatar
William Monroe committed
5
   "execution_count": null,
6
7
8
9
10
11
12
13
14
15
   "metadata": {},
   "outputs": [],
   "source": [
    "import sqlite3\n",
    "import slurm2sql\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
William Monroe's avatar
William Monroe committed
16
   "execution_count": null,
17
   "metadata": {},
William Monroe's avatar
William Monroe committed
18
   "outputs": [],
19
   "source": [
20
21
22
23
24
25
26
27
28
    "db = sqlite3.connect('test.db')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
29
30
31
32
33
    "slurm2sql.slurm2sql(db, ['-S', '2020-03-18', '-a'])"
   ]
  },
  {
   "cell_type": "code",
William Monroe's avatar
William Monroe committed
34
   "execution_count": null,
35
36
37
38
39
40
41
42
43
   "metadata": {},
   "outputs": [],
   "source": [
    "# For example, you can then convert to a dataframe:\n",
    "df1 = pd.read_sql('SELECT * FROM slurm', db)"
   ]
  },
  {
   "cell_type": "code",
William Monroe's avatar
William Monroe committed
44
   "execution_count": null,
45
   "metadata": {},
William Monroe's avatar
William Monroe committed
46
   "outputs": [],
47
48
49
50
   "source": [
    "df1.head(5)"
   ]
  },
William Monroe's avatar
William Monroe committed
51
52
  {
   "cell_type": "code",
William Monroe's avatar
William Monroe committed
53
   "execution_count": null,
William Monroe's avatar
William Monroe committed
54
   "metadata": {},
William Monroe's avatar
William Monroe committed
55
   "outputs": [],
William Monroe's avatar
William Monroe committed
56
57
58
59
   "source": [
    "print(\"more plots to come\")"
   ]
  },
60
61
62
63
64
65
66
67
68
69
70
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
71
   "pygments_lexer": "ipython3"
72
73
74
75
76
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}