webknossos-libs
webknossos-libs copied to clipboard
`RemoteDataset.explore_and_add_remote` seems to be not working
Context
- Affected library: webknossos
With the current version of wklibs I cannot add a remote dataset via RemoteDataset.explore_and_add_remote as this leads to a crash. The reason for the crash is that the code tries to load info for the dataset which should be created by the route before the dataset itself is created.
For testing this can be used:
with wk.webknossos_context(
token="secretSampleUserToken", url="http://localhost:9000"
):
wk.RemoteDataset.explore_and_add_remote("gs://fafb-ffn1-20200412/segmentation", "remote_adding", "Datasets")
Expected Behavior
The code should succeed and the local running wk instance should have a new dataset added called "remote_adding".
Current Behavior
The wklibs crash with the following stack trace:
Traceback (most recent call last):
File "<libs>/webknossos/webknossos/client/api_client/_abstract_api_client.py", line 241, in _assert_good_response
response.raise_for_status()
File "<voxelytics>/.venv/lib/python3.11/site-packages/httpx/_models.py", line 763, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '404 Not Found' for url 'http://localhost:9000/api/v9/datasets/disambiguate/sample_organization/remote_adding/toId'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<libs>/webknossos/test_remote_layer.py", line 57, in <module>
main()
File "<libs>/webknossos/test_remote_layer.py", line 12, in main
wk.RemoteDataset.explore_and_add_remote("gs://fafb-ffn1-20200412/segmentation", "remote_adding", "Datasets")
File "<libs>/webknossos/webknossos/dataset/dataset.py", line 3263, in explore_and_add_remote
cls._parse_remote(dataset_name)
File "<libs>/webknossos/webknossos/dataset/dataset.py", line 727, in _parse_remote
dataset_id = cls._disambiguate_remote(dataset_name, organization_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<libs>/webknossos/webknossos/dataset/dataset.py", line 611, in _disambiguate_remote
dataset_id := current_context.api_client_with_auth.dataset_id_from_name(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<libs>/webknossos/webknossos/client/api_client/wk_api_client.py", line 77, in dataset_id_from_name
return self._get_json(route, ApiDatasetId).id
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<libs>/webknossos/webknossos/client/api_client/_abstract_api_client.py", line 37, in _get_json
response = self._get(route, query)
^^^^^^^^^^^^^^^^^^^^^^^
File "<libs>/webknossos/webknossos/client/api_client/_abstract_api_client.py", line 116, in _get
return self._request("GET", route, query, timeout_seconds=timeout_seconds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<libs>/webknossos/webknossos/client/api_client/_abstract_api_client.py", line 207, in _request
self._assert_good_response(response)
File "<libs>/webknossos/webknossos/client/api_client/_abstract_api_client.py", line 243, in _assert_good_response
raise UnexpectedStatusError(response) from e
webknossos.client.api_client.errors.UnexpectedStatusError: An error occurred while performing a GET request for URL http://localhost:9000/api/v9/datasets/disambiguate/sample_organization/remote_adding/toId.
If this is unexpected, please double-check your WEBKNOSSOS URL and credentials.
Got response status 404 with body: {"messages":[{"error":"Dataset remote_adding does not exist or could not be accessed"}]}
Your Environment for bug
- Linux ubuntu
- newest wklibs version
- python venv version 3.11
Please see my following post: https://github.com/scalableminds/webknossos-libs/commit/0efedee5d3dee8068edbe33a4559337119e75dcc#r153039757