-
Notifications
You must be signed in to change notification settings - Fork 9
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 filters in DID search #36
Comments
Hi, all! The author of the fork here. You can find a prototype of the interface located here: link. As I've mentioned previously on the Mattermost, I've been trying to integrate this interface in the extension but I've been having some issues with it. It seems that the functionality that should fire after clicking the newly introduced button is simply not there. After more digging, I discovered to my surprise that now I cannot even remove the button... It's just stuck there and even removing the code associated with it doesn't do anything. I have checked if the extension gets built correctly, I've also checked the Any insights on this issue are welcome. P.S.: As I was advised, I've rebased my fork onto the master branch of this fork made by @garciagenrique. |
Ok, I've figured it out. It was a blunder from my side. A typo in the |
The functionality for filtering the DIDs based on the specified filters of user metadata is now added. Feel free to test it. There are a couple of things which are important to mention. If you'll look at the code, you will notice that I've added a function Another issue is that the JSON plugin doesn't return some attributes like a DID type, and file size, which are required if we want to display the DIDs correctly in the panel with the search results. As a workaround, I've added a method Also, something that I haven't thought about so far is the tests. I'll have to take a look at that. |
Hello @GeorgySk |
I downloaded your version and gave it a try. It seems to work properly. The only thing I found is that errors are not properly handled. For example:
2024-08-20 10:39:17,470 ERROR Provided metadata is considered invalid.
I haven't yet looked into the tests or the documentation. Thank you very much. Great effort! |
The problem with Rucio API error handling is probably not related to this feature, but something general throughout the exension that should be improved. |
I created a PR with some changes to be merged in @GeorgySk 's branch, mainly test fixes: GeorgySk#1 I only fixed the already existing tests and included a minimal test on a React component. It would be good to include some tests additional tests specifically on the usage of metadata filters on the python side. From the implementation pov I wonder if it would be possible to have another React component (e.g. MetadataFilterList), containing the list of metadata filters and the methods to manage them, in a separate module, instead of having everything in ExploreTab.tsx. This would also ease testing the addition, removal of new filters. I don't think these improvements should be blocking in case there's an urgent need to have this feature in production. But, if there's no hurry, I'd rather implement them. |
Thanks for the PR, @ftorradeflot! I will get back to you with a feedback on it later. Me and Andres Tanasijczuk also discussed the new code on Slack, and he had some comments on it as well. I will post them here to have everything in one place.
|
Regarding the first point about the One thing to note here is that the extension wraps all the filter keys and values in quotes regardless of if they are numeric or not. Numbers will then be casted to numeric types by calls to |
I've just pushed a fix for that issue with string values that are not valid Python syntax. Now all non-numeric keys/values get additional quotes that help preventing unwarranted |
@ftorradeflot, I've just pushed a couple of more changes:
I've also looked into displaying errors for the case when there is a mismatch between types of filter values (e.g. when a file has a metadata value of a string type, but in the search field we specify a numeric value). But it seems like some changes should be introduced to the Rucio's code first. From what I understand, it doesn't handle response 500 correctly here. Instead, I'm getting
If this is fixed, then I'd only have to add a couple of lines here to display an error instead of just "No results found". In principle, I've finished with the code. I'm not sure what else is left to do. I mentioned that the JSON plugin doesn't return some of the attributes, and that I had to add calls to Rucio to retrieve regular metadata for each DID. But, in the end, I don't think I can do anything on the side of the extension, as, for example, I cannot simply ignore the size of the file since it is actually displayed in the panel with the results. Should I create a pull request? |
I second the assumption |
Yes, @GeorgySk I think you can create a pull request |
The DID search in the jupyterlab extension only takes into account three parameters: name, scope and type.
It would be useful to be able to filter the DIDs by user-defined metadata. This could be done by adding an additional "filters" parameter in the DID search and forwarding it to the "filters" argument in the /dids/{scope}/dids/search REST API endpoint that relies on rucio.core.did.list_dids method.
The "filters" argument is not listed in the documentation of the REST API method, but it seems to be there when looking into the underlying code
An effort to implement this feature has been started in this fork
The text was updated successfully, but these errors were encountered: