File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
src/apify/storage_clients/_apify Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import logging
34from asyncio import Lock
45from typing import TYPE_CHECKING
56
@@ -118,6 +119,14 @@ async def _initialize_alias_storages(cls) -> None:
118119 This method is called once to populate storage_instance_manager alias related cache. All existing alias
119120 storages are saved in storage_instance_manager cache. If the alias storage is not there, it does not exist yet.
120121 """
122+ if not Configuration .get_global_configuration ().is_at_home :
123+ logging .getLogger (__name__ ).warning (
124+ 'Alias storage limited retention is only supported on Apify platform. '
125+ 'No pre-existing storages are imported.'
126+ )
127+ cls ._alias_storages_initialized = True
128+ return
129+
121130 async with cls .get_alias_init_lock ():
122131 if cls ._alias_storages_initialized :
123132 return
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import base64
4+ import logging
45from logging import getLogger
56from typing import TYPE_CHECKING
67
@@ -89,6 +90,12 @@ def _create_fernet(token: str) -> Fernet:
8990 return Fernet (base64 .urlsafe_b64encode (token_32 ))
9091
9192 async def store_mapping_to_apify_kvs (self , storage_id : str ) -> None :
93+ if not Configuration .get_global_configuration ().is_at_home :
94+ logging .getLogger (__name__ ).warning (
95+ 'Alias storage limited retention is only supported on Apify platform. Storage is not exported.'
96+ )
97+ return
98+
9299 default_kvs_client = await self .get_default_kvs_client ()
93100 await default_kvs_client .get ()
94101
@@ -117,7 +124,7 @@ async def get_default_kvs_client() -> KeyValueStoreClientAsync:
117124 # Create Apify client with the provided token and API URL
118125
119126 configuration = Configuration .get_global_configuration ()
120- if configuration .is_at_home :
127+ if not configuration .is_at_home :
121128 raise NotImplementedError ('Alias storages are only supported on Apify platform at the moment.' )
122129
123130 apify_client_async = ApifyClientAsync (
You can’t perform that action at this time.
0 commit comments