Closed rgeorgi closed 8 years ago
Is this consistently happening? I don't see it:
[goodmami@vaio:~]$ # CREATE A CORPUS
[goodmami@vaio:~]$ curl -i -H'Content-Type: application/json' -d'{"igts": [{"id":"i2"}]}' localhost:5000/v1/corpora
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 38
Server: Werkzeug/0.11.3 Python/3.5.1
Date: Wed, 10 Feb 2016 01:08:59 GMT
{
"id": "ft_KVU",
"igt_count": 1
}
[goodmami@vaio:~]$ # LIST IGTS
[goodmami@vaio:~]$ curl -i localhost:5000/v1/corpora/ft_KVU/igts
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 85
Server: Werkzeug/0.11.3 Python/3.5.1
Date: Wed, 10 Feb 2016 01:09:36 GMT
{
"igt_count": 1,
"igts": [
{
"id": "i2",
"tiers": []
}
]
[goodmami@vaio:~]$ # DELETE AN IGT
[goodmami@vaio:~]$ curl -i -X DELETE localhost:5000/v1/corpora/ft_KVU/igts/i2
HTTP/1.0 204 NO CONTENT
Content-Type: text/html; charset=utf-8
Content-Length: 0
Server: Werkzeug/0.11.3 Python/3.5.1
Date: Wed, 10 Feb 2016 01:10:16 GMT
[goodmami@vaio:~]$ # LIST IGTS
[goodmami@vaio:~]$ curl -i localhost:5000/v1/corpora/ft_KVU/igts
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 34
Server: Werkzeug/0.11.3 Python/3.5.1
Date: Wed, 10 Feb 2016 01:10:22 GMT
{
"igt_count": 0,
"igts": []
}
Maybe it's a caching issue?
It is consistently happening, but seems to only happen after I've done a split, and subsequently saved two new instances, with _a
and _b
then delete the _b
. After I try to access the _a
instance I get,
[Tue Feb 09 20:43:23 2016] [error] [client ::1] File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sleipnir/interfaces/base.py", line 12, in get_igt, referer: http://localhost/user/yQ4Al01U
[Tue Feb 09 20:43:23 2016] [error] [client ::1] return self.get_igts(cid, ids=[iid])[0], referer: http://localhost/user/yQ4Al01U
[Tue Feb 09 20:43:23 2016] [error] [client ::1] File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sleipnir/interfaces/filesystem.py", line 115, in get_igts, referer: http://localhost/user/yQ4Al01U
[Tue Feb 09 20:43:23 2016] [error] [client ::1] igts = map(xigtjson.decode_igt, self._read_igts(corpus_id, ids=ids)), referer: http://localhost/user/yQ4Al01U
[Tue Feb 09 20:43:23 2016] [error] [client ::1] File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sleipnir/interfaces/filesystem.py", line 66, in _read_igts, referer: http://localhost/user/yQ4Al01U
[Tue Feb 09 20:43:23 2016] [error] [client ::1] igts = [igts[idx] for idx in idxs], referer: http://localhost/user/yQ4Al01U
[Tue Feb 09 20:43:23 2016] [error] [client ::1] File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sleipnir/interfaces/filesystem.py", line 66, in <listcomp>, referer: http://localhost/user/yQ4Al01U
[Tue Feb 09 20:43:23 2016] [error] [client ::1] igts = [igts[idx] for idx in idxs], referer: http://localhost/user/yQ4Al01U
[Tue Feb 09 20:43:23 2016] [error] [client ::1] IndexError: list index out of range, referer: http://localhost/user/yQ4Al01U
Ok I'll look into it. Did you change both the IGT_ID in the URL (corpora/CORPUS_ID/igts/IGT_ID
) and in the IGT instance (igt.id = ...
)? And what happened to the original IGT (without _a
or _b
)?
Ok I think I see what's happening. A corpus index keeps IGTs in a list, and there's a map from IGT ID to list position. The positions need to be refreshed after deleting an IGT.
Also, the igt_count
attribute in the main index needs to be updated when adding or deleting IGTs.
After issuing a dbi.del_igt, it appears that the main index still shows the IGT when asked to display the corpus.