diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4c4b6134968f43ae12d65f185a89cc226dde028c..18132a933cf00ba79537d0d7335b71a182588bd6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,8 +29,9 @@ deploy:master: script: - docker build -t rwthvr/insite-access-node . - VERSION=$(git tag --points-at $CI_COMMIT_SHA) + - echo $VERSION - > [[ $VERSION =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]] - - docker tag rwthvr/insite-access-node rwthvr/access-node:$VERSION + - docker tag rwthvr/insite-access-node rwthvr/insite-access-node:$VERSION - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - docker push rwthvr/insite-access-node diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION index 752a79ef362d2555ab0957f30657c0d6616b6cb5..9c846566f75616c7b35868e1fe4f8d9e25e634c9 100644 --- a/.swagger-codegen/VERSION +++ b/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.8 \ No newline at end of file +2.4.13 \ No newline at end of file diff --git a/access_node/__main__.py b/access_node/__main__.py index a7919408701e8fe108583dcd287bfe87d9739d0a..1dfe50e34ce032d95e5989617477fa92d550fdc8 100644 --- a/access_node/__main__.py +++ b/access_node/__main__.py @@ -25,18 +25,18 @@ def ConnectToDatabase(postgres_username, postgres_password): def main(): # Wait for simulation nodes to post to database - time.sleep(5) - - # get simulation nodes - con = ConnectToDatabase('postgres', 'postgres') - cur = con.cursor() - # NEST - cur.execute("SELECT address FROM nest_simulation_node") - nodes.nest_simulation_nodes = [i[0] for i in cur.fetchall()] - # Arbor - cur.execute("SELECT address FROM nest_simulation_node") - nodes.arbor_simulation_nodes = [i[0] for i in cur.fetchall()] - con.close() + time.sleep(0.1) + + # # get simulation nodes + # con = ConnectToDatabase('postgres', 'postgres') + # cur = con.cursor() + # # NEST + # cur.execute("SELECT address FROM nest_simulation_node") + # nodes.nest_simulation_nodes = [i[0] for i in cur.fetchall()] + # # Arbor + # cur.execute("SELECT address FROM nest_simulation_node") + # nodes.arbor_simulation_nodes = [i[0] for i in cur.fetchall()] + # con.close() # run acces_node diff --git a/access_node/controllers/arbor_controller.py b/access_node/controllers/arbor_controller.py index 5ce7f7706e8d94b57be933da8153fd8dea1ec1bd..8fcc75f8f2ee52471aca19572c8dc1a0aac43515 100644 --- a/access_node/controllers/arbor_controller.py +++ b/access_node/controllers/arbor_controller.py @@ -26,7 +26,7 @@ def connect_to_database(): def arbor_get_attributes(): # noqa: E501 - """Retrieves the list of all attributes. + """Retrieves a list of all attributes. # noqa: E501 @@ -44,7 +44,7 @@ def arbor_get_attributes(): # noqa: E501 def arbor_get_cell_ids(): # noqa: E501 - """Retrieves the list of all cell ids. + """Retrieves a list of all cell ids. # noqa: E501 @@ -98,7 +98,7 @@ def arbor_get_measurements(attribute, probe_ids=None, _from=None, to=None, offse # noqa: E501 - :param attribute: The attribute to query (e.g., 'V_m' for the membrane potential) + :param attribute: The attribute to query :type attribute: str :param probe_ids: A list of probes ids queried for data. :type probe_ids: List[int] @@ -108,7 +108,7 @@ def arbor_get_measurements(attribute, probe_ids=None, _from=None, to=None, offse :type to: float :param offset: The offset into the result. :type offset: int - :param limit: The maximum of entries to be result. + :param limit: The maximum of entries to be returned. :type limit: int :rtype: ArborMeasurement @@ -151,7 +151,7 @@ def arbor_get_measurements(attribute, probe_ids=None, _from=None, to=None, offse def arbor_get_probes(attribute=None): # noqa: E501 - """Retrieves the list of all probes for a given attribute (optional). + """Retrieves a list of all probes for a given attribute (optional). # noqa: E501 @@ -187,7 +187,7 @@ def arbor_get_probes(attribute=None): # noqa: E501 def arbor_get_simulation_time_info(): # noqa: E501 - """Retrieves simulation time information. + """Retrieves simulation time information(begin, current, end). # noqa: E501 diff --git a/access_node/controllers/nest_controller.py b/access_node/controllers/nest_controller.py index 176bb160326d06a39072b4479a59276b87aea3d5..8d90fd56fe6c8fd434786f28a2a524aa4930d480 100644 --- a/access_node/controllers/nest_controller.py +++ b/access_node/controllers/nest_controller.py @@ -26,7 +26,7 @@ def connect_to_database(): def nest_get_gids(): # noqa: E501 - """Retrieves the list of all GID. + """Retrieves a list of all gids. # noqa: E501 @@ -44,7 +44,7 @@ def nest_get_gids(): # noqa: E501 def nest_get_gids_in_population(population_id): # noqa: E501 - """Retrieves the list of all neuron IDs within the population. + """Retrieves the list of all neuron ids within the population. # noqa: E501 @@ -65,7 +65,7 @@ def nest_get_gids_in_population(population_id): # noqa: E501 def nest_get_multimeter_info(): # noqa: E501 """Retreives the available multimeters and their properties. - + # noqa: E501 @@ -96,19 +96,19 @@ def nest_get_multimeter_info(): # noqa: E501 def nest_get_multimeter_measurements(multimeter_id, attribute, _from=None, to=None, gids=None, offset=None, limit=None): # noqa: E501 - """Retrieves the measurements for a multimeter, attribute and GIDS (optional). + """Retrieves the measurements for a multimeter, attribute and gids (optional). # noqa: E501 :param multimeter_id: The multimeter to query - :type multimeter_id: + :type multimeter_id: int :param attribute: The attribute to query (e.g., 'V_m' for the membrane potential) :type attribute: str :param _from: The start time (including) to be queried. :type _from: float :param to: The end time (excluding) to be queried. :type to: float - :param gids: A list of GIDs queried for spike data. + :param gids: A list of gids queried for spike data. :type gids: List[int] :param offset: The offset into the result. :type offset: int @@ -174,7 +174,7 @@ def nest_get_neuron_properties(gids=None): # noqa: E501 # noqa: E501 - :param gids: A list of GIDs queried for properties. + :param gids: A list of gids queried for properties. :type gids: List[int] :rtype: List[NestNeuronProperties] @@ -208,7 +208,7 @@ def nest_get_neuron_properties(gids=None): # noqa: E501 def nest_get_populations(): # noqa: E501 - """Retrieves the list of all population IDs. + """Retrieves a list of all population IDs. # noqa: E501 @@ -226,7 +226,7 @@ def nest_get_populations(): # noqa: E501 def nest_get_simulation_time_info(): # noqa: E501 - """Retrieves simulation time information. + """Retrieves simulation time information (begin, current, end). # noqa: E501 @@ -234,8 +234,14 @@ def nest_get_simulation_time_info(): # noqa: E501 :rtype: SimulationTimeInfo """ + con = connect_to_database() + cur = con.cursor() + cur.execute("SELECT address FROM nest_simulation_node") + nodes.nest_simulation_nodes = [i[0] for i in cur.fetchall()] + con.close() + print("Updated simumlation nodes: " + str(nodes.nest_simulation_nodes)) + current_time = float('inf') - print("Hello") for node in nodes.nest_simulation_nodes: response = requests.get( node+'/current_simulation_time').json() @@ -247,7 +253,7 @@ def nest_get_simulation_time_info(): # noqa: E501 def nest_get_spikes(_from=None, to=None, gids=None, offset=None, limit=None): # noqa: E501 - """Retrieves the spikes for the given simulation steps (optional) and GIDS (optional). + """Retrieves the spikes for the given simulation steps (optional) and gids (optional). # noqa: E501 @@ -255,15 +261,23 @@ def nest_get_spikes(_from=None, to=None, gids=None, offset=None, limit=None): # :type _from: float :param to: The end time (excluding) to be queried. :type to: float - :param gids: A list of GIDs queried for spike data. + :param gids: A list of gids queried for spike data. :type gids: List[int] :param offset: The offset into the result. :type offset: int - :param limit: The maximum of entries to be result. + :param limit: The maximum of entries to be returned. :type limit: int :rtype: Spikes """ + + con = connect_to_database() + cur = con.cursor() + cur.execute("SELECT address FROM nest_simulation_node") + nodes.nest_simulation_nodes = [i[0] for i in cur.fetchall()] + con.close() + print("Updated simumlation nodes: " + str(nodes.nest_simulation_nodes)) + spikes = Spikes([], []) for node in nodes.nest_simulation_nodes: response = requests.get( @@ -302,7 +316,7 @@ def nest_get_spikes_by_population(population_id, _from=None, to=None, offset=Non :type to: float :param offset: The offset into the result. :type offset: int - :param limit: The maximum of entries to be result. + :param limit: The maximum of entries to be returned. :type limit: int :rtype: Spikes diff --git a/access_node/models/multimeter_info.py b/access_node/models/multimeter_info.py index d66278e6d45a5dd9b862265eda003b7e951ceb61..9d1b38921456e3369552e4133fa40995f1de2cc7 100644 --- a/access_node/models/multimeter_info.py +++ b/access_node/models/multimeter_info.py @@ -6,7 +6,6 @@ from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from access_node.models.base_model_ import Model -from access_node.models.multimeter_info_inner import MultimeterInfoInner # noqa: F401,E501 from access_node import util diff --git a/access_node/models/multimeter_measurement.py b/access_node/models/multimeter_measurement.py index aa8bbb50b73f6710c728bf5f0f0f1f825bc83796..7c5b77bfaf18d042427abb033e03c2893209fb84 100644 --- a/access_node/models/multimeter_measurement.py +++ b/access_node/models/multimeter_measurement.py @@ -100,7 +100,7 @@ class MultimeterMeasurement(Model): def values(self) -> List[float]: """Gets the values of this MultimeterMeasurement. - This array contains the measured values for each probe and time to get the value for probe n at time t you have to use the index n * length(simulation_times) + t # noqa: E501 + This array contains the measured values for each gid and time to get the value for gid n at time t you have to use the index n * length(simulation_times) + t # noqa: E501 :return: The values of this MultimeterMeasurement. :rtype: List[float] @@ -111,7 +111,7 @@ class MultimeterMeasurement(Model): def values(self, values: List[float]): """Sets the values of this MultimeterMeasurement. - This array contains the measured values for each probe and time to get the value for probe n at time t you have to use the index n * length(simulation_times) + t # noqa: E501 + This array contains the measured values for each gid and time to get the value for gid n at time t you have to use the index n * length(simulation_times) + t # noqa: E501 :param values: The values of this MultimeterMeasurement. :type values: List[float] diff --git a/access_node/swagger/swagger.yaml b/access_node/swagger/swagger.yaml index 41798d174191a894534adef35403d71b644cffc1..a7e0d939d520a7f6390fbfe572f782a279fbf376 100644 --- a/access_node/swagger/swagger.yaml +++ b/access_node/swagger/swagger.yaml @@ -63,11 +63,11 @@ paths: type: "integer" format: "uint64" responses: - 200: + "200": description: "Operation successful." schema: $ref: "#/definitions/Spikes" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -77,20 +77,23 @@ paths: get: tags: - "arbor" - summary: "Retrieves the list of all cell ids." + summary: "Retrieves a list of all cell ids." operationId: "arbor_get_cell_ids" produces: - "application/json" parameters: [] responses: - 200: + "200": description: "Operation successful." schema: type: "array" items: type: "integer" format: "uint64" - 400: + example: + - 1 + - 2 + "400": description: "Operation failed." schema: type: "string" @@ -100,7 +103,7 @@ paths: get: tags: - "arbor" - summary: "Retrieves the list of all probes for a given attribute (optional)." + summary: "Retrieves a list of all probes for a given attribute (optional)." operationId: "arbor_get_probes" produces: - "application/json" @@ -111,13 +114,13 @@ paths: required: false type: "string" responses: - 200: + "200": description: "Operation successful." schema: type: "array" items: $ref: "#/definitions/Probe" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -127,13 +130,13 @@ paths: get: tags: - "arbor" - summary: "Retrieves the list of all attributes." + summary: "Retrieves a list of all attributes." operationId: "arbor_get_attributes" produces: - "application/json" parameters: [] responses: - 200: + "200": description: "Operation successful." schema: type: "array" @@ -142,7 +145,7 @@ paths: example: - "Voltage" - "Current" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -161,7 +164,7 @@ paths: parameters: - name: "attribute" in: "query" - description: "The attribute to query (e.g., 'V_m' for the membrane potential)" + description: "The attribute to query" required: true type: "string" - name: "probe_ids" @@ -192,16 +195,16 @@ paths: format: "uint64" - name: "limit" in: "query" - description: "The maximum of entries to be result." + description: "The maximum of entries to be returned." required: false type: "integer" format: "uint64" responses: - 200: + "200": description: "Operation successful." schema: $ref: "#/definitions/ArborMeasurement" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -211,17 +214,17 @@ paths: get: tags: - "arbor" - summary: "Retrieves simulation time information." + summary: "Retrieves simulation time information(begin, current, end)." operationId: "arbor_get_simulation_time_info" produces: - "application/json" parameters: [] responses: - 200: + "200": description: "Operation successful." schema: $ref: "#/definitions/SimulationTimeInfo" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -245,13 +248,13 @@ paths: type: "integer" format: "uint64" responses: - 200: + "200": description: "Operation successful." schema: type: "array" items: $ref: "#/definitions/ArborCellProperties" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -261,17 +264,17 @@ paths: get: tags: - "nest" - summary: "Retrieves simulation time information." + summary: "Retrieves simulation time information (begin, current, end)." operationId: "nest_get_simulation_time_info" produces: - "application/json" parameters: [] responses: - 200: + "200": description: "Operation successful." schema: $ref: "#/definitions/SimulationTimeInfo" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -281,20 +284,25 @@ paths: get: tags: - "nest" - summary: "Retrieves the list of all GID." + summary: "Retrieves a list of all gids." operationId: "nest_get_gids" produces: - "application/json" parameters: [] responses: - 200: + "200": description: "Operation successful." schema: type: "array" items: type: "integer" format: "uint64" - 400: + example: + - 1 + - 2 + - 3 + - 15 + "400": description: "Operation failed." schema: type: "string" @@ -311,20 +319,20 @@ paths: parameters: - name: "gids" in: "query" - description: "A list of GIDs queried for properties." + description: "A list of gids queried for properties." required: false type: "array" items: type: "integer" format: "uint64" responses: - 200: + "200": description: "Operation successful." schema: type: "array" items: $ref: "#/definitions/NestNeuronProperties" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -334,20 +342,24 @@ paths: get: tags: - "nest" - summary: "Retrieves the list of all population IDs." + summary: "Retrieves a list of all population IDs." operationId: "nest_get_populations" produces: - "application/json" parameters: [] responses: - 200: + "200": description: "Operation successful." schema: type: "array" items: type: "integer" format: "uint64" - 400: + example: + - 1 + - 2 + - 3 + "400": description: "Operation failed." schema: type: "string" @@ -358,7 +370,7 @@ paths: tags: - "nest" summary: "Retrieves the spikes for the given simulation steps (optional) and\ - \ GIDS (optional)." + \ gids (optional)." operationId: "nest_get_spikes" consumes: - "application/json" @@ -379,7 +391,7 @@ paths: format: "double" - name: "gids" in: "query" - description: "A list of GIDs queried for spike data." + description: "A list of gids queried for spike data." required: false type: "array" items: @@ -393,16 +405,16 @@ paths: format: "uint64" - name: "limit" in: "query" - description: "The maximum of entries to be result." + description: "The maximum of entries to be returned." required: false type: "integer" format: "uint64" responses: - 200: + "200": description: "Operation successful." schema: $ref: "#/definitions/Spikes" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -446,16 +458,16 @@ paths: format: "uint64" - name: "limit" in: "query" - description: "The maximum of entries to be result." + description: "The maximum of entries to be returned." required: false type: "integer" format: "uint64" responses: - 200: + "200": description: "Operation successful." schema: $ref: "#/definitions/Spikes" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -473,11 +485,11 @@ paths: - "application/json" parameters: [] responses: - 200: + "200": description: "Operation successful." schema: $ref: "#/definitions/MultimeterInfo" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -487,7 +499,7 @@ paths: get: tags: - "nest" - summary: "Retrieves the measurements for a multimeter, attribute and GIDS (optional)." + summary: "Retrieves the measurements for a multimeter, attribute and gids (optional)." operationId: "nest_get_multimeter_measurements" consumes: - "application/json" @@ -498,8 +510,8 @@ paths: in: "query" description: "The multimeter to query" required: true - type: "number" - format: "integer" + type: "integer" + format: "uint64" - name: "attribute" in: "query" description: "The attribute to query (e.g., 'V_m' for the membrane potential)" @@ -519,7 +531,7 @@ paths: format: "double" - name: "gids" in: "query" - description: "A list of GIDs queried for spike data." + description: "A list of gids queried for spike data." required: false type: "array" items: @@ -538,11 +550,11 @@ paths: type: "integer" format: "uint64" responses: - 200: + "200": description: "Operation successful." schema: $ref: "#/definitions/MultimeterMeasurement" - 400: + "400": description: "Operation failed." schema: type: "string" @@ -552,7 +564,7 @@ paths: get: tags: - "nest" - summary: "Retrieves the list of all neuron IDs within the population." + summary: "Retrieves the list of all neuron ids within the population." operationId: "nest_get_gids_in_population" produces: - "application/json" @@ -564,14 +576,17 @@ paths: type: "integer" format: "uint64" responses: - 200: + "200": description: "Operation successful." schema: type: "array" items: type: "integer" format: "uint64" - 400: + example: + - 1 + - 2 + "400": description: "Operation failed." schema: type: "string" @@ -594,11 +609,11 @@ definitions: format: "uint64" example: simulation_times: - - 0.8008281904610115 - - 0.8008281904610115 + - 0.8 + - 0.9 gids: - - 6.027456183070403 - - 6.027456183070403 + - 1 + - 2 MultimeterInfo: type: "array" items: @@ -607,6 +622,10 @@ definitions: - id: 0 attributes: - "V_m" + gids: + - 1 + - 2 + - 3 MultimeterMeasurement: type: "object" properties: @@ -724,11 +743,13 @@ definitions: type: "object" properties: {} example: - population: "pop1" - position: - - 0.1 - - 0.1 - - 0.1 + gid: 1 + properties: + population: 2 + position: + - 0.1 + - 0.1 + - 0.1 SimulationTimeInfo: type: "object" properties: @@ -742,9 +763,9 @@ definitions: type: "number" format: "double" example: - current: 1.4658129805029452 - start: 0.8008281904610115 - end: 6.027456183070403 + current: 2.1 + start: 0.1 + end: 4.5 MultimeterInfo_inner: properties: id: @@ -759,3 +780,4 @@ definitions: items: type: "integer" format: "uint64" + \ No newline at end of file