Open InnocentBug opened 2 years ago
Update: New Python SDK on Master branch:
this code:
try:
rdkit = cript.Software.get(name = "rdkit", version = "2020.9")
except ValueError:
rdkit = cript.Software(name = "rdkit", version = "2020.9", group=proj.group)
rdkit.save()
Produces this error:
Traceback (most recent call last):
File "/media/data/elwood/chimad/hongbo4/upload_cript.py", line 42, in main
rdkit = cript.Software.get(name = "rdkit", version = "2020.9")
File "<@beartype(cript.data_model.nodes.base_node.BaseNode.get) at 0x7f2f9612fc10>", line 29, in get
File "/home/ludwig/.local/lib/python3.9/site-packages/cript/data_model/nodes/base_node.py", line 175, in get
raise ValueError("Your query did not match any existing nodes.")
ValueError: Your query did not match any existing nodes.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/media/data/elwood/chimad/hongbo4/upload_cript.py", line 57, in <module>
main(sys.argv[1:])
File "/media/data/elwood/chimad/hongbo4/upload_cript.py", line 45, in main
rdkit.save()
File "<@beartype(cript.data_model.nodes.base_node.BaseNode.save) at 0x7f2f9612f670>", line 47, in save
File "/home/ludwig/.local/lib/python3.9/site-packages/cript/data_model/nodes/base_node.py", line 78, in save
raise UniqueNodeError(response["errors"][0])
cript.data_model.exceptions.UniqueNodeError: A Software with the same name and created_by already exists: https://criptapp.org/api/software/00b0a435-b9b6-46e1-8aea-859209f42feb/.
The reason appears to be this.
The first line fails, because there is no Software node on CRIPT that has "rdkit" as a name and version "2020.9". That is OK!
But the second line in the except fails too. And here it fails, because it finds a node with the name "rdkit" already in the databank. But this node has a different version: 2021.9. CRIPT should treat software with different versions as different and allow uploading multiple.
Currently it is not possible to upload two softwares with the same name, but different versions.
should work, but it fails with: