Skip to content

Commit 4f3ce17

Browse files
feat: cache individual assets on the snakemake side of the API
1 parent 0a3228b commit 4f3ce17

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

snakemake_interface_software_deployment_plugins/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,9 @@ async def cache_asset(self, asset: str) -> None:
354354
"""
355355
...
356356

357-
async def managed_cache_assets(self) -> None:
357+
async def managed_cache_asset(self, asset: str) -> None:
358358
try:
359-
for asset in await self.get_cache_assets():
360-
await self.cache_asset(asset)
359+
await self.cache_asset(asset)
361360
except Exception as e:
362361
raise WorkflowError(f"Caching of {self.spec} failed: {e}") from e
363362

snakemake_interface_software_deployment_plugins/tests.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ def test_cache(self, tmp_path):
103103

104104
assert isinstance(env, CacheableEnvBase)
105105

106-
asyncio.run(env.cache_assets())
106+
async def cache_assets():
107+
for asset in env.get_cache_assets():
108+
await env.managed_cache_asset(asset)
109+
110+
asyncio.run(cache_assets())
107111

108112
self._deploy(env, tmp_path)
109113

0 commit comments

Comments
 (0)