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

Bug: Multiple items with same name from different providers #448

Merged
merged 11 commits into from
Jul 27, 2023

Conversation

mithunbharadwaj
Copy link
Collaborator

No description provided.

@mithunbharadwaj mithunbharadwaj self-assigned this Jul 12, 2023
if pitem is not None:
# If the item already exists, merge or override it
if item.name in uniq:
pitem = uniq[item.name]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep pitem = uniq.get(item.name) and test for a None ... it does the same with the half of the cost.

@eliska-n
Copy link
Collaborator

This is probably fine. I didn't look into the code much but I tested it on a library example. However, I found that subscribing to the library in the filesystem provider is broken and it is because of this MR: #407

Let's sum up asab.library functionality and discuss testing suits - manual or unit tests. It is becoming more and more important.

13-Jul-2023 14:00:35.948043 ERROR root Task exception was never retrieved
{'future': <Task finished name='Task-7' coro=<MyApplication.on_library_ready() done, defined at /home/eliska/teskalabs/playground/asab_library/asab-library-git-example.py:38> exception=TypeError("FileSystemLibraryProvider._list() missing 1 required positional argument: 'index'")>}
Traceback (most recent call last):
  File "/home/eliska/teskalabs/playground/asab_library/asab-library-git-example.py", line 46, in on_library_ready
    await self.LibraryService.subscribe("/")
  File "/home/eliska/teskalabs/asab/asab/library/service.py", line 383, in subscribe
    await provider.subscribe(path)
  File "/home/eliska/teskalabs/asab/asab/library/providers/filesystem.py", line 176, in subscribe
    self._subscribe_recursive(path, path)
  File "/home/eliska/teskalabs/asab/asab/library/providers/filesystem.py", line 188, in _subscribe_recursive
    items = self._list(path_to_be_listed)
TypeError: FileSystemLibraryProvider._list() missing 1 required positional argument: 'index'

@@ -236,10 +229,9 @@ async def list(self, path="/", tenant=None, recursive=False) -> list:
child_items = await self._list(item.name, tenant, providers=item.providers)
items.extend(child_items)
recitems.extend(child_items)

print(items)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove print

@ateska ateska added the bug Something isn't working label Jul 18, 2023
@eliska-n
Copy link
Collaborator

It is ok, I can see just one file from one layer.
Subscribe is also working for the filesystem provider. Maybe it works too much. When I subscribe to the library, I subscribe to all providers. Some files are overridden and, thus, "not visible" to the consumer of the library items. However, the subscribe functionality does not care about the layers and signals any changes even for the files that are "not visible". What is the desired functionality here @ateska ? (I think this is fine and the processes linked to changes to the library should be graceful to this, but maybe I'm wrong.)

@ateska ateska linked an issue Jul 26, 2023 that may be closed by this pull request
@ateska
Copy link
Contributor

ateska commented Jul 26, 2023

It is ok, I can see just one file from one layer.
Subscribe is also working for the filesystem provider. Maybe it works too much. When I subscribe to the library, I subscribe to all providers. Some files are overridden and, thus, "not visible" to the consumer of the library items. However, the subscribe functionality does not care about the layers and signals any changes even for the files that are "not visible". What is the desired functionality here @ateska ? (I think this is fine and the processes linked to changes to the library should be graceful to this, but maybe I'm wrong.)

It is OK for now. It could be refined in the future.

@mithunbharadwaj mithunbharadwaj merged commit 7c76f10 into master Jul 27, 2023
10 checks passed
@ateska ateska deleted the Bug/Multiple-items-library branch August 6, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Library - Filesystem Provider - subscribe
3 participants