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 25
25
EventPersistStateData ,
26
26
EventSystemInfoData ,
27
27
)
28
+ from crawlee .storage_clients import FileSystemStorageClient
28
29
29
30
from apify ._charging import ChargeResult , ChargingManager , ChargingManagerImplementation
30
31
from apify ._configuration import Configuration
@@ -244,7 +245,13 @@ def _finalize_implicit_local_storage_client(self) -> StorageClient:
244
245
'Storage client in service locator was set explicitly before Actor.init was called.'
245
246
'Using the existing storage client as implicit storage client for the Actor.'
246
247
)
248
+
247
249
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
+ )
248
255
return self ._local_storage_client
249
256
250
257
@property
Original file line number Diff line number Diff line change 7
7
from crawlee .configuration import Configuration as CrawleeConfiguration
8
8
from crawlee .crawlers import BasicCrawler
9
9
from crawlee .errors import ServiceConflictError
10
+ from crawlee .storage_clients import FileSystemStorageClient
10
11
11
12
from apify import Actor
12
13
from apify import Configuration as ApifyConfiguration
@@ -215,3 +216,15 @@ async def test_storage_retrieved_is_same_with_same_config() -> None:
215
216
crawler_kvs = await crawler .get_key_value_store ()
216
217
217
218
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