abhijit2k01 commited on
Commit
0205c85
·
verified ·
1 Parent(s): fb97a04

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. datasets/raw/borg_cluster_data_2011/ClusterData2011_2.md +86 -0
  2. datasets/raw/borg_cluster_data_2011/DATASET_LICENSE.md +7 -0
  3. datasets/raw/borg_cluster_data_2011/README.md +62 -0
  4. datasets/raw/borg_cluster_data_2011/TraceVersion1.md +43 -0
  5. datasets/raw/borg_cluster_data_2011/clusterdata_analysis_colab.ipynb +404 -0
  6. datasets/raw/internalbleeding4/026_UCR_Anomaly_DISTORTEDInternalBleeding15_1700_5684_5854.txt +0 -0
  7. datasets/raw/internalbleeding4/027_UCR_Anomaly_DISTORTEDInternalBleeding16_1200_4187_4199.txt +0 -0
  8. datasets/raw/internalbleeding4/028_UCR_Anomaly_DISTORTEDInternalBleeding17_1600_3198_3309.txt +0 -0
  9. datasets/raw/internalbleeding4/030_UCR_Anomaly_DISTORTEDInternalBleeding19_3000_4187_4197.txt +0 -0
  10. datasets/raw/internalbleeding4/032_UCR_Anomaly_DISTORTEDInternalBleeding4_1000_4675_5033.txt +0 -0
  11. datasets/raw/internalbleeding4/034_UCR_Anomaly_DISTORTEDInternalBleeding6_1500_3474_3629.txt +0 -0
  12. datasets/raw/internalbleeding4/035_UCR_Anomaly_DISTORTEDInternalBleeding8_2500_5865_5974.txt +0 -0
  13. datasets/raw/internalbleeding4/036_UCR_Anomaly_DISTORTEDInternalBleeding9_4200_6599_6681.txt +0 -0
  14. datasets/raw/internalbleeding4/132_UCR_Anomaly_InternalBleeding10_3200_4526_4556.txt +0 -0
  15. datasets/raw/internalbleeding4/133_UCR_Anomaly_InternalBleeding14_2800_5607_5634.txt +0 -0
  16. datasets/raw/internalbleeding4/134_UCR_Anomaly_InternalBleeding15_1700_5684_5854.txt +0 -0
  17. datasets/raw/internalbleeding4/135_UCR_Anomaly_InternalBleeding16_1200_4187_4199.txt +0 -0
  18. datasets/raw/internalbleeding4/138_UCR_Anomaly_InternalBleeding19_3000_4187_4197.txt +0 -0
  19. datasets/raw/internalbleeding4/140_UCR_Anomaly_InternalBleeding4_1000_4675_5033.txt +0 -0
  20. datasets/raw/internalbleeding4/143_UCR_Anomaly_InternalBleeding8_2500_5865_5974.txt +0 -0
datasets/raw/borg_cluster_data_2011/ClusterData2011_2.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ClusterData 2011 traces
2
+
3
+ _John Wilkes and Charles Reiss._
4
+
5
+ The `clusterdata-2011-2` trace represents 29 day's worth of Borg cell information
6
+ from May 2011, on a cluster of about 12.5k machines. (The `-2` refers to the fact that we added some additional data after the initial release, to create trace version 2.1.)
7
+
8
+ * If you haven't already joined our
9
+ [mailing list](https://groups.google.com/forum/#!forum/googleclusterdata-discuss),
10
+ please do so now. **Important**: please fill out the "reason" field, or your application will be rejected.
11
+
12
+ ## Trace data
13
+
14
+ The `clusterdata-2011-2` trace starts at 19:00 EDT on Sunday May 1, 2011, and
15
+ the datacenter is in that timezone (US Eastern). This corresponds to a trace
16
+ timestamp of 600s; see the data schema documentation for why.
17
+
18
+ The trace is described in the trace-data
19
+ [v2.1 format + schema document](https://drive.google.com/file/d/0B5g07T_gRDg9Z0lsSTEtTWtpOW8/view?usp=sharing&resourcekey=0-cozD56gA4fUDdrkHnLJSrQ).
20
+
21
+ Priorities in this trace range from 0 to 11 inclusive; bigger numbers mean "more
22
+ important". 0 and 1 are “free” priorities; 9, 10, and 11 are “production”
23
+ priorities; and 12 is a “monitoring” priority.<br>
24
+
25
+ The `clusterdata-2011-2` trace is identical to the one called
26
+ `clusterdata-2011-1`, except for the addition of a single new column of data in
27
+ the `task_usage` tables. This new data is a randomly-picked 1 second sample of
28
+ CPU usage from within the associated 5-minute usage-reporting period for that
29
+ task. Using this data, it is possible to build up a stochastic model of task
30
+ utilization over time for long-running tasks.
31
+
32
+ ![Creative Commons CC-BY license](https://i.creativecommons.org/l/by/4.0/88x31.png)
33
+ The data and trace documentation are made available under the
34
+ [CC-BY](https://creativecommons.org/licenses/by/4.0/) license.
35
+ By downloading it or using them, you agree to the terms of this license.
36
+
37
+ ## Downloading the trace
38
+
39
+ Download instructions for the trace are in the
40
+ [v2.1 format + schema document](https://drive.google.com/file/d/0B5g07T_gRDg9Z0lsSTEtTWtpOW8/view?usp=sharing&resourcekey=0-cozD56gA4fUDdrkHnLJSrQ).
41
+
42
+ The trace is stored in
43
+ [Google Storage for Developers](https://developers.google.com/storage/) in the
44
+ bucket called `clusterdata-2011-2`. The total size of the compressed trace is
45
+ approximately 41GB.
46
+
47
+ Most users should use the
48
+ [gcloud storage](https://docs.cloud.google.com/sdk/docs/install-sdk) command-line tool to
49
+ download the trace data.
50
+
51
+
52
+ ## Known anomalies in the trace
53
+
54
+ Disk-time-fraction data is only included in about the first 14 days, because of
55
+ a change in our monitoring system.
56
+
57
+ Some jobs are deliberately omitted because they ran primarily on machines not
58
+ included in this trace. The portion that ran on included machines amounts to
59
+ approximately 0.003% of the machines’ task-seconds of usage.
60
+
61
+ We are aware of only one example of a job that retains its job ID after being
62
+ stopped, reconfigured, and restarted (job number 6253771429).
63
+
64
+ Approximately 70 jobs (for example, job number 6377830001) have job event
65
+ records but no task event records. We believe that this is legitimate in a
66
+ majority of cases: typically because the job is started but its tasks are
67
+ disabled for its entire duration.
68
+
69
+ Approximately 0.013% of task events and 0.0008% of job events in this trace have
70
+ a non-empty missing info field.
71
+
72
+ We estimate that less than 0.05% of job and task scheduling event records are
73
+ missing and less than 1% of resource usage measurements are missing.
74
+
75
+ Some cycles per instruction (CPI) and memory accesses per instruction (MAI)
76
+ measurements are clearly inaccurate (for example, they are above or below the
77
+ range possible on the underlying micro-architectures). We believe these
78
+ measurements are caused by bugs in the data-capture system used, such as the
79
+ cycle counter and instruction counter not being read at the same time. To obtain
80
+ useful data from these measurements, we suggest filtering out measurements
81
+ representing a very small amount of CPU time and measurements with unreasonable
82
+ CPI and MAI values.
83
+
84
+ # Questions?
85
+
86
+ Please send email to googleclusterdata-discuss@googlegroups.com.
datasets/raw/borg_cluster_data_2011/DATASET_LICENSE.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Borg Cluster Data 2011
2
+
3
+ - Source: https://github.com/google/cluster-data
4
+ - Census access tier: Open
5
+ - Licence: No licence on repo (Google trace terms; data CC BY 4.0 per Google docs)
6
+
7
+ This copy is held inside the MBZUAI 1Time research project under the licence stated above. It is not an open redistribution. To obtain the data yourself, use the original source link and follow that source's own licence and access process.
datasets/raw/borg_cluster_data_2011/README.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Overview
2
+
3
+ This repository describes various traces from parts of the Google cluster
4
+ management software and systems.
5
+
6
+ * Please join our (low volume)
7
+ [discussion group](http://groups.google.com/group/googleclusterdata-discuss),
8
+ so we can send you announcements, and you can let us know about any issues,
9
+ insights, or papers you publish using these traces. **Important: to avoid
10
+ spammers, you MUST fill out the "reason" field, or your application will be
11
+ rejected**. Once you are a member, you can send email to
12
+ [googleclusterdata-discuss@googlegroups.com](mailto:googleclusterdata-discuss@googlegroups.com)
13
+ to:
14
+
15
+ * Announce tools and techniques that can help others analyze or decode the
16
+ trace data.
17
+ * Share insights and surprises.
18
+ * Ask questions (the group has a few hundred members) and get help. If you
19
+ ask for help, please include concrete examples of issues you run into;
20
+ screen shots; error codes; and a list of what you have already tried.
21
+ Don't just say "I can't download the data"!
22
+
23
+ * We provide a **[trace bibliography](bibliography.bib)** of papers that have
24
+ used and/or analyzed the traces, and encourage anybody who publishes one to
25
+ add it to the bibliography using a github pull request [preferred], or by
26
+ emailing the bibtex entry to
27
+ [googleclusterdata-discuss@googlegroups.com](mailto:googleclusterdata-discuss@googlegroups.com).
28
+ In either case, please mimic the existing format **exactly**.
29
+
30
+ # Borg cluster workload traces
31
+
32
+ These are traces of workloads running on Google compute cells that are managed
33
+ by the cluster management software internally known as Borg.
34
+
35
+ * **[version 3](ClusterData2019.md)** (aka `ClusterData2019`) provides data
36
+ from eight Borg cells over the month of May 2019.
37
+ * [version 2](ClusterData2011_2.md) (aka `ClusterData2011`) provides data from
38
+ a single 12.5k-machine Borg cell from May 2011.
39
+ * [version 1](TraceVersion1.md) is an older, short trace that describes a 7
40
+ hour period from one cell from 2009. *Deprecated. We strongly recommend
41
+ using the version 2 or version 3 traces instead.*
42
+
43
+ ## ETA traces
44
+
45
+ In addition, this site hosts a set of
46
+ [execution traces from ETA](ETAExplorationTraces.md) (Exploratory Testing
47
+ Architecture) - a testing framework that explores interactions between
48
+ distributed, concurrently-executing components, with an eye towards improving
49
+ testing them.
50
+
51
+ ## Power traces
52
+
53
+ This site also hosts [power traces](PowerData2019.md) for 57 power domains
54
+ during the month of May 2019. This trace is synergistic with the
55
+ `ClusterData2019` dataset.
56
+
57
+ ## License
58
+
59
+ ![Creative Commons CC-BY license](https://i.creativecommons.org/l/by/4.0/88x31.png)
60
+ The data and trace documentation are made available under the
61
+ [CC-BY](https://creativecommons.org/licenses/by/4.0/) license. By downloading it
62
+ or using them, you agree to the terms of this license.
datasets/raw/borg_cluster_data_2011/TraceVersion1.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ |*Note: for new work, we **strongly** recommend using the [version 2](ClusterData2011_2.md) or [version 3](ClusterData2019.md) traces, which are more recent, more comprehensive, and provide much more data.* |
3
+ |:--------- |
4
+
5
+
6
+ _This trace was first announced in [this January 2010 blog post](https://ai.googleblog.com/2010/01/google-cluster-data.html)._
7
+
8
+ The first dataset provides traces from a Borg cell that were taken over a 7 hour
9
+ period. The workload consists of a set of tasks, where each task runs on a
10
+ single machine. Tasks consume memory and one or more cores (in fractional
11
+ units). Each task belongs to a single job; a job may have multiple tasks (e.g.,
12
+ mappers and reducers).
13
+
14
+ The trace data is available
15
+ [here](http://commondatastorage.googleapis.com/clusterdata-misc/google-cluster-data-1.csv.gz).
16
+ ([SHA1 checksum](http://en.wikipedia.org/wiki/SHA-1#Data_Integrity):
17
+ 98c87f059aa1cc37f1e9523ac691ee0fd5629188.)
18
+
19
+ The data have been anonymized in several ways: there are no task or job names,
20
+ just numeric identifiers; timestamps are relative to the start of data
21
+ collection; the consumption of CPU and memory is obscured using a linear
22
+ transformation. However, even with these transformations of the data,
23
+ researchers will be able to do workload characterizations (up to a linear
24
+ transformation of the true workload) and workload generation.
25
+
26
+ The data are structured as blank-separated columns. Each row reports on the
27
+ execution of a single task during a five minute period.
28
+
29
+ * `Time` (int) - time in seconds since the start of data collection
30
+ * `JobID` (int) - Unique identifier of the job to which this task belongs (**may be called ParentID**)
31
+ * `TaskID` (int) - Unique identifier of the executing task
32
+ * `Job Type` (0, 1, 2, 3) - class of job (a categorization of work)
33
+ * `Normalized Task Cores` (float) - normalized value of the average number of cores used by the task
34
+ * `Normalized Task Memory` (float) - normalized value of the average memory consumed by the task
35
+
36
+ ![Creative Commons CC-BY license](https://i.creativecommons.org/l/by/4.0/88x31.png)
37
+ The data and trace documentation are made available under the
38
+ [CC-BY](https://creativecommons.org/licenses/by/4.0/) license.
39
+ By downloading it or using them, you agree to the terms of this license.
40
+
41
+ Questions? Send [email](mailto:googleclusterdata-discuss@googlegroups.com)
42
+ or peruse the
43
+ [discussion group](http://groups.google.com/group/googleclusterdata-discuss).
datasets/raw/borg_cluster_data_2011/clusterdata_analysis_colab.ipynb ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "name": "clusterdata_analysis_colab.ipynb",
7
+ "provenance": [],
8
+ "collapsed_sections": [],
9
+ "authorship_tag": "ABX9TyN3LZGXsYYQ/HRBwFP0rm4Q",
10
+ "include_colab_link": true
11
+ },
12
+ "kernelspec": {
13
+ "name": "python3",
14
+ "display_name": "Python 3"
15
+ }
16
+ },
17
+ "cells": [
18
+ {
19
+ "cell_type": "markdown",
20
+ "metadata": {
21
+ "id": "view-in-github",
22
+ "colab_type": "text"
23
+ },
24
+ "source": [
25
+ "<a href=\"https://colab.research.google.com/github/google/cluster-data/blob/master/clusterdata_analysis_colab.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "markdown",
30
+ "metadata": {
31
+ "id": "-qcDkhOIjj8a",
32
+ "colab_type": "text"
33
+ },
34
+ "source": [
35
+ "# Google trace analysis colab\n",
36
+ "\n",
37
+ "This colab provides several example queries and graphs using [Altair](https://altair-viz.github.io/) for the 2019 Google cluster trace. Further examples will be added over time.\n",
38
+ "\n",
39
+ "**Important:** in order to be able to run the queries you will need to:\n",
40
+ "\n",
41
+ "1. Use the [Cloud Resource Manager](https://console.cloud.google.com/cloud-resource-manager) to Create a Cloud Platform project if you do not already have one.\n",
42
+ "2. [Enable billing](https://support.google.com/cloud/answer/6293499#enable-billing) for the project.\n",
43
+ "3. [Enable BigQuery](https://console.cloud.google.com/flows/enableapi?apiid=bigquery) APIs for the project.\n"
44
+ ]
45
+ },
46
+ {
47
+ "cell_type": "code",
48
+ "metadata": {
49
+ "id": "Vcjo13Kejgij",
50
+ "colab_type": "code",
51
+ "colab": {}
52
+ },
53
+ "source": [
54
+ "#@title Please input your project id\n",
55
+ "import pandas as pd\n",
56
+ "import numpy as np\n",
57
+ "import altair as alt\n",
58
+ "from google.cloud import bigquery\n",
59
+ "# Provide credentials to the runtime\n",
60
+ "from google.colab import auth\n",
61
+ "from google.cloud.bigquery import magics\n",
62
+ "\n",
63
+ "auth.authenticate_user()\n",
64
+ "print('Authenticated')\n",
65
+ "project_id = '' #@param {type: \"string\"}\n",
66
+ "# Set the default project id for %bigquery magic\n",
67
+ "magics.context.project = project_id\n",
68
+ "\n",
69
+ "# Use the client to run queries constructed from a more complicated function.\n",
70
+ "client = bigquery.Client(project=project_id)"
71
+ ],
72
+ "execution_count": null,
73
+ "outputs": []
74
+ },
75
+ {
76
+ "cell_type": "markdown",
77
+ "metadata": {
78
+ "id": "NFUPuLiajrC8",
79
+ "colab_type": "text"
80
+ },
81
+ "source": [
82
+ "# Basic queries\n",
83
+ "\n",
84
+ "This section shows the most basic way of querying the trace using the [bigquery magic](https://googleapis.dev/python/bigquery/latest/magics.html)"
85
+ ]
86
+ },
87
+ {
88
+ "cell_type": "code",
89
+ "metadata": {
90
+ "id": "3xyBH9oQjr1w",
91
+ "colab_type": "code",
92
+ "colab": {}
93
+ },
94
+ "source": [
95
+ "%%bigquery\n",
96
+ "SELECT capacity.cpus AS cpu_cap, \n",
97
+ "capacity.memory AS memory_cap, \n",
98
+ "COUNT(DISTINCT machine_id) AS num_machines\n",
99
+ "FROM `google.com:google-cluster-data`.clusterdata_2019_a.machine_events\n",
100
+ "GROUP BY 1,2"
101
+ ],
102
+ "execution_count": null,
103
+ "outputs": []
104
+ },
105
+ {
106
+ "cell_type": "code",
107
+ "metadata": {
108
+ "id": "SzIHMxy2jvsM",
109
+ "colab_type": "code",
110
+ "colab": {}
111
+ },
112
+ "source": [
113
+ "%%bigquery\n",
114
+ "SELECT COUNT(DISTINCT collection_id) AS collections FROM \n",
115
+ "`google.com:google-cluster-data`.clusterdata_2019_a.collection_events;"
116
+ ],
117
+ "execution_count": null,
118
+ "outputs": []
119
+ },
120
+ {
121
+ "cell_type": "markdown",
122
+ "metadata": {
123
+ "id": "gm-gaRS-jwZj",
124
+ "colab_type": "text"
125
+ },
126
+ "source": [
127
+ "# Cell level resource usage time series\n",
128
+ "\n",
129
+ "This query takes a cell as input and plots a resource usage time-series for every hour of the trace broken down by tier."
130
+ ]
131
+ },
132
+ {
133
+ "cell_type": "code",
134
+ "metadata": {
135
+ "id": "ekhDGYOAjy54",
136
+ "colab_type": "code",
137
+ "colab": {}
138
+ },
139
+ "source": [
140
+ "#@title Select a cell and a resource to plot the cell level usage series\n",
141
+ "\n",
142
+ "def query_cell_capacity(cell):\n",
143
+ " return '''\n",
144
+ "SELECT SUM(cpu_cap) AS cpu_capacity,\n",
145
+ " SUM(memory_cap) AS memory_capacity\n",
146
+ "FROM (\n",
147
+ " SELECT machine_id, MAX(capacity.cpus) AS cpu_cap,\n",
148
+ " MAX(capacity.memory) AS memory_cap\n",
149
+ " FROM `google.com:google-cluster-data`.clusterdata_2019_{cell}.machine_events\n",
150
+ " GROUP BY 1\n",
151
+ ")\n",
152
+ " '''.format(cell=cell)\n",
153
+ "\n",
154
+ "def query_per_instance_usage_priority(cell):\n",
155
+ " return '''\n",
156
+ "SELECT u.time AS time,\n",
157
+ " u.collection_id AS collection_id,\n",
158
+ " u.instance_index AS instance_index,\n",
159
+ " e.priority AS priority,\n",
160
+ " CASE\n",
161
+ " WHEN e.priority BETWEEN 0 AND 99 THEN '1_free'\n",
162
+ " WHEN e.priority BETWEEN 100 AND 115 THEN '2_beb'\n",
163
+ " WHEN e.priority BETWEEN 116 AND 119 THEN '3_mid'\n",
164
+ " ELSE '4_prod'\n",
165
+ " END AS tier,\n",
166
+ " u.cpu_usage AS cpu_usage,\n",
167
+ " u.memory_usage AS memory_usage\n",
168
+ "FROM (\n",
169
+ " SELECT start_time AS time,\n",
170
+ " collection_id,\n",
171
+ " instance_index,\n",
172
+ " machine_id,\n",
173
+ " average_usage.cpus AS cpu_usage,\n",
174
+ " average_usage.memory AS memory_usage\n",
175
+ " FROM `google.com:google-cluster-data`.clusterdata_2019_{cell}.instance_usage\n",
176
+ " WHERE (alloc_collection_id IS NULL OR alloc_collection_id = 0)\n",
177
+ " AND (end_time - start_time) >= (5 * 60 * 1e6)\n",
178
+ ") AS u JOIN (\n",
179
+ " SELECT collection_id, instance_index, machine_id,\n",
180
+ " MAX(priority) AS priority\n",
181
+ " FROM `google.com:google-cluster-data`.clusterdata_2019_{cell}.instance_events\n",
182
+ " WHERE (alloc_collection_id IS NULL OR alloc_collection_id = 0)\n",
183
+ " GROUP BY 1, 2, 3\n",
184
+ ") AS e ON u.collection_id = e.collection_id\n",
185
+ " AND u.instance_index = e.instance_index\n",
186
+ " AND u.machine_id = e.machine_id\n",
187
+ " '''.format(cell=cell)\n",
188
+ "\n",
189
+ "def query_per_tier_utilization_time_series(cell, cpu_capacity, memory_capacity):\n",
190
+ " return '''\n",
191
+ "SELECT CAST(FLOOR(time/(1e6 * 60 * 60)) AS INT64) AS hour_index,\n",
192
+ " tier,\n",
193
+ " SUM(cpu_usage) / (12 * {cpu_capacity}) AS avg_cpu_usage,\n",
194
+ " SUM(memory_usage) / (12 * {memory_capacity}) AS avg_memory_usage\n",
195
+ "FROM ({table})\n",
196
+ "GROUP BY 1, 2 ORDER BY hour_index\n",
197
+ " '''.format(table=query_per_instance_usage_priority(cell),\n",
198
+ " cpu_capacity=cpu_capacity, memory_capacity=memory_capacity)\n",
199
+ " \n",
200
+ "def run_query_utilization_per_time_time_series(cell):\n",
201
+ " cell_cap = client.query(query_cell_capacity(cell)).to_dataframe()\n",
202
+ " query = query_per_tier_utilization_time_series(\n",
203
+ " cell,\n",
204
+ " cell_cap['cpu_capacity'][0],\n",
205
+ " cell_cap['memory_capacity'][0])\n",
206
+ " time_series = client.query(query).to_dataframe()\n",
207
+ " return time_series\n",
208
+ "\n",
209
+ "cell = 'c' #@param ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']\n",
210
+ "hourly_usage = run_query_utilization_per_time_time_series(cell)\n",
211
+ "\n",
212
+ "# CPU graph\n",
213
+ "cpu = alt.Chart(hourly_usage).mark_area().encode(\n",
214
+ " alt.X('hour_index:N'),\n",
215
+ " alt.Y('avg_cpu_usage:Q'),\n",
216
+ " color=alt.Color('tier', legend=alt.Legend(orient=\"left\")),\n",
217
+ " order=alt.Order('tier', sort='descending'),\n",
218
+ " tooltip=['hour_index', 'tier', 'avg_cpu_usage']\n",
219
+ " )\n",
220
+ "cpu.encoding.x.title = \"Hour\"\n",
221
+ "cpu.encoding.y.title = \"Average CPU usage\"\n",
222
+ "cpu.display()\n",
223
+ "\n",
224
+ "# Memory graph\n",
225
+ "memory = alt.Chart(hourly_usage).mark_area().encode(\n",
226
+ " alt.X('hour_index:N'),\n",
227
+ " alt.Y('avg_memory_usage:Q'),\n",
228
+ " color=alt.Color('tier', legend=alt.Legend(orient=\"left\")),\n",
229
+ " order=alt.Order('tier', sort='descending'),\n",
230
+ " tooltip=['hour_index', 'tier', 'avg_memory_usage']\n",
231
+ " )\n",
232
+ "memory.encoding.x.title = \"Hour\"\n",
233
+ "memory.encoding.y.title = \"Average memory usage\"\n",
234
+ "memory.display()"
235
+ ],
236
+ "execution_count": null,
237
+ "outputs": []
238
+ },
239
+ {
240
+ "cell_type": "markdown",
241
+ "metadata": {
242
+ "id": "qz9m4P5hj2bv",
243
+ "colab_type": "text"
244
+ },
245
+ "source": [
246
+ "#Per machine resource usage distribution\n",
247
+ "\n",
248
+ "This query takes a cell as input and plots a per-machine resource utilization CDF."
249
+ ]
250
+ },
251
+ {
252
+ "cell_type": "code",
253
+ "metadata": {
254
+ "id": "fgSP3kvyj25-",
255
+ "colab_type": "code",
256
+ "colab": {}
257
+ },
258
+ "source": [
259
+ "#@title Select a cell and plot its per-machine resource utilization CDFs\n",
260
+ "\n",
261
+ "# Functions to plot CDFs using Altair\n",
262
+ "def pick_quantiles_from_tall_dataframe(data, qcol, name=\"\"):\n",
263
+ " quantiles = pd.DataFrame([x for x in data[qcol]]).transpose()\n",
264
+ " if name != \"\":\n",
265
+ " quantiles.columns = data[name]\n",
266
+ " return quantiles\n",
267
+ "\n",
268
+ "# - data: a dataframe with one row and one or more columns of quantiles (results\n",
269
+ "# returned from APPROX_QUANTILES)\n",
270
+ "# - qcols: a list of names of the quantiles\n",
271
+ "# - names: the names of each returned quantiles' columns.\n",
272
+ "def pick_quantiles_from_wide_dataframe(data, qcols, names=[]):\n",
273
+ " quantiles = {}\n",
274
+ " i = 0\n",
275
+ " for qcol in qcols:\n",
276
+ " col_name = qcol\n",
277
+ " if i < len(names):\n",
278
+ " col_name = names[i]\n",
279
+ " quantiles[col_name] = data[qcol][0]\n",
280
+ " i+=1\n",
281
+ " return pd.DataFrame(quantiles)\n",
282
+ "\n",
283
+ "# - quantiles: a dataframe where each column contains the quantiles of one\n",
284
+ "# data set. The index (i.e. row names) of the dataframe is the quantile. The\n",
285
+ "# column names are the names of the data set.\n",
286
+ "def plot_cdfs(quantiles, xlab=\"Value\", ylab=\"CDF\",\n",
287
+ " legend_title=\"dataset\", labels=[],\n",
288
+ " interactive=False,\n",
289
+ " title=''):\n",
290
+ " dfs = []\n",
291
+ " label = legend_title\n",
292
+ " yval = range(quantiles.shape[0])\n",
293
+ " esp = 1.0/(len(quantiles)-1)\n",
294
+ " yval = [y * esp for y in yval]\n",
295
+ " while label == xlab or label == ylab:\n",
296
+ " label += '_'\n",
297
+ " for col_idx, col in enumerate(quantiles.columns):\n",
298
+ " col_label = col\n",
299
+ " if col_idx < len(labels):\n",
300
+ " col_label = labels[col_idx]\n",
301
+ " dfs.append(pd.DataFrame({\n",
302
+ " label: col_label,\n",
303
+ " xlab: quantiles[col],\n",
304
+ " ylab: yval\n",
305
+ " }))\n",
306
+ " cdfs = pd.concat(dfs)\n",
307
+ " lines = alt.Chart(cdfs).mark_line().encode(\n",
308
+ " # If you can draw a CDF, it has to be continuous real-valued\n",
309
+ " x=xlab+\":Q\",\n",
310
+ " y=ylab+\":Q\",\n",
311
+ " color=label+\":N\"\n",
312
+ " ).properties(\n",
313
+ " title=title\n",
314
+ " )\n",
315
+ " if not interactive:\n",
316
+ " return lines\n",
317
+ " # Create a selection that chooses the nearest point & selects based on x-value\n",
318
+ " nearest = alt.selection(type='single', nearest=True, on='mouseover',\n",
319
+ " fields=[ylab], empty='none')\n",
320
+ " # Transparent selectors across the chart. This is what tells us\n",
321
+ " # the y-value of the cursor\n",
322
+ " selectors = alt.Chart(cdfs).mark_point().encode(\n",
323
+ " y=ylab+\":Q\",\n",
324
+ " opacity=alt.value(0),\n",
325
+ " ).properties(\n",
326
+ " selection=nearest\n",
327
+ " )\n",
328
+ "\n",
329
+ " # Draw text labels near the points, and highlight based on selection\n",
330
+ " text = lines.mark_text(align='left', dx=5, dy=-5).encode(\n",
331
+ " text=alt.condition(nearest,\n",
332
+ " alt.Text(xlab+\":Q\", format=\".2f\"),\n",
333
+ " alt.value(' '))\n",
334
+ " )\n",
335
+ "\n",
336
+ " # Draw a rule at the location of the selection\n",
337
+ " rules = alt.Chart(cdfs).mark_rule(color='gray').encode(\n",
338
+ " y=ylab+\":Q\",\n",
339
+ " ).transform_filter(\n",
340
+ " nearest.ref()\n",
341
+ " )\n",
342
+ " # Draw points on the line, and highlight based on selection\n",
343
+ " points = lines.mark_point().encode(\n",
344
+ " opacity=alt.condition(nearest, alt.value(1), alt.value(0))\n",
345
+ " )\n",
346
+ " # Put the five layers into a chart and bind the data\n",
347
+ " return alt.layer(lines, selectors, rules, text, points).interactive(\n",
348
+ " bind_y=False)\n",
349
+ " \n",
350
+ "# Functions to create the query\n",
351
+ "\n",
352
+ "def query_machine_capacity(cell):\n",
353
+ " return '''\n",
354
+ "SELECT machine_id, MAX(capacity.cpus) AS cpu_cap,\n",
355
+ " MAX(capacity.memory) AS memory_cap\n",
356
+ "FROM `google.com:google-cluster-data`.clusterdata_2019_{cell}.machine_events\n",
357
+ "GROUP BY 1\n",
358
+ " '''.format(cell=cell)\n",
359
+ "\n",
360
+ "def query_top_level_instance_usage(cell):\n",
361
+ " return '''\n",
362
+ "SELECT CAST(FLOOR(start_time/(1e6 * 300)) * (1000000 * 300) AS INT64) AS time,\n",
363
+ " collection_id,\n",
364
+ " instance_index,\n",
365
+ " machine_id,\n",
366
+ " average_usage.cpus AS cpu_usage,\n",
367
+ " average_usage.memory AS memory_usage\n",
368
+ "FROM `google.com:google-cluster-data`.clusterdata_2019_{cell}.instance_usage\n",
369
+ "WHERE (alloc_collection_id IS NULL OR alloc_collection_id = 0)\n",
370
+ " AND (end_time - start_time) >= (5 * 60 * 1e6)\n",
371
+ " '''.format(cell=cell)\n",
372
+ "\n",
373
+ "def query_machine_usage(cell):\n",
374
+ " return '''\n",
375
+ "SELECT u.time AS time,\n",
376
+ " u.machine_id AS machine_id,\n",
377
+ " SUM(u.cpu_usage) AS cpu_usage,\n",
378
+ " SUM(u.memory_usage) AS memory_usage,\n",
379
+ " MAX(m.cpu_cap) AS cpu_capacity,\n",
380
+ " MAX(m.memory_cap) AS memory_capacity\n",
381
+ "FROM ({instance_usage}) AS u JOIN\n",
382
+ " ({machine_capacity}) AS m\n",
383
+ "ON u.machine_id = m.machine_id\n",
384
+ "GROUP BY 1, 2\n",
385
+ " '''.format(instance_usage = query_top_level_instance_usage(cell),\n",
386
+ " machine_capacity = query_machine_capacity(cell))\n",
387
+ " \n",
388
+ "def query_machine_utilization_distribution(cell):\n",
389
+ " return '''\n",
390
+ "SELECT APPROX_QUANTILES(IF(cpu_usage > cpu_capacity, 1.0, cpu_usage / cpu_capacity), 100) AS cpu_util_dist,\n",
391
+ " APPROX_QUANTILES(IF(memory_usage > memory_capacity, 1.0, memory_usage / memory_capacity), 100) AS memory_util_dist\n",
392
+ "FROM ({table})\n",
393
+ " '''.format(table = query_machine_usage(cell))\n",
394
+ "\n",
395
+ "cell = 'd' #@param ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']\n",
396
+ "query = query_machine_utilization_distribution(cell)\n",
397
+ "machine_util_dist = client.query(query).to_dataframe()\n",
398
+ "plot_cdfs(pick_quantiles_from_wide_dataframe(machine_util_dist, ['cpu_util_dist', 'memory_util_dist'], ['CPU', 'Memory']), xlab='x - resource utilization (%)', ylab=\"Probability (resource utilization < x)\", interactive=True)"
399
+ ],
400
+ "execution_count": null,
401
+ "outputs": []
402
+ }
403
+ ]
404
+ }
datasets/raw/internalbleeding4/026_UCR_Anomaly_DISTORTEDInternalBleeding15_1700_5684_5854.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/027_UCR_Anomaly_DISTORTEDInternalBleeding16_1200_4187_4199.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/028_UCR_Anomaly_DISTORTEDInternalBleeding17_1600_3198_3309.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/030_UCR_Anomaly_DISTORTEDInternalBleeding19_3000_4187_4197.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/032_UCR_Anomaly_DISTORTEDInternalBleeding4_1000_4675_5033.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/034_UCR_Anomaly_DISTORTEDInternalBleeding6_1500_3474_3629.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/035_UCR_Anomaly_DISTORTEDInternalBleeding8_2500_5865_5974.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/036_UCR_Anomaly_DISTORTEDInternalBleeding9_4200_6599_6681.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/132_UCR_Anomaly_InternalBleeding10_3200_4526_4556.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/133_UCR_Anomaly_InternalBleeding14_2800_5607_5634.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/134_UCR_Anomaly_InternalBleeding15_1700_5684_5854.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/135_UCR_Anomaly_InternalBleeding16_1200_4187_4199.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/138_UCR_Anomaly_InternalBleeding19_3000_4187_4197.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/140_UCR_Anomaly_InternalBleeding4_1000_4675_5033.txt ADDED
The diff for this file is too large to render. See raw diff
 
datasets/raw/internalbleeding4/143_UCR_Anomaly_InternalBleeding8_2500_5865_5974.txt ADDED
The diff for this file is too large to render. See raw diff