File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 2525 EventPersistStateData ,
2626 EventSystemInfoData ,
2727)
28+ from crawlee .storage_clients import FileSystemStorageClient
2829
2930from apify ._charging import ChargeResult , ChargingManager , ChargingManagerImplementation
3031from apify ._configuration import Configuration
@@ -244,7 +245,13 @@ def _finalize_implicit_local_storage_client(self) -> StorageClient:
244245 'Storage client in service locator was set explicitly before Actor.init was called.'
245246 'Using the existing storage client as implicit storage client for the Actor.'
246247 )
248+
247249 self ._local_storage_client = service_locator .get_storage_client ()
250+ if type (self ._local_storage_client ) is FileSystemStorageClient :
251+ self .log .warning (
252+ 'Using `FileSystemStorageClient` in Actor context is not recommended and can lead to '
253+ 'problems with reading the input file. Use `ApifyFileSystemStorageClient` instead.'
254+ )
248255 return self ._local_storage_client
249256
250257 @property
Original file line number Diff line number Diff line change 77from crawlee .configuration import Configuration as CrawleeConfiguration
88from crawlee .crawlers import BasicCrawler
99from crawlee .errors import ServiceConflictError
10+ from crawlee .storage_clients import FileSystemStorageClient
1011
1112from apify import Actor
1213from apify import Configuration as ApifyConfiguration
@@ -215,3 +216,15 @@ async def test_storage_retrieved_is_same_with_same_config() -> None:
215216 crawler_kvs = await crawler .get_key_value_store ()
216217
217218 assert actor_kvs is crawler_kvs
219+
220+
221+ async def test_file_system_storage_client_warning (caplog : pytest .LogCaptureFixture ) -> None :
222+ service_locator .set_storage_client (FileSystemStorageClient ())
223+ caplog .set_level ('WARNING' )
224+ async with Actor ():
225+ ...
226+
227+ assert (
228+ 'Using `FileSystemStorageClient` in Actor context is not recommended and can lead to problems with reading '
229+ 'the input file. Use `ApifyFileSystemStorageClient` instead.'
230+ ) in caplog .messages
You can’t perform that action at this time.
0 commit comments