Commit b2a711a9 authored by Mateusz Pawlik's avatar Mateusz Pawlik
Browse files

register: Left only dataset. Used service for db connection. Dataset info...

register: Left only dataset. Used service for db connection. Dataset info passed from command line in JSON format.
parent 2ec26a01
......@@ -19,3 +19,6 @@ cd build
cmake ..
make
```
## PostgreSQL
Create ``~/.pg_service.conf`` on the machine where you execute the experiments.
......@@ -6,15 +6,16 @@ CREATE TABLE dataset (
number_trees integer NOT NULL,
avg_tree_size integer,
min_tree_size integer,
max_tree_size integer
);
DROP TABLE IF EXISTS algorithm CASCADE;
CREATE TABLE algorithm (
short_name varchar(31) PRIMARY KEY,
filename varchar(127) NOT NULL,
short_description text
max_tree_size integer,
number_labels integer
);
--
-- DROP TABLE IF EXISTS algorithm CASCADE;
-- CREATE TABLE algorithm (
-- short_name varchar(31) PRIMARY KEY,
-- filename varchar(127) NOT NULL,
-- short_description text
-- );
-- Common algorithm attributes.
--
......@@ -23,9 +24,9 @@ CREATE TABLE algorithm (
-- execution_id serial PRIMARY KEY,
-- experiments_version varchar(127),
-- experiments_timestamp timestamp,
-- hostname varchar(127),
-- dataset_short_name varchar(127) REFERENCES dataset(short_name),
-- dataset_parsing_time bigint,
-- algorithm_version varchar(127),
-- threshold decimal,
-- result_set_size integer,
......@@ -36,30 +37,33 @@ CREATE TABLE naive_self_join (
execution_id serial PRIMARY KEY,
experiments_version varchar(127),
experiments_timestamp timestamp,
hostname varchar(127),
dataset_short_name varchar(127) REFERENCES dataset(short_name),
dataset_parsing_time bigint,
algorithm_short_name varchar(31) REFERENCES algorithm(short_name),
algorithm_version varchar(127),
threshold decimal,
result_set_size integer,
-- Algorithm-specific attributes.
verification_algorithm varchar(31),
verification_candidates integer, -- All pairs of trees that the join looks at and verifies.
verification_time bigint -- Total time of the join.
);
DROP TABLE IF EXISTS allpairs_baseline_self_join;
CREATE TABLE allpairs_baseline_self_join (
DROP TABLE IF EXISTS allpairs_self_join;
CREATE TABLE allpairs_self_join (
-- Common attributes.
execution_id serial PRIMARY KEY,
experiments_version varchar(127),
experiments_timestamp timestamp,
hostname varchar(127),
dataset_short_name varchar(127) REFERENCES dataset(short_name),
dataset_parsing_time bigint,
algorithm_short_name varchar(31) REFERENCES algorithm(short_name),
algorithm_version varchar(127),
threshold decimal,
result_set_size integer,
-- Algorithm-specific attributes.
similarity_function varchar(127),
verification_algorithm varchar(31),
tree_to_set_time bigint,
filter_touched_pairs integer, -- Pairs of trees that the filter looks at.
filter_verification_candidates integer, -- Pairs of trees resulting from filter only.
......
......@@ -7,7 +7,7 @@ from psycopg2 import sql
# http://initd.org/psycopg/docs/sql.html#module-psycopg2.sql
def store_tuple(table_name, values_dict):
# Connect to database.
db = psycopg2.connect("")
db = psycopg2.connect("service=ted-join")
# Open a cursor to perform database operations
cur = db.cursor()
attributes = values_dict.keys()
......@@ -27,42 +27,14 @@ def store_tuple(table_name, values_dict):
def store_dataset(values_dict):
store_tuple('dataset', values_dict)
def store_algorithm(values_dict):
store_tuple('algorithm', values_dict)
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
'-d', '--dataset',
type=str,
help="Path to dataset."
)
group.add_argument(
'-a', '--algorithm',
type=json.loads,
help="Algorithm details as simple json file."
help="Path to dataset."
)
# parser.add_argument(
# '--connection-string',
# type=str,
# dest='conn_string',
# action='store',
# help="Specify a custom database connection string (default: empty string)",
# default="")
args = parser.parse_args()
if args.dataset is not None:
example_dataset_values_dict = {
'short_name' : 'D1',
'filename' : 'dataset_1.bracket',
'short_description' : 'First example dataset.',
'number_trees' : 100,
'avg_tree_size' : 10,
'min_tree_size' : 10,
'max_tree_size' : 10
}
store_dataset(example_dataset_values_dict)
if args.algorithm is not None:
print(args.algorithm)
store_algorithm(args.algorithm)
store_dataset(args.dataset)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment