8484 model_path = Path (MODEL_BASE_URL )
8585 if not model_path .exists ():
8686 log .warning (f"Model source path does not exist or is inaccessible: { MODEL_BASE_URL } " )
87- exit ()
8887
8988# Validate DATA_BASE_URL
9089parsed = urlparse (DATA_BASE_URL )
9897 data_path = Path (DATA_BASE_URL )
9998 if not data_path .exists ():
10099 log .warning (f"Data source path does not exist or is inaccessible: { DATA_BASE_URL } " )
101- exit ()
102100
103101from scoutbot import agg , loc , tile , wic , tile_batched # NOQA
104102from scoutbot .loc import CONFIGS as LOC_CONFIGS # NOQA
@@ -141,6 +139,9 @@ def get_resource_from_source(resource_name, resource_hash, source_base, resource
141139 )
142140 else :
143141 # It's a local or network path
142+ if source_base .startswith ('file://' ):
143+ source_base = source_base [7 :]
144+
144145 source_path = Path (source_base ) / resource_name
145146
146147 if not source_path .exists ():
@@ -152,6 +153,9 @@ def get_resource_from_source(resource_name, resource_hash, source_base, resource
152153 cache_dir .mkdir (parents = True , exist_ok = True )
153154 cache_path = cache_dir / resource_name
154155
156+ if source_path .resolve () == cache_path .resolve ():
157+ return str (source_path )
158+
155159 # Only copy if not already cached or file has changed
156160 if not cache_path .exists () or os .path .getmtime (source_path ) > os .path .getmtime (cache_path ):
157161 log .debug (f"Copying { resource_type } from { source_path } to cache { cache_path } " )
0 commit comments