Skip to content

Commit

Permalink
V0.5.5 (#81)
Browse files Browse the repository at this point in the history
* Prepare next release

* Masterscript: Improve exception messages

* Masterscript: Improve exception messages

* Masterscript: Read node information from dbms container

* Masterscript: Improve exception handling

* Masterscript: Improve exception handling

* Masterscript: Improve exception handling

* Masterscript: Relogin when access failed

* Masterscript: Relogin when access failed

* Masterscript: Relogin when access failed

* Masterscript: Relogin when access failed

* Masterscript: Remove storage template in StatefulSet if not needed

* Masterscript: Do not create experiments folder in data source

* Masterscript: quicktest without datatransfer possible

* Masterscript: Relogin when access failed - rerun function automatically

* Masterscript: Number of experiment in benchmarker parameter for evaluation

* Masterscript: Catch UTF-8 output error in kubectl

* Masterscript: Remove \r in DDL scripts (not parametrized, shell)
  • Loading branch information
perdelt authored May 27, 2021
1 parent 5152b90 commit 9afb40c
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 36 deletions.
43 changes: 24 additions & 19 deletions bexhoma/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def start_sut(self, app='', component='sut', experiment='', configuration=''):
if not use_storage:
del result[key]['spec']['template']['spec']['containers'][i]['volumeMounts'][j]
if not use_storage and 'volumeClaimTemplates' in result[key]['spec']['template']:
del result[key]['spec']['template']['volumeClaimTemplates']
del result[key]['spec']['volumeClaimTemplates']
#print(pvc)
if dep['kind'] == 'Service':
if dep['metadata']['name'] != 'bexhoma-service':
Expand Down Expand Up @@ -743,7 +743,7 @@ def checkGPUs(self):
print("checkGPUs")
cmd = {}
cmd['check_gpus'] = 'nvidia-smi'
stdin, stdout, stderr = self.experiment.cluster.executeCTL(cmd['check_gpus'], self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(cmd['check_gpus'], self.pod_sut, container='dbms')
def checkDBMS(self, ip, port):
found = False
s = socket.socket()
Expand All @@ -762,7 +762,7 @@ def getMemory(self):
try:
command = "grep MemTotal /proc/meminfo | awk '{print $2}'"
#fullcommand = 'kubectl exec '+self.pod_sut+' --container=dbms -- bash -c "'+command+'"'
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut, container='dbms')
result = stdout#os.popen(fullcommand).read()
mem = int(result.replace(" ","").replace("MemTotal:","").replace("kB",""))*1024#/1024/1024/1024
return mem
Expand All @@ -774,7 +774,7 @@ def getCPU(self):
command = 'more /proc/cpuinfo | grep \'model name\' | head -n 1'
#fullcommand = 'kubectl exec '+self.pod_sut+' --container=dbms -- bash -c "'+command+'"'
#cpu = os.popen(fullcommand).read()
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut, container='dbms')
cpu = stdout#os.popen(fullcommand).read()
cpu = cpu.replace('model name\t: ', '')
#cpu = cpu.replace('model name\t: ', 'CPU: ')
Expand All @@ -785,7 +785,7 @@ def getCores(self):
command = 'grep -c ^processor /proc/cpuinfo'
#fullcommand = 'kubectl exec '+self.pod_sut+' --container=dbms -- bash -c "'+command+'"'
#cores = os.popen(fullcommand).read()
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut, container='dbms')
cores = stdout#os.popen(fullcommand).read()
return int(cores)
def getHostsystem(self):
Expand All @@ -794,7 +794,7 @@ def getHostsystem(self):
command = 'uname -r'
#fullcommand = 'kubectl exec '+self.pod_sut+' --container=dbms -- bash -c "'+command+'"'
#host = os.popen(fullcommand).read()
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut, container='dbms')
host = stdout#os.popen(fullcommand).read()
return host.replace('\n','')
def getNode(self):
Expand All @@ -816,7 +816,7 @@ def getGPUs(self):
command = 'nvidia-smi -L'
#fullcommand = 'kubectl exec '+self.pod_sut+' --container=dbms -- bash -c "'+command+'"'
#gpus = os.popen(fullcommand).read()
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut, container='dbms')
gpus = stdout#os.popen(fullcommand).read()
l = gpus.split("\n")
c = Counter([x[x.find(":")+2:x.find("(")-1] for x in l if len(x)>0])
Expand All @@ -830,7 +830,7 @@ def getGPUIDs(self):
command = 'nvidia-smi -L'
#fullcommand = 'kubectl exec '+self.pod_sut+' --container=dbms -- bash -c "'+command+'"'
#gpus = os.popen(fullcommand).read()
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut, container='dbms')
gpus = stdout#os.popen(fullcommand).read()
l = gpus.split("\n")
result = []
Expand All @@ -845,15 +845,15 @@ def getCUDA(self):
command = 'nvidia-smi | grep \'CUDA\''
#fullcommand = 'kubectl exec '+self.pod_sut+' --container=dbms -- bash -c "'+command+'"'
#cuda = os.popen(fullcommand).read()
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut, container='dbms')
cuda = stdout#os.popen(fullcommand).read()
return cuda.replace('|', '').replace('\n','').strip()
def getTimediff(self):
print("getTimediff")
cmd = {}
command = 'date +"%s"'
#fullcommand = 'kubectl exec '+cluster.pod_sut+' --container=dbms -- bash -c "'+command+'"'
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut, container='dbms')
timestamp_remote = stdout#os.popen(fullcommand).read()
#timestamp_remote = os.popen(fullcommand).read()
timestamp_local = os.popen(command).read()
Expand All @@ -870,13 +870,13 @@ def getDiskSpaceUsedData(self):
try:
command = "du "+datadir+" | awk 'END{print \\$1}'"
cmd['disk_space_used'] = command
stdin, stdout, stderr = self.experiment.cluster.executeCTL(cmd['disk_space_used'], self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(cmd['disk_space_used'], self.pod_sut, container='dbms')
return int(stdout.replace('\n',''))
except Exception as e:
# Windows
command = "du "+datadir+" | awk 'END{print $1}'"
cmd['disk_space_used'] = command
stdin, stdout, stderr = self.experiment.cluster.executeCTL(cmd['disk_space_used'], self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(cmd['disk_space_used'], self.pod_sut, container='dbms')
if len(stdout) > 0:
return int(stdout.replace('\n',''))
return 0
Expand All @@ -888,15 +888,15 @@ def getDiskSpaceUsed(self):
command = "df / | awk 'NR == 2{print \\$3}'"
#fullcommand = 'kubectl exec '+self.pod_sut+' --container=dbms -- bash -c "'+command+'"'
#disk = os.popen(fullcommand).read()
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut, container='dbms')
disk = stdout#os.popen(fullcommand).read()
return int(disk.replace('\n',''))
except Exception as e:
# Windows
command = "df / | awk 'NR == 2{print $3}'"
#fullcommand = 'kubectl exec '+self.pod_sut+' --container=dbms -- bash -c "'+command+'"'
#disk = os.popen(fullcommand).read()
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut)
stdin, stdout, stderr = self.experiment.cluster.executeCTL(command=command, pod=self.pod_sut, container='dbms')
disk = stdout#os.popen(fullcommand).read()
if len(disk) > 0:
return int(disk.replace('\n',''))
Expand Down Expand Up @@ -1030,6 +1030,7 @@ def run_benchmarker_pod(self, connection=None, code=None, info=[], resultfolder=
c['parameter'] = {}
c['parameter']['parallelism'] = parallelism
c['parameter']['client'] = client
c['parameter']['numExperiment'] = str(self.numExperimentsDone+1)
#print(c)
#print(self.experiment.cluster.config['benchmarker']['jarfolder'])
if isinstance(c['JDBC']['jar'], list):
Expand Down Expand Up @@ -1100,8 +1101,10 @@ def run_benchmarker_pod(self, connection=None, code=None, info=[], resultfolder=
yamlfile = self.create_job(connection=connection, component=component, configuration=configuration, experiment=self.code, client=client, parallelism=parallelism, alias=c['alias'])
# start pod
self.experiment.cluster.kubectl('create -f '+yamlfile)
self.wait(10)
pods = self.experiment.cluster.getJobPods(component=component, configuration=configuration, experiment=self.code, client=client)
pods = []
while len(pods) == 0:
self.wait(10)
pods = self.experiment.cluster.getJobPods(component=component, configuration=configuration, experiment=self.code, client=client)
client_pod_name = pods[0]
status = self.experiment.cluster.getPodStatus(client_pod_name)
print(client_pod_name, status)
Expand Down Expand Up @@ -1212,9 +1215,9 @@ def prepareInit(self):
print("prepareInit")
pods = self.experiment.cluster.getPods(component='sut', configuration=self.configuration, experiment=self.code)
self.pod_sut = pods[0]
cmd = {}
cmd['prepare_init'] = 'mkdir -p /data/'+self.experiment.cluster.configfolder+'/'+self.configuration
stdin, stdout, stderr = self.executeCTL(cmd['prepare_init'], self.pod_sut)
#cmd = {}
#cmd['prepare_init'] = 'mkdir -p /data/'+self.experiment.cluster.configfolder+'/'+self.configuration
#stdin, stdout, stderr = self.executeCTL(cmd['prepare_init'], self.pod_sut)
#scriptfolder = '/data/{experiment}/{docker}/'.format(experiment=self.experiment.cluster.configfolder, docker=self.docker)
scriptfolder = '/tmp/'
# the inits are in the result folder?
Expand All @@ -1240,6 +1243,8 @@ def prepareInit(self):
filename = self.docker+'/'+script
if os.path.isfile(self.experiment.cluster.configfolder+'/'+filename):
self.experiment.cluster.kubectl('cp --container dbms {from_name} {to_name}'.format(from_name=self.experiment.cluster.configfolder+'/'+filename, to_name=self.pod_sut+':'+scriptfolder+script))
stdin, stdout, stderr = self.executeCTL("sed -i $'s/\\r//' {to_name}".format(to_name=scriptfolder+script), self.pod_sut)
#self.experiment.cluster.kubectl('cp --container dbms {from_name} {to_name}'.format(from_name=self.experiment.cluster.configfolder+'/'+filename, to_name=self.pod_sut+':'+scriptfolder+script))
def attach_worker(self):
if self.num_worker > 0:
pods = self.experiment.cluster.getPods(component='sut', configuration=self.configuration, experiment=self.code)
Expand Down
20 changes: 18 additions & 2 deletions bexhoma/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,28 @@ def __set_queryfile(self, queryfile):
def __set_configfolder(self, configfolder):
self.cluster.set_configfolder(configfolder)
def set_querymanagement_quicktest(self,
numRun=1):
numRun=1,
datatransfer=False):
self.set_querymanagement(
numWarmup = 0,
numCooldown = 0,
numRun = numRun,
delay = 0)
delay = 0,
timer = {
'connection':
{
'active': True,
'delay': 0
},
'datatransfer':
{
'active': datatransfer,
'sorted': True,
'compare': 'result',
'store': 'dataframe',
'precision': 0,
}
})
self.monitoring_active = False
def set_querymanagement_monitoring(self,
numRun=256,
Expand Down
Loading

0 comments on commit 9afb40c

Please sign in to comment.