-
Notifications
You must be signed in to change notification settings - Fork 24
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
Allow to continue upload after browser restart for same user #7981
Conversation
…e-robust-resumable-upload
reenable checking for duplicate dataset names when not continuing an upload
@philippotto could you please review the frontend and @normanrz could you please review the backend code? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool stuff!! didn't test yet but already left some comments :)
@@ -76,7 +76,7 @@ | |||
"start": "node tools/proxy/proxy.js", | |||
"build": "node --max-old-space-size=4096 node_modules/.bin/webpack --env production", | |||
"@comment build-backend": "Only check for errors in the backend code like done by the CI. This command is not needed to run WEBKNOSSOS", | |||
"build-backend": "yarn build-wk-backend && yarn build-wk-datastore && yarn build-wk-tracingstore", | |||
"build-backend": "yarn build-wk-backend && yarn build-wk-datastore && yarn build-wk-tracingstore && rm webknossos-tracingstore/conf/messages webknossos-datastore/conf/messages", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These message files are generated by the script as the tracingstore and datastore are built. When they are not deleted and one tries to run the script again the compilation of the two components somehow fails. After running into this multiple times (me having to manually delete these files) as well as taking care of not pushing these files, I simply wanted the script to also take care of cleaning up the auto-generated message files :)
@@ -1307,6 +1307,35 @@ export function reserveDatasetUpload( | |||
); | |||
} | |||
|
|||
export type OngoingUpload = { | |||
uploadId: string; | |||
dataSourceId: { name: string; organizationName: string }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually we call this datasetId in the frontend (see APIDatasetId
). can we use that term here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, thanks. missed that.
But in the backend the name is usually called dataSourceId
? So we do have a naming mismatch between the frontend and backend here 🥴?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback philipp :)
I applied / commented everything :)
@@ -1307,6 +1307,35 @@ export function reserveDatasetUpload( | |||
); | |||
} | |||
|
|||
export type OngoingUpload = { | |||
uploadId: string; | |||
dataSourceId: { name: string; organizationName: string }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, thanks. missed that.
But in the backend the name is usually called dataSourceId
? So we do have a naming mismatch between the frontend and backend here 🥴?
@@ -76,7 +76,7 @@ | |||
"start": "node tools/proxy/proxy.js", | |||
"build": "node --max-old-space-size=4096 node_modules/.bin/webpack --env production", | |||
"@comment build-backend": "Only check for errors in the backend code like done by the CI. This command is not needed to run WEBKNOSSOS", | |||
"build-backend": "yarn build-wk-backend && yarn build-wk-datastore && yarn build-wk-tracingstore", | |||
"build-backend": "yarn build-wk-backend && yarn build-wk-datastore && yarn build-wk-tracingstore && rm webknossos-tracingstore/conf/messages webknossos-datastore/conf/messages", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These message files are generated by the script as the tracingstore and datastore are built. When they are not deleted and one tries to run the script again the compilation of the two components somehow fails. After running into this multiple times (me having to manually delete these files) as well as taking care of not pushing these files, I simply wanted the script to also take care of cleaning up the auto-generated message files :)
// Rename "team" to "organization" as this is the actual used current naming. | ||
return ongoingUploads.map(({ dataSourceId: { name, team }, ...rest }) => ({ | ||
return ongoingUploads.map(({ datasetId: { name, team }, ...rest }) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just tested this, and I think this needs to be changed back to dataSourceId here because the back-end uses that. otherwise, I get:
TypeError: Cannot read properties of undefined (reading 'name')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, thanks for spotting. Should be better now hopefully. will retest on monday
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested and worked :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback 🙏. It should be applied now except for one comment which I do not understand and need clarification. I commented the comment in question :)
_ <- runningUploadMetadataStore.insert( | ||
Json.stringify(Json.toJson(DataSourceId(reserveUploadInformation.name, reserveUploadInformation.organization))), | ||
reserveUploadInformation.uploadId | ||
) | ||
_ <- runningUploadMetadataStore.insert( | ||
redisKeyForLinkedLayerIdentifier(reserveUploadInformation.uploadId), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I dont full understand your comment 🤔
With
Now we are inserting two different types of data into the same set.
you mean, that now a stringified json object is used as a key while the other inserts always use a "string only" key?
And to not have this you would want to add a new store to redis just to save the necessary mapping from datasource id back to the ongoing upload info stored in redis? This acutally seemes a little overkill. I instead could implement something like redisKeyForDatasourceId
or so and this would transform a given datasource id into a unique string. Does that sound better?
foundOngoingUploads = maybeOngoingUploads.filter(idBox => idBox.isDefined).flatMap(idBox => idBox.value).collect { | ||
case Some(value) => value | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a more consice version:
foundOngoingUploads = maybeOngoingUploads.collect { case Full(Some(value)) => value }
The type of maybeOngoingUploads
is List[Box[Option[OngoingUpload]]]
This information is not present in the backend as it is only passed to the worker conversion job once the conversion job is started. Storing this in the backend would need some further implementation effort :)
I think that would be possible. I would need to retrieve this information from Redis and then append it to the OngoingUploads case class objects (which will be renamed soon). I might need some time but definitely doable. The question: Should this be included in the first version? |
And now everything should be named consistently. At least I tried 🙈. I'll do retesting tomorrow :) |
Should work :) |
…e-robust-resumable-upload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replied to the thread about redis keys. Other than that, the backend looks good to me now :)
And what about
? |
Ah, sorry, I missed that. Ok then let’s skip the pre-filling for voxel size. I think the little sanity check would be good to have already in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for adding that! Worked for me! Backend LGTM, leaving final approval to frontend folks
…y and less guessy
…e-robust-resumable-upload
I tweaked the frontend check a little (compared to the version from Friday):
|
Should be good now :) |
…ds/webknossos into more-robust-resumable-upload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
last review said: "Backend LGTM, leaving final approval to frontend folks"
URL of deployed dev instance (used for testing):
Steps to test:
dataset_upload_view.tsx
and set a breakpoint in line 425 (beforeresumableUpload.upload();
is called upon the files added action./datasets
route testing whether a chunk is already present. They should be returning 204 if no chunk was previously uploaded. If you tweaked the testing such that some chunks were already uploaded, some of these requests should answer 200 (signaling the chunk is present) (see below)TODOs:
Issues:
(Please delete unneeded items, merge only when none are left open)