add fig5
This commit is contained in:
parent
5671678414
commit
a75b7b5d6c
35 changed files with 1413633 additions and 5 deletions
|
@ -83,7 +83,7 @@ usage_schema = StructType() \
|
|||
.add("cpu_usage_dist_98", DoubleType(), True) \
|
||||
.add("cpu_usage_dist_99", DoubleType(), True)
|
||||
|
||||
dfu = spark.read.format("csv") \
|
||||
dfu = spark.read.format("json") \
|
||||
.option("header", False) \
|
||||
.schema(usage_schema) \
|
||||
.load(dfupath)
|
||||
|
|
|
@ -62,15 +62,16 @@ spark = pyspark.sql.SparkSession.builder \
|
|||
.appName("task_slowdown") \
|
||||
.config("spark.driver.maxResultSize", "256g") \
|
||||
.config("spark.local.dir", "/home/claudio/tmp") \
|
||||
.config("spark.driver.memory", "120g") \
|
||||
.config("spark.driver.memory", "200g") \
|
||||
.getOrCreate()
|
||||
sc = spark.sparkContext
|
||||
|
||||
path = "/home/claudio/" + cluster + "/" + cluster
|
||||
path += "_instance_usage*.csv.gz"
|
||||
# path = "/home/claudio/" + cluster + "/" + cluster
|
||||
# path += "_instance_usage*.csv.gz"
|
||||
path = "/home/claudio/raid0/google_2019/instance_usage/" + cluster + "/" + cluster + "_instance_usage*.json.gz"
|
||||
#path += "_test.csv"
|
||||
|
||||
df = spark.read.format("csv") \
|
||||
df = spark.read.format("json") \
|
||||
.option("header", False) \
|
||||
.schema(schema) \
|
||||
.load(path)
|
||||
|
|
BIN
table_iii/fig-5-a.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-a.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
table_iii/fig-5-a.csv/.part-00000-0ad0271d-5da5-437b-ba73-2ffe41d3c0f8-c000.csv.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-a.csv/.part-00000-0ad0271d-5da5-437b-ba73-2ffe41d3c0f8-c000.csv.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load diff
BIN
table_iii/fig-5-b.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-b.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
table_iii/fig-5-b.csv/.part-00000-a0b1f953-7af1-4d33-a45a-f9014f56538c-c000.csv.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-b.csv/.part-00000-a0b1f953-7af1-4d33-a45a-f9014f56538c-c000.csv.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
0
table_iii/fig-5-b.csv/_SUCCESS
Normal file
0
table_iii/fig-5-b.csv/_SUCCESS
Normal file
File diff suppressed because it is too large
Load diff
BIN
table_iii/fig-5-c.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-c.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
table_iii/fig-5-c.csv/.part-00000-b3212a36-74af-4df5-b713-80609929c4dc-c000.csv.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-c.csv/.part-00000-b3212a36-74af-4df5-b713-80609929c4dc-c000.csv.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
0
table_iii/fig-5-c.csv/_SUCCESS
Normal file
0
table_iii/fig-5-c.csv/_SUCCESS
Normal file
File diff suppressed because it is too large
Load diff
BIN
table_iii/fig-5-d.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-d.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
table_iii/fig-5-d.csv/.part-00000-13c93e09-08b4-4488-8a27-fa01f70f53ee-c000.csv.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-d.csv/.part-00000-13c93e09-08b4-4488-8a27-fa01f70f53ee-c000.csv.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
0
table_iii/fig-5-d.csv/_SUCCESS
Normal file
0
table_iii/fig-5-d.csv/_SUCCESS
Normal file
File diff suppressed because it is too large
Load diff
BIN
table_iii/fig-5-e.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-e.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
table_iii/fig-5-e.csv/.part-00000-89d3a90f-3397-424d-a70b-de29400997dd-c000.csv.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-e.csv/.part-00000-89d3a90f-3397-424d-a70b-de29400997dd-c000.csv.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
0
table_iii/fig-5-e.csv/_SUCCESS
Normal file
0
table_iii/fig-5-e.csv/_SUCCESS
Normal file
File diff suppressed because it is too large
Load diff
BIN
table_iii/fig-5-f.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-f.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
table_iii/fig-5-f.csv/.part-00000-9b159a43-e183-4e68-92cc-276c31cd4f8f-c000.csv.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-f.csv/.part-00000-9b159a43-e183-4e68-92cc-276c31cd4f8f-c000.csv.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
0
table_iii/fig-5-f.csv/_SUCCESS
Normal file
0
table_iii/fig-5-f.csv/_SUCCESS
Normal file
File diff suppressed because it is too large
Load diff
BIN
table_iii/fig-5-g.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-g.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
table_iii/fig-5-g.csv/.part-00000-2dca19ca-78f8-496d-a3c2-7ec8a1ea7964-c000.csv.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-g.csv/.part-00000-2dca19ca-78f8-496d-a3c2-7ec8a1ea7964-c000.csv.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
0
table_iii/fig-5-g.csv/_SUCCESS
Normal file
0
table_iii/fig-5-g.csv/_SUCCESS
Normal file
File diff suppressed because it is too large
Load diff
BIN
table_iii/fig-5-h.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-h.csv/._SUCCESS.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
table_iii/fig-5-h.csv/.part-00000-4f5514d0-e72b-4590-8c23-0fd8a5684bbf-c000.csv.crc
(Stored with Git LFS)
Normal file
BIN
table_iii/fig-5-h.csv/.part-00000-4f5514d0-e72b-4590-8c23-0fd8a5684bbf-c000.csv.crc
(Stored with Git LFS)
Normal file
Binary file not shown.
0
table_iii/fig-5-h.csv/_SUCCESS
Normal file
0
table_iii/fig-5-h.csv/_SUCCESS
Normal file
File diff suppressed because it is too large
Load diff
68
table_iii/fig5.py
Executable file
68
table_iii/fig5.py
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env python3
|
||||
# coding: utf-8
|
||||
|
||||
import json
|
||||
import pandas
|
||||
import findspark
|
||||
findspark.init()
|
||||
import pyspark
|
||||
import pyspark.sql
|
||||
import sys
|
||||
import gzip
|
||||
import os
|
||||
|
||||
import pyspark.sql.functions as F
|
||||
from pyspark import AccumulatorParam
|
||||
from pyspark.sql.functions import lit
|
||||
from pyspark.sql import Window
|
||||
from pyspark.sql.types import StructType, LongType, StringType, ByteType
|
||||
|
||||
def main():
|
||||
global DIR
|
||||
global NAME
|
||||
global launched
|
||||
|
||||
if len(sys.argv) != 4:
|
||||
print(sys.argv[0] + " {cluster} {tmpdir} {maxram}")
|
||||
sys.exit()
|
||||
|
||||
cluster=sys.argv[1]
|
||||
DIR = os.path.dirname(__file__)
|
||||
NAME = "fig-5-" + cluster
|
||||
|
||||
if os.path.exists(DIR + "/" + NAME + "-working") or os.path.exists(DIR + "/" + NAME + ".parquet"):
|
||||
print("already launched")
|
||||
launched = True
|
||||
sys.exit()
|
||||
|
||||
os.system("touch " + DIR + "/" + NAME + "-working")
|
||||
|
||||
spark = pyspark.sql.SparkSession.builder \
|
||||
.appName(NAME) \
|
||||
.config("spark.driver.maxResultSize", "32g") \
|
||||
.config("spark.local.dir", sys.argv[2]) \
|
||||
.config("spark.driver.memory", sys.argv[3]) \
|
||||
.getOrCreate()
|
||||
sc = spark.sparkContext
|
||||
|
||||
df = spark.read.parquet(DIR + "/bigtable-" + cluster + ".parquet")
|
||||
|
||||
cnt_cond = lambda cond: F.sum(F.when(cond, 1).otherwise(0))
|
||||
|
||||
df = df.groupBy(["count_4", "count_5", "count_7", "count_8"]).agg( \
|
||||
cnt_cond(F.col('task_term') == 6).alias('count_succ'),
|
||||
cnt_cond(F.col('task_term') != 6).alias('count_not_succ'))
|
||||
|
||||
df.repartition(1).write.csv(DIR + "/" + NAME + ".csv")
|
||||
|
||||
if __name__ == "__main__":
|
||||
launched = False
|
||||
DIR = None
|
||||
NAME = None
|
||||
try:
|
||||
main()
|
||||
finally:
|
||||
if not launched and DIR and NAME:
|
||||
os.system("rm -v " + DIR + "/" + NAME + "-working")
|
||||
|
||||
# vim: set ts=4 sw=4 et tw=120:
|
Loading…
Reference in a new issue