File tree Expand file tree Collapse file tree 4 files changed +27
-6
lines changed
snakemake_interface_storage_plugins Expand file tree Collapse file tree 4 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 2121 uses : actions/checkout@v4
2222
2323 - name : Install Pixi
24- uses : prefix-dev/setup-pixi@v0.8.3
24+ uses : prefix-dev/setup-pixi@v0
2525 with :
2626 environments : dev
27- pixi-version : v0.42.1
2827
2928 - name : Ruff Format
3029 if : always()
4948 - uses : actions/checkout@v4
5049
5150 - name : Install Pixi
52- uses : prefix-dev/setup-pixi@v0.8.3
51+ uses : prefix-dev/setup-pixi@v0
5352 with :
5453 environments : dev
55- pixi-version : v0.42.1
5654
5755 - name : Run tests
5856 run : pixi run --environment dev test --show-capture=all -s -vv
Original file line number Diff line number Diff line change @@ -22,11 +22,10 @@ homepage = "https://github.com/snakemake/snakemake-interface-storage-plugins"
2222requires = [" poetry-core" ]
2323build-backend = " poetry.core.masonry.api"
2424
25- [tool .pixi .project ]
25+ [tool .pixi .workspace ]
2626channels = [" conda-forge" ]
2727platforms = [" osx-arm64" , " linux-64" ]
2828
29-
3029[tool .pixi .tasks ]
3130
3231[tool .pixi .dependencies ]
Original file line number Diff line number Diff line change 1+ from pathlib import Path
2+ from typing import Optional
3+
4+
5+ class FileOrDirectoryNotFoundError (Exception ):
6+ def __init__ (self , local_path : Path , query : Optional [str ]):
7+ self .query : Optional [str ] = query
8+ self .local_path : Path = local_path
9+ msg = (
10+ f"Storage object { query } not found in storage (local path: { local_path !s} )."
11+ if query
12+ else f"File or directory not found: { local_path !s} "
13+ )
14+ super ().__init__ (msg )
15+
16+ def is_for_path (self , path : Path ) -> bool :
17+ return self .local_path .resolve () == path .resolve ()
Original file line number Diff line number Diff line change 1919from snakemake_interface_common .logging import get_logger
2020from snakemake_interface_storage_plugins .common import Operation , get_disk_free
2121
22+ from snakemake_interface_storage_plugins .exceptions import FileOrDirectoryNotFoundError
2223from snakemake_interface_storage_plugins .io import IOCacheStorageInterface
2324from snakemake_interface_storage_plugins .storage_provider import StorageProviderBase
2425
@@ -173,18 +174,24 @@ def retrieve_object(self):
173174 """
174175 ...
175176
177+ def _raise_object_not_found_if_not_exists (self ):
178+ if not self .exists ():
179+ raise FileOrDirectoryNotFoundError (self .print_query , self .local_path ())
180+
176181 async def managed_size (self ) -> int :
177182 try :
178183 async with self ._rate_limiter (Operation .SIZE ):
179184 return self .size ()
180185 except Exception as e :
186+ self ._raise_object_not_found_if_not_exists ()
181187 raise WorkflowError (f"Failed to get size of { self .print_query } " , e )
182188
183189 async def managed_mtime (self ) -> float :
184190 try :
185191 async with self ._rate_limiter (Operation .MTIME ):
186192 return self .mtime ()
187193 except Exception as e :
194+ self ._raise_object_not_found_if_not_exists ()
188195 raise WorkflowError (f"Failed to get mtime of { self .print_query } " , e )
189196
190197 async def managed_exists (self ) -> bool :
You can’t perform that action at this time.
0 commit comments