-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add Storage Management API #15295
Add Storage Management API #15295
Conversation
I think |
Thanks, Nicola, there is no technical reason for the order. I just thought that it reads more naturally this way: So I'm 100% fine with either option (or a totally different one) 😄 |
I guess
and similarly for datasets. |
Ok, that is a good point. I won't implement this general endpoint for now, but it might be helpful in the future, so I will change the order to accommodate it. By the way, I thought the |
b21dba2
to
1c67f4b
Compare
d30f48b
to
d6eb10c
Compare
612b311
to
8bcedd3
Compare
storage.dashboard.mp4select all checkbox state is not correct when clicked: storage.dashboard.2.mp4 |
Thank you for having a look @itisAliRH! 👍
Does this happen with Celery disabled? With Celery enabled, it looks like when the cleanup request finishes and reports the results celery tasks in the background are still processing the actual purging of the datasets... so when you get the updated summary after the cleanup it still thinks that some of the items are not purged. Then when you open the review dialog some more might have been purged by then... this is definitely a bug. I need to think about how to get the requests in sync... 🤔
This is intentional behavior, the checkbox at the top left is only for the current "page" due to the items being paginated. If you really want to select "all" then you need to click the "select all X items" link at the top right. But it looks like it may be confusing... any UX ideas to communicate this better to the user? |
8bcedd3
to
a04c4d5
Compare
I think I fixed the issue by splitting the cleanup of datasets into 2 phases: This should make every subsequent request consistent independently of the status of the scheduled task. @itisAliRH can you give it another try with these changes? Thank you! |
I just tried it again, and the first issue is fixed, thanks @davelopez!
I see, but in this case, the select all icon shows the wrong status. Even when clicking on the "select all X items", shows the indeterminate status, not the full check. Screen.Recording.2023-02-09.at.12.00.53.mp4 |
a04c4d5
to
0272a3a
Compare
Thanks for noticing this! I've removed the limit for items that can be reviewed at once and forced the general check box in the table to behave like the "select all X items" link. I think I had to do all this juggling to deal with pagination because the request for the items was a bit slow. Now with the new API, in my local tests, with hundreds of items is surprisingly fast so I could overcome the select all checkbox limitation, and the selection should be simpler now. @itisAliRH give it another try when you have time and let me know if now you like it better 😉 |
@davelopez Thanks! I prefer to select all items on the current page by clicking on the
This problem came back again :( |
Ok, I think the least confusing option here is to remove the select all link and leave just the checkbox. Enabling the checkbox for selecting individual pages can be confusing too and the link was just to try to workaround the pagination issue, which seems to not be a problem anymore. |
752d748
to
1d31285
Compare
1d31285
to
d9429a0
Compare
I think this one is ready for review, especially the backend part around the new database queries and the way datasets are purged now in 2 phases. I'm happy to rethink this if this approach is not desirable. The client part is mostly refactorings and simplifications to adapt to the new API, and also a few fixes/enhancements around the cleanable items review dialog. |
No point in keeping it required, since the encoding/decoding should be done directly in the model parsing going forward.
When listing datasets, the `total_size` can be None in some error statuses, so make it 0 by default.
To avoid interactions with other tests that may alter the state of datasets or histories
This reverts commit edfa629. Maybe worth adding it back later.
Purge associations and datasets in 2 steps: First synchronously mark all associations as purged in one transaction. Then purge internal datasets in a celery task or synchronously if not available. This will ensure that the associations are marked as purged when the request finishes keeping the results consistent between subsequent requests.
The new API is much faster now, so maybe this is an early optimization that hinders the usability.
The checkbox toggle now runs asynchronously so we must wait for the promise to finish.
It can happen that storage space is not recovered but items were permanently deleted if those items were copies of other items. This makes sure that the summary data gets re-requested after a potential change in the results.
d9429a0
to
68f8436
Compare
This requires some adjustments to make it compatible with #14073 (working on it) |
Very nice polish - thank you! |
This adds some new API endpoints to simplify the user's monitoring and cleanup of used storage.
Before these changes, the Storage Dashboard (#13113) in the client had to do some extra logic and workarounds to use the existing API. This also offers the opportunity to improve the performance of some of the requests.
I'm still a bit unsure about the route naming, so far this is the convention I will follow unless there are other ideas:/api/storage/{object}/{condition}/[summary]
, where{object}
can be eitherhistory
ordatasets
and{condition}
refers to the way they are discovered, for example:The
summary
endpoints will just return the total number of objects and total size that is taken by them,while the regular endpoint will return a paginated list of objects with the following information for each object:
There is also an endpoint for purging objects in batch ``, you can pass a list of object IDs and it will purge all of them and return detailed information about the result:
TODO
How to test the changes?
License