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

Insert credentialId when exploring remote zarr dataset with datasource-properties #7601

Merged
merged 2 commits into from
Feb 1, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fixed loading local datasets for organizations that have spaces in their names. [#7593](https://github.com/scalableminds/webknossos/pull/7593)
- Fixed a bug where proofreading annotations would stay black until the next server restart due to expired but cached tokens. [#7598](https://github.com/scalableminds/webknossos/pull/7598)
- Fixed a bug where ad-hoc meshing didn't make use of a segment index, even when it existed. [#7600](https://github.com/scalableminds/webknossos/pull/7600)
- Fixed a bug where importing remote datasets with existing datasource-properties.jsons would not properly register the remote credentials. [#7601](https://github.com/scalableminds/webknossos/pull/7601)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,33 @@ class WebknossosZarrExplorer(implicit val ec: ExecutionContext) extends RemoteLa
zarrLayers <- Fox.serialCombined(dataSource.dataLayers) {
case l: Zarr3SegmentationLayer =>
for {
mags <- fixMagsWithRemotePaths(l.mags, remotePath / l.name, Zarr3ArrayHeader.FILENAME_ZARR_JSON)
mags <- adaptMags(l.mags, remotePath / l.name, Zarr3ArrayHeader.FILENAME_ZARR_JSON, credentialId)
} yield l.copy(mags = mags)
case l: Zarr3DataLayer =>
for {
mags <- fixMagsWithRemotePaths(l.mags, remotePath / l.name, Zarr3ArrayHeader.FILENAME_ZARR_JSON)
mags <- adaptMags(l.mags, remotePath / l.name, Zarr3ArrayHeader.FILENAME_ZARR_JSON, credentialId)
} yield l.copy(mags = mags)
case l: ZarrSegmentationLayer =>
for {
mags <- fixMagsWithRemotePaths(l.mags, remotePath / l.name, ZarrHeader.FILENAME_DOT_ZARRAY)
mags <- adaptMags(l.mags, remotePath / l.name, ZarrHeader.FILENAME_DOT_ZARRAY, credentialId)
} yield l.copy(mags = mags)
case l: ZarrDataLayer =>
for {
mags <- fixMagsWithRemotePaths(l.mags, remotePath / l.name, ZarrHeader.FILENAME_DOT_ZARRAY)
mags <- adaptMags(l.mags, remotePath / l.name, ZarrHeader.FILENAME_DOT_ZARRAY, credentialId)
} yield l.copy(mags = mags)
case layer => Fox.failure(s"Only remote Zarr or Zarr3 layers are supported, got ${layer.getClass}.")
case layer => Fox.failure(s"Only remote Zarr2 or Zarr3 layers are supported, got ${layer.getClass}.")
}
zarrLayersWithScale <- Fox.serialCombined(zarrLayers)(l => Fox.successful((l, dataSource.scale)))
} yield zarrLayersWithScale

private def fixMagsWithRemotePaths(mags: List[MagLocator],
remoteLayerPath: VaultPath,
headerFilename: String): Fox[List[MagLocator]] =
private def adaptMags(mags: List[MagLocator],
remoteLayerPath: VaultPath,
headerFilename: String,
credentialId: Option[String]): Fox[List[MagLocator]] =
Fox.serialCombined(mags)(m =>
for {
magPath <- fixRemoteMagPath(m, remoteLayerPath, headerFilename)
} yield m.copy(path = magPath))
} yield m.copy(path = magPath, credentialId = credentialId))

private def fixRemoteMagPath(mag: MagLocator,
remoteLayerPath: VaultPath,
Expand Down