Skip to content
Snippets Groups Projects
Commit 6b4b0534 authored by Jan Müller's avatar Jan Müller
Browse files

Merge branch 'feature/Put_population_not_failing' into 'develop'

Fix put behavior if gid wasnt registered before

See merge request VR-Group/in-situ-pipeline/info-node!3
parents 60491a9d 39abda1d
No related branches found
No related tags found
1 merge request!3Fix put behavior if gid wasnt registered before
Pipeline #163221 passed
......@@ -108,9 +108,8 @@ def put_gids(gids, address): # noqa: E501
"""
for gid in gids:
if gid in nest_storage.data.index.values:
return Status(code=400, message="At least one gid already registered")
for gid in gids:
nest_storage.data.at[gid, "node"] = Node(address=address)
else:
nest_storage.data.loc[gid] = [Node(address=address), None, None]
return ok_status
......@@ -132,7 +131,7 @@ def put_multimeter_info(id, attributes=None, gids=None): # noqa: E501
"""
for gid in gids:
if gid not in nest_storage.data.index.values:
return Status(code=400, message="At least one gid has not been registered yet")
nest_storage.data.loc[gid] = [None, None, None]
new_multimeter = True
for multimeter in nest_storage.multimeters:
......@@ -167,15 +166,14 @@ def put_populations(gids): # noqa: E501
"""
for gid in gids:
if gid not in nest_storage.data.index.values:
return Status(code=400, message="At least one gid has not been registered yet")
nest_storage.data.loc[gid] = [None, None, None]
for gid in gids:
row = nest_storage.data.loc[gid]
row["population"] = nest_storage.num_populations + 1
if row["properties"] is None:
row["properties"] = {"population": nest_storage.num_populations + 1}
nest_storage.data.at[gid, "population"] = nest_storage.num_populations + 1
if nest_storage.data.at[gid, "properties"] is None:
nest_storage.data.at[gid, "properties"] = {"population": nest_storage.num_populations + 1}
else:
row["properties"].update({"population": nest_storage.num_populations + 1 })
nest_storage.data.at[gid, "properties"].update({"population": nest_storage.num_populations + 1 })
nest_storage.num_populations += 1
return nest_storage.num_populations
......@@ -212,8 +210,7 @@ def set_neuron_properties(properties): # noqa: E501
for prop in properties:
if prop.gid not in nest_storage.data.index.values:
return Status(code=400, message="At least one gid has not been registered yet!")
nest_storage.data.loc[prop.gid] = [None, None, None]
nest_storage.data.at[prop.gid, "properties"] = prop.properties
return ok_status
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment