Skip to content

Commit 6c0a472

Browse files
MichaelBuessemeyerMichael Büßemeyerfm3
authored
Allow renaming datasets & dataset with duplicate names (#8075)
* WIP: Adjust schema to allow duplicate dataset names & implement new uir dataset addressing scheme * reimplement proper dataset name checking route (still keep leave away the check for already existing name) * WIP: implement wk core backend routes to only use datasetId and no orgaId - Includes moving ObjectId to uitls package * WIP: finish using dataset id in wk core backend and dataspath in datastore & add legacy routes - Undo renaming DataSourceId to LegacyDataSourceId * WIP: Fix backend compilation * Fix backend compilation * WIP: Adapt frontend to new api * WIP: adapt frontend to new routes * WIP: Adjust frontend to newest api * first kinda working version * Try update schema and evolution * fix evolution & add first version of reversion (needs to be tested) * fix frontend tests * format backend * fix dataSets.csv * fix e2e tests * format backend * fix frontend * remove occurences of displayName access / variables in context of a dataset object * fixed verion routes * fix reserveUploadRoute * rename orga_name in jobs to orga_id * format code * fix finishUploadRoute * allow duplicate names when uploading a new dataset * fix job list view * fix some datastore requests * further minor fixes * make add remote dataset path a post request as it always creates a new dataset (even when the name is already taken) * WIP: replace missed code parts where dataset address was still wrong / not backwards compatible * WIP: replace missed code parts where dataset address was still wrong / not backwards compatible * WIP: adapt annotation upload & task upload to use datasetId * WIP: adjust backend part of task upload to use new dataset addressing * Finish adapting task & annotation upload to new format * Fix inserting dataset into database * fix nml annotation upload * format backend * add hint about new parameter datasetId to csv / bulk task upload * Move task api routes to a separate file in frontend * add datasetName and datasetId to returned tasks * add missing task api routes file (frontend) * adapt frontend to new task return type * remove unused imports * fix frontend tests * add datasetId to nml output and readd datasetName to nml parsing for legacy support * add dataset id to frontend nml serialization * fix parsing dataset id from nml in backend * fix nml backend tests * fix typing * remove logging statement * fix frontend dataset cache by using the dataset id as the identifier * send dataset path as datasource.id.name to frontend * remove unused code * fix pervious merge with newest master * fix evolution and reversion * remove objectid from UploadedVolumeLayer and delete SkeletonTracingWithDatasetId and make nml parser return its own result case class * use new notion like urls * rename datasetPath to datasetDirectoryName * fix backend tests * delete DatasetURLParser, rename package of ObjectId to objectid, update e2e snapshot tests * small clean up, fix dataset public writes, fix dataset table highlighting * fix e2e tests * make datastore dataset update route http put method * make datastore dataset update route http put method * rename datasetParsedId to datasetIdValidated * bump schema version after merge * removeexplicit invalid dataset id message when parsing a datasetid from string * remove overwriting orga name and overwriting dataset name from anntoation upload path * WIP apply PR feedback * remove unused method * rely on datasetId in processing of taskcreation routes * apply some more review feedback * cleanup unused implicits * make link generation for convert_to_wkw and compute_mesh_file backwards compatible * adjust unfinished uploads to display correct dataset name in upload view * send datasource id to compose dataset route (not dataset id) - send datasource id in correct format to backend - fix dataset renaming in dataset settings * WIP apply review feedback - add legacy route for task creation routes - support jobs results link only via legacy routes - WIP: refactor nml parsing code - Added dataset location to datasets settings advanced tab - added comment to OpenGraphService about parsing new uri schema * Finish refactoring nml backend parsing * ifx nml typing * fix nml upload * apply frontend pr review feedback * apply pr frontend feedback * add new e2e test to check dataset disambiguation * re-add backwards compatibility for legacy dataset links without organization id * change screenshot test dataset id retrieval to be a test.before * remove outdated comment - the backend always sends an id for compacted datasets * temp disable upload test * fix linting * fix datasetId expected length * replace failure fox by returnError fox, fix json error msg * fix upload test - make new fields to reserve upload optional (for backward compatibility) - fix find data request from core backend * remove debug logging from dataset upload test * remove debug logs * format backend * apply pr various pr feedback * fix frontend routing & include /view postfix in ds link in ds edit view * add todo comments * send separate case class to datastore upon reserveUpload request to core backend * format backend * try setting screenshot ci to check this branch * use auth token in screenshot tests * renaming path to directoryName in response of disambiguate route * hopefully fix screenshot tests * reset application.conf * remove disambiguate link * switch screenshots back to use master.webknossos.xyz * add comment to explain handling legacy urls - revert nightly.yml full to master * remove outdated TODO comment * fix single dataset dnd in dashboard - improve typing of dnd arguments * format backend * add comment reasoning why dataset name setting is not synced with datasource.id.name * rename some local variables * pass missing parameter to infer_with_model worker job * try not showing dataset as changed when it was migrated to the new renamable version * format backend * add changelog entry * add info about ds being renamable to the docs * undo misc snapshot changes * make task creation form use new version of task creation parameters * remove dataSet field from task json object returned from server -> add required legacy adaption * also rename dataSet in publication routes to dataset - no legacy routes needed as not used by wklibs * add changelog entry about dropping legacy routes * bump api version * remove old routes with api version lower than 5 & resort methods in legacy controller * refresh snapshots * fix legacy create task route - also remove unised injections and imports * fix annotation info legacy route * remove unused import * - fix in code comments - fix changelog entry - add migration entry about dropped api versions --------- Co-authored-by: Michael Büßemeyer <MichaelBuessemeyer@users.noreply.github.com> Co-authored-by: Michael Büßemeyer <frameworklinux+MichaelBuessemeyer@users.noreply.github.com> Co-authored-by: Florian M <florian@scm.io>
1 parent 5d3d66d commit 6c0a472

File tree

231 files changed

+3353
-2928
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+3353
-2928
lines changed

CHANGELOG.unreleased.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
1515

1616
### Changed
1717
- Reading image files on datastore filesystem is now done asynchronously. [#8126](https://github.com/scalableminds/webknossos/pull/8126)
18+
- Datasets can now be renamed and can have duplicate names. [#8075](https://github.com/scalableminds/webknossos/pull/8075)
1819
- Improved error messages for starting jobs on datasets from other organizations. [#8181](https://github.com/scalableminds/webknossos/pull/8181)
1920
- Terms of Service for Webknossos are now accepted at registration, not afterward. [#8193](https://github.com/scalableminds/webknossos/pull/8193)
2021
- Removed bounding box size restriction for inferral jobs for super users. [#8200](https://github.com/scalableminds/webknossos/pull/8200)
@@ -28,6 +29,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
2829
- Fix a bug where dataset uploads would fail if the organization directory on disk is missing. [#8230](https://github.com/scalableminds/webknossos/pull/8230)
2930

3031
### Removed
32+
- Removed support for HTTP API versions 3 and 4. [#8075](https://github.com/scalableminds/webknossos/pull/8075)
3133
- Removed Google Analytics integration. [#8201](https://github.com/scalableminds/webknossos/pull/8201)
3234

3335
### Breaking Changes

MIGRATIONS.unreleased.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ User-facing changes are documented in the [changelog](CHANGELOG.released.md).
99
[Commits](https://github.com/scalableminds/webknossos/compare/24.11.1...HEAD)
1010

1111
- The config option `googleAnalytics.trackingId` is no longer used and can be removed. [#8201](https://github.com/scalableminds/webknossos/pull/8201)
12+
- Removed support for HTTP API versions 3 and 4. [#8075](https://github.com/scalableminds/webknossos/pull/8075)
1213

1314
### Postgres Evolutions:
15+
- [124-decouple-dataset-directory-from-name](conf/evolutions/124-decouple-dataset-directory-from-name)

app/controllers/AiModelController.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import play.api.libs.json.{Json, OFormat}
1212
import play.api.mvc.{Action, AnyContent, PlayBodyParsers}
1313
import play.silhouette.api.Silhouette
1414
import security.WkEnv
15-
import utils.ObjectId
15+
import com.scalableminds.util.objectid.ObjectId
1616

1717
import javax.inject.Inject
1818
import scala.concurrent.ExecutionContext
@@ -42,7 +42,7 @@ object RunTrainingParameters {
4242

4343
case class RunInferenceParameters(annotationId: Option[ObjectId],
4444
aiModelId: ObjectId,
45-
datasetName: String,
45+
datasetDirectoryName: String,
4646
organizationId: String,
4747
colorLayerName: String,
4848
boundingBox: String,
@@ -147,7 +147,7 @@ class AiModelController @Inject()(
147147
jobCommand = JobCommand.train_model
148148
commandArgs = Json.obj(
149149
"training_annotations" -> Json.toJson(trainingAnnotations),
150-
"organization_name" -> organization._id,
150+
"organization_id" -> organization._id,
151151
"model_id" -> modelId,
152152
"custom_workflow_provided_by_user" -> request.body.workflowYaml
153153
)
@@ -180,21 +180,19 @@ class AiModelController @Inject()(
180180
"organization.notFound",
181181
request.body.organizationId)
182182
_ <- bool2Fox(request.identity._organization == organization._id) ?~> "job.runInference.notAllowed.organization" ~> FORBIDDEN
183-
dataset <- datasetDAO.findOneByNameAndOrganization(request.body.datasetName, organization._id) ?~> Messages(
184-
"dataset.notFound",
185-
request.body.datasetName)
183+
dataset <- datasetDAO.findOneByDirectoryNameAndOrganization(request.body.datasetDirectoryName, organization._id)
186184
dataStore <- dataStoreDAO.findOneByName(dataset._dataStore) ?~> "dataStore.notFound"
187185
_ <- aiModelDAO.findOne(request.body.aiModelId) ?~> "aiModel.notFound"
188186
_ <- datasetService.assertValidDatasetName(request.body.newDatasetName)
189-
_ <- datasetService.assertNewDatasetName(request.body.newDatasetName, organization._id)
190187
jobCommand = JobCommand.infer_with_model
191188
boundingBox <- BoundingBox.fromLiteral(request.body.boundingBox).toFox
192189
commandArgs = Json.obj(
193-
"organization_name" -> organization._id,
190+
"organization_id" -> organization._id,
194191
"dataset_name" -> dataset.name,
195192
"color_layer_name" -> request.body.colorLayerName,
196193
"bounding_box" -> boundingBox.toLiteral,
197194
"model_id" -> request.body.aiModelId,
195+
"dataset_directory_name" -> request.body.datasetDirectoryName,
198196
"new_dataset_name" -> request.body.newDatasetName,
199197
"custom_workflow_provided_by_user" -> request.body.workflowYaml
200198
)

app/controllers/AnnotationController.scala

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import org.apache.pekko.util.Timeout
44
import play.silhouette.api.Silhouette
55
import com.scalableminds.util.accesscontext.{DBAccessContext, GlobalAccessContext}
66
import com.scalableminds.util.geometry.BoundingBox
7+
import com.scalableminds.util.objectid.ObjectId
78
import com.scalableminds.util.time.Instant
89
import com.scalableminds.util.tools.{Fox, FoxImplicits}
910
import com.scalableminds.webknossos.datastore.models.annotation.AnnotationLayerType.AnnotationLayerType
@@ -34,7 +35,7 @@ import play.api.libs.json._
3435
import play.api.mvc.{Action, AnyContent, PlayBodyParsers}
3536
import security.{URLSharing, UserAwareRequestLogging, WkEnv}
3637
import telemetry.SlackNotificationService
37-
import utils.{ObjectId, WkConf}
38+
import utils.WkConf
3839

3940
import javax.inject.Inject
4041
import scala.concurrent.ExecutionContext
@@ -242,15 +243,11 @@ class AnnotationController @Inject()(
242243
} yield result
243244
}
244245

245-
def createExplorational(organizationId: String, datasetName: String): Action[List[AnnotationLayerParameters]] =
246+
def createExplorational(datasetId: String): Action[List[AnnotationLayerParameters]] =
246247
sil.SecuredAction.async(validateJson[List[AnnotationLayerParameters]]) { implicit request =>
247248
for {
248-
organization <- organizationDAO.findOne(organizationId)(GlobalAccessContext) ?~> Messages(
249-
"organization.notFound",
250-
organizationId) ~> NOT_FOUND
251-
dataset <- datasetDAO.findOneByNameAndOrganization(datasetName, organization._id) ?~> Messages(
252-
"dataset.notFound",
253-
datasetName) ~> NOT_FOUND
249+
datasetIdValidated <- ObjectId.fromString(datasetId)
250+
dataset <- datasetDAO.findOne(datasetIdValidated) ?~> Messages("dataset.notFound", datasetIdValidated) ~> NOT_FOUND
254251
annotation <- annotationService.createExplorationalFor(
255252
request.identity,
256253
dataset._id,
@@ -262,19 +259,12 @@ class AnnotationController @Inject()(
262259
} yield JsonOk(json)
263260
}
264261

265-
def getSandbox(organization: String,
266-
datasetName: String,
267-
typ: String,
268-
sharingToken: Option[String]): Action[AnyContent] =
262+
def getSandbox(datasetId: String, typ: String, sharingToken: Option[String]): Action[AnyContent] =
269263
sil.UserAwareAction.async { implicit request =>
270264
val ctx = URLSharing.fallbackTokenAccessContext(sharingToken) // users with dataset sharing token may also get a sandbox annotation
271265
for {
272-
organization <- organizationDAO.findOne(organization)(GlobalAccessContext) ?~> Messages(
273-
"organization.notFound",
274-
organization) ~> NOT_FOUND
275-
dataset <- datasetDAO.findOneByNameAndOrganization(datasetName, organization._id)(ctx) ?~> Messages(
276-
"dataset.notFound",
277-
datasetName) ~> NOT_FOUND
266+
datasetIdValidated <- ObjectId.fromString(datasetId)
267+
dataset <- datasetDAO.findOne(datasetIdValidated)(ctx) ?~> Messages("dataset.notFound", datasetIdValidated) ~> NOT_FOUND
278268
tracingType <- TracingType.fromString(typ).toFox
279269
_ <- bool2Fox(tracingType == TracingType.skeleton) ?~> "annotation.sandbox.skeletonOnly"
280270
annotation = Annotation(

0 commit comments

Comments
 (0)