Skip to content

Commit

Permalink
fix bucket cache keying
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmot committed Jul 14, 2024
1 parent 0ccd16b commit 021591a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pydatatask/query/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ async def map_values(a: repomodule.Repository, b: Callable[[object], Awaitable[o
async def inner(_key, obj):
return await b(obj)

return a.map(inner)
return a.map(inner, [])


@_builtin("map")
Expand All @@ -398,7 +398,7 @@ async def map_key_values(
async def inner(key, obj):
return await b(Key(key), obj)

return a.map(inner)
return a.map(inner, [])


@_builtin("rekey")
Expand All @@ -407,9 +407,9 @@ async def inner(k: str) -> str:
return str(await b(Key(k)))

if isinstance(a, repomodule.MetadataRepository):
return repomodule.RelatedItemMetadataRepository(a, repomodule.FunctionCallMetadataRepository(inner, a))
return repomodule.RelatedItemMetadataRepository(a, repomodule.FunctionCallMetadataRepository(inner, a, []))
else:
return repomodule.RelatedItemRepository(a, repomodule.FunctionCallMetadataRepository(inner, a))
return repomodule.RelatedItemRepository(a, repomodule.FunctionCallMetadataRepository(inner, a, []))


@_builtin("filter")
Expand Down
6 changes: 3 additions & 3 deletions pydatatask/repository/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ def __init__(
def footprint(self):
yield self

async def cache_key(self, job):
return f"bucket:{self.bucket}/{job}"

def __getstate__(self) -> Any:
return (self.endpoints, self.bucket)

Expand Down Expand Up @@ -167,6 +164,9 @@ def __init__(
self.suffix = suffix
self.mimetype = mimetype

async def cache_key(self, job):
return f"bucket:{self.bucket}/{self.prefix}{job}{self.suffix}"

def __getstate__(self):
return (super().__getstate__(), self.prefix, self.suffix, self.mimetype)

Expand Down

0 comments on commit 021591a

Please sign in to comment.