Skip to content

modify files related uploading, run through the flow #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/django-postgres-stack.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added client/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file added client/__pycache__/settings_local.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 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 All @@ -223,6 +223,7 @@ def run_tests(self, csv_queue):
results['ro'][scale] = {}
if scale not in results['rw']:
results['rw'][scale] = {}
#print(results)

# init for the dataset scale and warmup
self._init(scale)
Expand Down
6 changes: 4 additions & 2 deletions client/benchmarks/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ 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 l44 'postgres': postgres_config,

# start collector(s) of additional info
self._collector.start()
Expand Down Expand Up @@ -143,8 +143,10 @@ def _upload_results(self, results):
post.append(postdata)

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

print(self._url)
# print(post)

def run(self):
'run all the configured benchmarks'
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
13 changes: 8 additions & 5 deletions client/perffarm-client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

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 = '610f79063e62e6ad09460ac2c4e66da0386dc89b'
MACHINE_SECRET = 'e984c3017cd1a0dff0ef9f0c394a5c285e421411'
if __name__ == '__main__':

with FileLock('.lock') as lock:
Expand All @@ -34,8 +36,9 @@
'''

# clone repository and build the sources
print(0000000000000000000000000)
repository = GitRepository(url=GIT_URL, path=REPOSITORY_PATH)
print(repository.current_branch())
print(repository.current_branch())#we are in django-...,but not postgre repo

#if GIT_CLONE:
# repository.clone_or_update()
Expand Down Expand Up @@ -70,8 +73,8 @@
PGBENCH_CONFIG['results_dir'] = OUTPUT_DIR
runner.register_config('pgbench-basic',
'pgbench',
repository.current_branch(),
repository.current_commit(),
'master',
'akfhdfwiowhqgjog',
dbname=DATABASE_NAME,
bin_path=('%s/bin' % (BUILD_PATH,)),
postgres_config=POSTGRES_CONFIG,
Expand Down
14 changes: 8 additions & 6 deletions client/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import sys

# global configuration
GIT_URL = 'https://github.com/postgres/postgres.git'
REPOSITORY_PATH = '/tmp/git-postgres'
BUILD_PATH = '/Users/chenzhang/anaconda3'
GIT_URL = 'https://gitee.com/purpleyu/postgres.git'
REPOSITORY_PATH = '/raid/git-postgres'
# REPOSITORY_PATH = '/home/guo/Documents/git-postgres/postgres'
BUILD_PATH = '/usr/lib/postgresql/11'
BIN_PATH = os.path.join(BUILD_PATH, 'bin')
DATADIR_PATH = '/tmp/data-postgres'
DATADIR_PATH = '/raid/data-postgres'
# DATADIR_PATH = '/home/guo/Documents/git-postgres/postgres'

POSTGRES_CONFIG = {
'shared_buffers': '1GB',
Expand All @@ -22,9 +24,9 @@
'checkpoint_completion_target': '0.9',
}

DATABASE_NAME = 'postgres' # This name needs to be the same as rest_api settings_local.py database NAME
DATABASE_NAME = 'pgperffarm-db' # This name needs to be the same as rest_api settings_local.py database NAME

OUTPUT_DIR = '/tmp/perf-output'
OUTPUT_DIR = '/raid/perf-output'

# configuration for PgBench
# runs - number of repetitions (including test for all client counts)
Expand Down
Binary file added client/utils/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added client/utils/__pycache__/cluster.cpython-36.pyc
Binary file not shown.
Binary file added client/utils/__pycache__/git.cpython-36.pyc
Binary file not shown.
Binary file added client/utils/__pycache__/locking.cpython-36.pyc
Binary file not shown.
Binary file added client/utils/__pycache__/logging.cpython-36.pyc
Binary file not shown.
Binary file added client/utils/__pycache__/misc.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
49 changes: 49 additions & 0 deletions rest_api/apps/machines/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-02-03 17:22
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Alias',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=32, unique=True, verbose_name='alias name')),
('is_used', models.BooleanField(default=False, verbose_name='is_used')),
('add_time', models.DateTimeField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='Machine',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('add_time', models.DateTimeField(auto_now_add=True)),
('alias', models.CharField(blank=True, default='', max_length=100)),
('machine_secret', models.CharField(blank=True, default='', max_length=32, verbose_name='machine secret')),
('sn', models.CharField(blank=True, default='', max_length=16)),
('os_name', models.CharField(blank=True, default='', max_length=100)),
('os_version', models.CharField(blank=True, default='', max_length=100)),
('comp_name', models.CharField(blank=True, default='', max_length=100)),
('comp_version', models.CharField(blank=True, default='', max_length=100)),
('state', models.CharField(choices=[('A', 'Active'), ('I', 'Inactive')], default='A', max_length=10)),
('owner_email', models.EmailField(max_length=256, verbose_name='email')),
('owner_username', models.CharField(blank=True, default='', max_length=100)),
('owner_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='machines', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ('add_time',),
},
),
]
20 changes: 20 additions & 0 deletions rest_api/apps/machines/migrations/0002_auto_20200213_1523.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-02-13 15:23
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('machines', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='machine',
name='machine_secret',
field=models.CharField(blank=True, default='', max_length=100, verbose_name='machine secret'),
),
]
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion rest_api/apps/machines/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Machine(models.Model):

add_time = models.DateTimeField(auto_now_add=True)
alias = models.CharField(max_length=100, blank=True, default='')
machine_secret = models.CharField(max_length=32, blank=True, default='', verbose_name="machine secret")
machine_secret = models.CharField(max_length=100, blank=True, default='', verbose_name="machine secret")
sn = models.CharField(max_length=16, blank=True, default='')
os_name = models.CharField(max_length=100, blank=True, default='')
os_version = models.CharField(max_length=100, blank=True, default='')
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading