Skip to content
Open

Post #12

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/benchmarks/pgbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def run_tests(self, csv_queue):
# derive configuration for the CPU count / RAM size
configs = PgBench._configure(cpu_count(), available_ram())

results = {'ro': {}, 'rw': {}}
results = {'ro': {}, 'rw': {}} #ro:read only rw:read-write
j = 0
for config in configs:
scale = config['scale']
Expand Down
27 changes: 14 additions & 13 deletions client/benchmarks/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def _run_config(self, config_name):
# expand the attribute names
bench = bench(**config['config'])

self._cluster.start(config=config['postgres'])
self._cluster.start(
config=config['postgres']) # obtain the database name pgperffarm-db

# start collector(s) of additional info
self._collector.start()
Expand Down Expand Up @@ -116,16 +117,16 @@ def _run_config(self, config_name):
uname = check_output(['uname', '-a'])

r['meta'] = {
'benchmark': config['benchmark'],
'date': strftime("%Y-%m-%d %H:%M:%S.000000+00", gmtime()),
'name': config_name,
'uname': uname,
'benchmark': config['benchmark'],
'date': strftime("%Y-%m-%d %H:%M:%S.000000+00", gmtime()),
'name': config_name,
'uname': uname,
}

r['postgres'] = {
'branch': config['branch'],
'commit': config['commit'],
'settings': config['postgres'],
'branch': config['branch'],
'commit': config['commit'],
'settings': config['postgres'],
}

with open('%s/results.json' % self._output, 'w') as f:
Expand All @@ -134,23 +135,23 @@ def _run_config(self, config_name):
try:
self._upload_results(r)
except Exception as e:
print (e)
print(e)

def _upload_results(self, results):

postdata = results
post = []
postdata = results
post = []
post.append(postdata)

headers = {'Content-Type': 'application/json; charset=utf-8', 'Authorization': self._secret}
# r = requests.post(self._url+"upload/".encode('utf-8'), data=json.dumps(post).encode('utf-8'), headers=headers)
r = requests.post(self._url.encode('utf-8'), data=json.dumps(post).encode('utf-8'), headers=headers)


def run(self):
'run all the configured benchmarks'

# Removing the existing directory

try:
os.mkdir(self._output)
except OSError as e:
Expand Down
13 changes: 13 additions & 0 deletions client/benchmarks/test_upload_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import json
import requests

url = 'http://127.0.0.1:8000/upload/'
secret = 'e984c3017cd1a0dff0ef9f0c394a5c285e421411'
headers = {'Content-Type': 'application/json; charset=utf-8', 'Authorization': secret}
with open("/home/guo/PythonClass/results0222.json", 'r') as load_f:
load_data = json.load(load_f)
postdata = load_data
post = []
post.append(postdata)

r = requests.post(url.encode('utf-8'), data=json.dumps(post).encode('utf-8'), headers=headers)
4 changes: 2 additions & 2 deletions client/collectors/collectd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from utils.logging import log
from utils.misc import run_cmd

COLLECTD_CONFIG = '/tmp/.collectd.conf'
COLLECTD_PIDFILE = '/tmp/.collectd.pid'
COLLECTD_CONFIG = '/raid/.collectd.conf'
COLLECTD_PIDFILE = '/raid/.collectd.pid'


class CollectdCollector(object):
Expand Down
5 changes: 3 additions & 2 deletions client/perffarm-client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@

from settings_local import *
from settings import *
API_URL = 'http://127.0.0.1:8000/'
MACHINE_SECRET = '610f79063e62e6ad09460ac2c4e66da0386dc89b'
# API_URL = 'http://127.0.0.1:8000/'
API_URL = 'http://127.0.0.1:8000/upload/'
MACHINE_SECRET = 'e984c3017cd1a0dff0ef9f0c394a5c285e421411' #This machine secrete is specific to my environment
if __name__ == '__main__':

with FileLock('.lock') as lock:
Expand Down
2 changes: 1 addition & 1 deletion client/post-example/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@
"name": "pgbench-basic",
"uname": "Darwin Ilas-MacBook-Air.local 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64\n"
}
}
}
Loading