Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
access-node
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
LuFG VR VIS
VR-Group
In Situ Pipeline
access-node
Commits
159a8ef2
Commit
159a8ef2
authored
5 years ago
by
Jan Müller
Browse files
Options
Downloads
Patches
Plain Diff
Remove Table setup
parent
04f233ad
No related branches found
No related tags found
1 merge request
!5
Feature/remove postgres from docker compose
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
access_node/__main__.py
+2
-108
2 additions, 108 deletions
access_node/__main__.py
with
2 additions
and
108 deletions
access_node/__main__.py
+
2
−
108
View file @
159a8ef2
...
@@ -16,117 +16,11 @@ def ConnectToDatabase(postgres_username, postgres_password, port):
...
@@ -16,117 +16,11 @@ def ConnectToDatabase(postgres_username, postgres_password, port):
return
psycopg2
.
connect
(
database
=
"
postgres
"
,
user
=
postgres_username
,
return
psycopg2
.
connect
(
database
=
"
postgres
"
,
user
=
postgres_username
,
password
=
postgres_password
,
host
=
"
database
"
,
port
=
str
(
port
))
password
=
postgres_password
,
host
=
"
database
"
,
port
=
str
(
port
))
def
SetupNestTables
(
postgres_username
,
postgres_password
,
port
):
con
=
ConnectToDatabase
(
postgres_username
,
postgres_password
,
port
)
print
(
"
Database connection opened successfully!
"
)
cur
=
con
.
cursor
()
cur
.
execute
(
"
DROP TABLE IF EXISTS nest_simulation_node CASCADE
"
)
cur
.
execute
(
"
DROP TABLE IF EXISTS nest_multimeter CASCADE
"
)
cur
.
execute
(
"
DROP TABLE IF EXISTS nest_neuron CASCADE
"
)
cur
.
execute
(
"
DROP TABLE IF EXISTS nest_neuron_multimeter CASCADE
"
)
cur
.
execute
(
'''
CREATE TABLE nest_simulation_node (
id SERIAL PRIMARY KEY NOT NULL UNIQUE,
address VARCHAR(50),
current_simulation_time FLOAT
);
'''
)
cur
.
execute
(
'''
CREATE TABLE nest_multimeter (
id INT PRIMARY KEY NOT NULL UNIQUE,
attributes VARCHAR(50) ARRAY
);
'''
)
cur
.
execute
(
'''
CREATE TABLE nest_neuron (
id INT PRIMARY KEY NOT NULL UNIQUE,
simulation_node_id INT,
population_id INT,
position FLOAT[],
FOREIGN KEY (simulation_node_id) REFERENCES nest_simulation_node (id)
);
'''
)
cur
.
execute
(
'''
CREATE TABLE nest_neuron_multimeter (
neuron_id INT NOT NULL,
multimeter_id INT NOT NULL,
PRIMARY KEY (neuron_id,multimeter_id),
FOREIGN KEY (neuron_id) REFERENCES nest_neuron (id),
FOREIGN KEY (multimeter_id) REFERENCES nest_multimeter (id)
);
'''
)
con
.
commit
()
con
.
close
()
print
(
"
Nest tables created successfully!
\n
"
)
def
SetupArborTables
(
postgres_username
,
postgres_password
,
port
):
con
=
ConnectToDatabase
(
postgres_username
,
postgres_password
,
port
)
print
(
"
Database connection opened successfully!
"
)
cur
=
con
.
cursor
()
cur
.
execute
(
"
DROP TABLE IF EXISTS arbor_probe CASCADE
"
)
cur
.
execute
(
"
DROP TABLE IF EXISTS arbor_cell CASCADE
"
)
cur
.
execute
(
"
DROP TABLE IF EXISTS arbor_simulation_node CASCADE
"
)
cur
.
execute
(
"
DROP TABLE IF EXISTS arbor_attribute CASCADE
"
)
cur
.
execute
(
'''
CREATE TABLE arbor_simulation_node (
id INT PRIMARY KEY NOT NULL UNIQUE,
address VARCHAR(50),
current_simulation_time FLOAT
);
'''
)
cur
.
execute
(
'''
CREATE TABLE arbor_cell (
id INT PRIMARY KEY NOT NULL UNIQUE
);
'''
)
cur
.
execute
(
'''
CREATE TABLE cell_property (
cell_id INT NOT NULL,
property VARCHAR(50) NOT NULL,
PRIMARY KEY (cell_id, property),
FOREIGN KEY (cell_id) REFERENCES arbor_cell (id),
);
'''
)
cur
.
execute
(
'''
CREATE TABLE arbor_attribute (
id INT PRIMARY KEY NOT NULL UNIQUE,
name VARCHAR(50) NOT NULL,
);
'''
)
cur
.
execute
(
'''
CREATE TABLE arbor_probe (
id INT PRIMARY KEY NOT NULL UNIQUE,
cell_id INT NOT NULL,
segment_id INT NOT NULL,
position FLOAT,
attribute_id INT NOT NULL,
simulation_node_id INT,
FOREIGN KEY (simulation_node_id) REFERENCES arbor_simulation_node (id),
FOREIGN KEY (cell_id) REFERENCES arbor_cell (id),
FOREIGN KEY (attribute_id) REFERENCES arbor_attribute (id)
);
'''
)
con
.
commit
()
con
.
close
()
print
(
"
Arbor tables created successfully!
\n
"
)
def
main
():
def
main
():
# Connect to the Database and initalize basic Table structure
SetupNestTables
(
'
postgres
'
,
'
docker
'
,
5432
)
#SetupArborTables('postgres', 'docker', 5432)
# Wait for simulation nodes to post to database
# Wait for simulation nodes to post to database
time
.
sleep
(
5
)
time
.
sleep
(
5
)
# get simulation nodes
# get simulation nodes
con
=
ConnectToDatabase
(
'
postgres
'
,
'
docker
'
,
5432
)
con
=
ConnectToDatabase
(
'
postgres
'
,
'
docker
'
,
5432
)
cur
=
con
.
cursor
()
cur
=
con
.
cursor
()
...
@@ -134,8 +28,8 @@ def main():
...
@@ -134,8 +28,8 @@ def main():
cur
.
execute
(
"
SELECT address FROM nest_simulation_node
"
)
cur
.
execute
(
"
SELECT address FROM nest_simulation_node
"
)
nodes
.
nest_simulation_nodes
=
[
i
[
0
]
for
i
in
cur
.
fetchall
()]
nodes
.
nest_simulation_nodes
=
[
i
[
0
]
for
i
in
cur
.
fetchall
()]
# Arbor
# Arbor
#
cur.execute("SELECT address FROM nest_simulation_node")
cur
.
execute
(
"
SELECT address FROM nest_simulation_node
"
)
#
nodes.
nest
_simulation_nodes = [i[0] for i in cur.fetchall()]
nodes
.
arbor
_simulation_nodes
=
[
i
[
0
]
for
i
in
cur
.
fetchall
()]
con
.
close
()
con
.
close
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment