1
1
"""
2
- :Date: 2018-08-22
3
- :Version: 0.1
2
+ :Date: 2022-05-01
3
+ :Version: 0.5
4
4
:Authors: Patrick Erdelt
5
5
6
- Demo of TPC-DS in a K8s Cluster.
6
+ Class for managing an experiment.
7
+ This is plugged into a cluster object.
8
+ It collects some configuation objects.
7
9
8
- # Compare 4 DBMS on different HW
9
- # 256 runs
10
- # no delay
11
- # Compare result sets
12
- # 2x each DBMS
13
- # MemSQL, OmniSci, MonetDB, PostgreSQL, maybe add MySQL, MariaDB, Kinetica?
14
- # Limit 4 CPUs
10
+ Two examples included, dealing with TPC-H and TPC-DS tests.
15
11
16
- This deals with the TPC-DS tests.
12
+ Copyright (C) 2020 Patrick Erdelt
13
+
14
+ This program is free software: you can redistribute it and/or modify
15
+ it under the terms of the GNU Affero General Public License as
16
+ published by the Free Software Foundation, either version 3 of the
17
+ License, or (at your option) any later version.
18
+
19
+ This program is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ GNU Affero General Public License for more details.
23
+
24
+ You should have received a copy of the GNU Affero General Public License
25
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
26
"""
18
- #from bexhoma import *
19
27
from dbmsbenchmarker import parameter , tools , inspector
20
28
import logging
21
29
import urllib3
@@ -315,7 +323,7 @@ def zip(self):
315
323
# include sub directories
316
324
#cmd['zip_results'] = 'cd /results;zip -r {code}.zip {code}'.format(code=self.code)
317
325
#fullcommand = 'kubectl exec '+pod_dashboard+' -- bash -c "'+cmd['zip_results'].replace('"','\\"')+'"'
318
- self .cluster .executeCTL (command = cmd ['zip_results' ], pod = pod_dashboard )#self.yamlfolder+deployment)
326
+ self .cluster .executeCTL (command = cmd ['zip_results' ], pod = pod_dashboard , container = "dashboard" )#self.yamlfolder+deployment)
319
327
#print(fullcommand)
320
328
#proc = subprocess.Popen(fullcommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
321
329
#stdout, stderr = proc.communicate()
@@ -340,26 +348,33 @@ def evaluate_results(self, pod_dashboard=''):
340
348
pods = self .cluster .getPods (component = 'dashboard' )
341
349
pod_dashboard = pods [0 ]
342
350
# copy logs and yamls to result folder
351
+ print ("Copy configuration and logs" , end = "" , flush = True )
343
352
directory = os .fsencode (self .path )
344
353
for file in os .listdir (directory ):
345
- filename = os .fsdecode (file )
346
- if filename .endswith (".log" ) or filename .endswith (".yml" ) or filename .endswith (".error" ):
347
- self .cluster .kubectl ('cp ' + self .path + "/" + filename + ' ' + pod_dashboard + ':/results/' + str (self .code )+ '/' + filename )
354
+ filename = os .fsdecode (file )
355
+ if filename .endswith (".log" ) or filename .endswith (".yml" ) or filename .endswith (".error" ):
356
+ self .cluster .kubectl ('cp ' + self .path + "/" + filename + ' ' + pod_dashboard + ':/results/' + str (self .code )+ '/' + filename + ' -c dashboard' )
357
+ print ("." , end = "" , flush = True )
358
+ print ("done!" )
348
359
cmd = {}
349
360
cmd ['update_dbmsbenchmarker' ] = 'git pull' #/'+str(self.code)
350
361
#fullcommand = 'kubectl exec '+pod_dashboard+' -- bash -c "'+cmd['update_dbmsbenchmarker'].replace('"','\\"')+'"'
351
- self .cluster .executeCTL (command = cmd ['update_dbmsbenchmarker' ], pod = pod_dashboard )
362
+ self .cluster .executeCTL (command = cmd ['update_dbmsbenchmarker' ], pod = pod_dashboard , container = "dashboard" )
352
363
#print(fullcommand)
353
364
#proc = subprocess.Popen(fullcommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
354
365
#stdout, stderr = proc.communicate()
366
+ print ("Join results " , end = "" , flush = True )
355
367
cmd ['merge_results' ] = 'python merge.py -r /results/ -c ' + str (self .code )
356
- self .cluster .executeCTL (command = cmd ['merge_results' ], pod = pod_dashboard )
368
+ self .cluster .executeCTL (command = cmd ['merge_results' ], pod = pod_dashboard , container = "dashboard" )
369
+ print ("done!" )
357
370
#fullcommand = 'kubectl exec '+pod_dashboard+' -- bash -c "'+cmd['merge_results'].replace('"','\\"')+'"'
358
371
#print(fullcommand)
359
372
#proc = subprocess.Popen(fullcommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
360
373
#stdout, stderr = proc.communicate()
374
+ print ("Build evaluation cube " , end = "" , flush = True )
361
375
cmd ['evaluate_results' ] = 'python benchmark.py read -e yes -r /results/' + str (self .code )
362
- self .cluster .executeCTL (command = cmd ['evaluate_results' ], pod = pod_dashboard )
376
+ self .cluster .executeCTL (command = cmd ['evaluate_results' ], pod = pod_dashboard , container = "dashboard" )
377
+ print ("done!" )
363
378
#fullcommand = 'kubectl exec '+pod_dashboard+' -- bash -c "'+cmd['evaluate_results'].replace('"','\\"')+'"'
364
379
#print(fullcommand)
365
380
#proc = subprocess.Popen(fullcommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
@@ -404,30 +419,41 @@ def add_benchmark_list(self, list_clients):
404
419
def work_benchmark_list (self , intervals = 30 , stop = True ):
405
420
do = True
406
421
while do :
407
- time .sleep (intervals )
422
+ #time.sleep(intervals)
423
+ self .wait (intervals )
424
+ # count number of running and pending pods
425
+ num_pods_running = len (self .cluster .getPods (app = self .appname , component = 'sut' , status = 'Running' ))
426
+ num_pods_pending = len (self .cluster .getPods (app = self .appname , component = 'sut' , status = 'Pending' ))
408
427
for config in self .configurations :
409
- # count number of running and pending pods
410
- num_pods_running = len (self .cluster .getPods (app = self .appname , component = 'sut' , status = 'Running' ))
411
- num_pods_pending = len (self .cluster .getPods (app = self .appname , component = 'sut' , status = 'Pending' ))
412
428
# check if sut is running
413
429
if not config .sut_is_running ():
414
- print ("{} is not running" .format (config .configuration ))
430
+ # print("{} is not running".format(config.configuration))
415
431
if not config .experiment_done :
416
432
if not config .sut_is_pending ():
433
+ print ("{} is not running yet - " .format (config .configuration ), end = "" , flush = True )
417
434
if self .cluster .max_sut is not None :
418
- print ("{} running and {} pending pods" .format (num_pods_running , num_pods_pending ) )
435
+ print ("{} running and {} pending pods: max is {} pods in the cluster - " .format (num_pods_running , num_pods_pending , self . cluster . max_sut ), end = "" , flush = True )
419
436
if num_pods_running + num_pods_pending < self .cluster .max_sut :
437
+ print ("it will start now" )
420
438
config .start_sut ()
421
- self .wait (10 )
439
+ num_pods_pending = num_pods_pending + 1
440
+ #self.wait(10)
441
+ else :
442
+ print ("it has to wait" )
422
443
else :
444
+ print ("it will start now" )
423
445
config .start_sut ()
424
- self .wait (10 )
446
+ num_pods_pending = num_pods_pending + 1
447
+ #self.wait(10)
448
+ else :
449
+ print ("{} is pending" .format (config .configuration ))
425
450
continue
426
451
# check if loading is done
427
452
config .check_load_data ()
428
453
# start loading
429
454
if not config .loading_started :
430
- print ("{} is not loaded" .format (config .configuration ))
455
+ if config .sut_is_running ():
456
+ print ("{} is not loaded yet" .format (config .configuration ))
431
457
if config .monitoring_active and not config .monitoring_is_running ():
432
458
print ("{} waits for monitoring" .format (config .configuration ))
433
459
if not config .monitoring_is_pending ():
@@ -446,7 +472,7 @@ def work_benchmark_list(self, intervals=30, stop=True):
446
472
# config demands other delay
447
473
delay = config .dockertemplate ['delay_prepare' ]
448
474
config .loading_after_time = now + timedelta (seconds = delay )
449
- print ("{} will start loading but not before {}" .format (config .configuration , config .loading_after_time .strftime ('%Y-%m-%d %H:%M:%S' )))
475
+ print ("{} will start loading but not before {} (that is in {} secs) " .format (config .configuration , config .loading_after_time .strftime ('%Y-%m-%d %H:%M:%S' ), delay ))
450
476
continue
451
477
# benchmark if loading is done and monitoring is ready
452
478
if config .loading_finished :
@@ -510,7 +536,8 @@ def work_benchmark_list(self, intervals=30, stop=True):
510
536
# status per pod
511
537
for p in pods :
512
538
status = self .cluster .getPodStatus (p )
513
- print (p ,status )
539
+ self .cluster .logger .debug ('job-pod {} has status {}' .format (p , status ))
540
+ #print(p,status)
514
541
if status == 'Succeeded' :
515
542
#if status != 'Running':
516
543
self .cluster .store_pod_log (p )
@@ -528,21 +555,22 @@ def work_benchmark_list(self, intervals=30, stop=True):
528
555
# status per job
529
556
for job in jobs :
530
557
success = self .cluster .getJobStatus (job )
531
- print (job , success )
558
+ self .cluster .logger .debug ('job {} has status {}' .format (job , success ))
559
+ #print(job, success)
532
560
if success :
533
561
self .cluster .deleteJob (job )
534
562
if len (pods ) == 0 and len (jobs ) == 0 :
535
563
do = False
536
564
for config in self .configurations :
537
565
#if config.sut_is_pending() or config.loading_started or len(config.benchmark_list) > 0:
538
566
if config .sut_is_pending ():
539
- print ("{} pending" .format (config .configuration ))
567
+ self . cluster . logger . debug ("{} pending" .format (config .configuration ))
540
568
do = True
541
569
if not config .loading_started :
542
- print ("{} not loaded" .format (config .configuration ))
570
+ self . cluster . logger . debug ("{} not loaded" .format (config .configuration ))
543
571
do = True
544
572
if len (config .benchmark_list ) > 0 :
545
- print ("{} still benchmarks to run" .format (config .configuration ))
573
+ self . cluster . logger . debug ("{} still benchmarks to run" .format (config .configuration ))
546
574
do = True
547
575
def benchmark_list (self , list_clients ):
548
576
for i , parallelism in enumerate (list_clients ):
@@ -596,6 +624,7 @@ def benchmark_list(self, list_clients):
596
624
break
597
625
def stop_benchmarker (self , configuration = '' ):
598
626
# all jobs of configuration - benchmarker
627
+ self .cluster .logger .debug ("experiment.stop_benchmarker({})" .format (configuration ))
599
628
app = self .appname
600
629
component = 'benchmarker'
601
630
jobs = self .cluster .getJobs (app , component , self .code , configuration )
0 commit comments