Skip to content

Commit

Permalink
Create method for update datastore after manual upload of new dataset (
Browse files Browse the repository at this point in the history
…#1236)

* Add trigger for checking datastore inbox.

* Update Changelog.

* Use route for single dataset refresh instead.

* Implement requested feedback.
  • Loading branch information
markbader authored Jan 20, 2025
1 parent 0282eb8 commit 2e525ab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion webknossos/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
- `Dataset` method `get_remote_datasets()` accepts `name` and `folder_id` as arguments now to filter remote datasets.
- `RemoteDataset` got an additional property: `created`.
- `Annotation` got an additional property: `dataset_id`.
- `Dataset.trigger_dataset_import()` was added to refresh the datastore to register a newly added dataset. [#1236](https://github.com/scalableminds/webknossos-libs/pull/1236)

### Changed
- Updated to WEBKNOSSOS API version 9. This includes support for the new url structure for datasets and [#1231](https://github.com/scalableminds/webknossos-libs/pull/1231)
- Updated to WEBKNOSSOS API version 9. This includes support for the new url structure for datasets and the usage of `dataset_id`. [#1231](https://github.com/scalableminds/webknossos-libs/pull/1231)

### Fixed
- Fixed Mag setup for non-public datasets. [#1222](https://github.com/scalableminds/webknossos-libs/pull/1222)
Expand Down
20 changes: 20 additions & 0 deletions webknossos/webknossos/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,26 @@ def trigger_reload_in_datastore(
datastore_api = context.get_datastore_api_client(upload_url)
datastore_api.dataset_trigger_reload(organization, dataset_name, token=token)

@classmethod
def trigger_dataset_import(
cls, directory_name: str, organization: str, token: Optional[str] = None
) -> None:
"""Trigger a manual lookup of the dataset in the datastore.
Args:
directory_name: Directory name of the dataset in the datastore
organization: Organization ID where dataset is located
token: Optional authentication token
Examples:
```
# Trigger a manual lookup of the dataset in the datastore
Dataset.trigger_dataset_upload("l4_sample", "scalable_minds")
```
"""

cls.trigger_reload_in_datastore(directory_name, organization, token)

@classmethod
def _disambiguate_remote(
cls,
Expand Down

0 comments on commit 2e525ab

Please sign in to comment.