Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update webknossos api version to v8 #1185

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webknossos/local_wk_setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function export_vars {
export WK_TOKEN=1b88db86331a38c21a0b235794b9e459856490d70408bcffb767f64ade0f83d2bdb4c4e181b9a9a30cdece7cb7c65208cc43b6c1bb5987f5ece00d348b1a905502a266f8fc64f0371cd6559393d72e031d0c2d0cabad58cccf957bb258bc86f05b5dc3d4fff3d5e3d9c0389a6027d861a21e78e3222fb6c5b7944520ef21761e
export WK_URL=http://localhost:9000
export DOCKER_TAG=master__28678
export DOCKER_TAG=master__29622
}

function ensure_local_test_wk {
Expand Down
2 changes: 1 addition & 1 deletion webknossos/tests/test_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_dataset_info() -> None:
with webknossos_context(url=DEFAULT_WEBKNOSSOS_URL):
client = _get_api_client()
api_dataset = client.dataset_info(
organization_name="scalable_minds", dataset_name="l4dense_motta_et_al_demo"
organization_id="scalable_minds", dataset_name="l4dense_motta_et_al_demo"
)
assert api_dataset.data_store.url == DATASTORE_URL
assert api_dataset.display_name == "L4 Mouse Cortex Demo"
Expand Down
2 changes: 1 addition & 1 deletion webknossos/webknossos/client/_download_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def download_dataset(
):
chunk_in_mag = chunk.in_mag(mag)
chunk_bytes, missing_buckets = datastore_client.dataset_get_raw_data(
organization_name=organization_id,
organization_id=organization_id,
dataset_name=dataset_name,
data_layer_name=layer_name,
mag=mag.to_long_layer_name(),
Expand Down
10 changes: 6 additions & 4 deletions webknossos/webknossos/client/api_client/datastore_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def dataset_reserve_upload(

def dataset_trigger_reload(
self,
organization_name: str,
organization_id: str,
dataset_name: str,
token: Optional[str] = None,
) -> None:
route = f"/triggers/reload/{organization_name}/{dataset_name}"
route = f"/triggers/reload/{organization_id}/{dataset_name}"
query: Query = {"token": token}
self._post(route, query=query)

Expand All @@ -78,7 +78,7 @@ def dataset_reserve_manual_upload(

def dataset_get_raw_data(
self,
organization_name: str,
organization_id: str,
dataset_name: str,
data_layer_name: str,
mag: str,
Expand All @@ -90,7 +90,9 @@ def dataset_get_raw_data(
height: int,
depth: int,
) -> Tuple[bytes, str]:
route = f"/datasets/{organization_name}/{dataset_name}/layers/{data_layer_name}/data"
route = (
f"/datasets/{organization_id}/{dataset_name}/layers/{data_layer_name}/data"
)
query: Query = {
"mag": mag,
"x": x,
Expand Down
2 changes: 1 addition & 1 deletion webknossos/webknossos/client/api_client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ApiDatasetUploadInformation:

@attr.s(auto_attribs=True)
class ApiLinkedLayerIdentifier:
organization_name: str
organization_id: str
data_set_name: str
layer_name: str
new_layer_name: Optional[str] = None
Expand Down
26 changes: 13 additions & 13 deletions webknossos/webknossos/client/api_client/wk_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
base_wk_url: str,
timeout_seconds: float,
headers: Optional[Dict[str, str]] = None,
webknossos_api_version: int = 7,
webknossos_api_version: int = 8,
):
super().__init__(timeout_seconds, headers)
self.webknossos_api_version = webknossos_api_version
Expand All @@ -63,45 +63,45 @@ def short_link_by_key(self, key: str) -> ApiShortLink:

def dataset_info(
self,
organization_name: str,
organization_id: str,
dataset_name: str,
sharing_token: Optional[str] = None,
) -> ApiDataset:
route = f"/datasets/{organization_name}/{dataset_name}"
route = f"/datasets/{organization_id}/{dataset_name}"
return self._get_json(route, ApiDataset, query={"sharingToken": sharing_token})

def dataset_list(
self, is_active: Optional[bool], organization_name: Optional[str]
self, is_active: Optional[bool], organization_id: Optional[str]
) -> List[ApiDataset]:
route = "/datasets"
return self._get_json(
route,
List[ApiDataset],
query={"isActive": is_active, "organizationName": organization_name},
query={"isActive": is_active, "organizationId": organization_id},
)

def dataset_update_teams(
self, organization_name: str, dataset_name: str, team_ids: List[str]
self, organization_id: str, dataset_name: str, team_ids: List[str]
) -> None:
route = f"/datasets/{organization_name}/{dataset_name}/teams"
route = f"/datasets/{organization_id}/{dataset_name}/teams"
self._patch_json(route, team_ids)

def dataset_update(
self, organization_name: str, dataset_name: str, updated_dataset: ApiDataset
self, organization_id: str, dataset_name: str, updated_dataset: ApiDataset
) -> None:
route = f"/datasets/{organization_name}/{dataset_name}"
route = f"/datasets/{organization_id}/{dataset_name}"
self._patch_json(route, updated_dataset)

def dataset_sharing_token(
self, organization_name: str, dataset_name: str
self, organization_id: str, dataset_name: str
) -> ApiSharingToken:
route = f"/datasets/{organization_name}/{dataset_name}/sharingToken"
route = f"/datasets/{organization_id}/{dataset_name}/sharingToken"
return self._get_json(route, ApiSharingToken)

def dataset_is_valid_new_name(
self, organization_name: str, dataset_name: str
self, organization_id: str, dataset_name: str
) -> ApiDatasetIsValidNewNameResponse:
route = f"/datasets/{organization_name}/{dataset_name}/isValidNewName"
route = f"/datasets/{organization_id}/{dataset_name}/isValidNewName"
return self._get_json(route, ApiDatasetIsValidNewNameResponse)

def datastore_list(self) -> List[ApiDataStore]:
Expand Down
4 changes: 2 additions & 2 deletions webknossos/webknossos/client/download_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def download_dataset(
dataset_name: str,
organization_name: str,
organization_id: str,
bbox: Optional[BoundingBox] = None,
layers: Optional[List[str]] = None,
mags: Optional[List[Mag]] = None,
Expand All @@ -19,7 +19,7 @@ def download_dataset(
warn_deprecated("download_dataset", "Dataset.download")
return actual_download_dataset(
dataset_name,
organization_id=organization_name,
organization_id=organization_id,
bbox=bbox,
layers=layers,
mags=mags,
Expand Down
2 changes: 1 addition & 1 deletion webknossos/webknossos/dataset/remote_dataset_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(
tags = [tags]

dataset_infos = client.dataset_list(
is_active=True, organization_name=organization_id
is_active=True, organization_id=organization_id
)

datasets_names = []
Expand Down
Loading