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 1
1
from __future__ import annotations
2
2
3
+ import logging
3
4
from asyncio import Lock
4
5
from typing import TYPE_CHECKING
5
6
@@ -118,6 +119,14 @@ async def _initialize_alias_storages(cls) -> None:
118
119
This method is called once to populate storage_instance_manager alias related cache. All existing alias
119
120
storages are saved in storage_instance_manager cache. If the alias storage is not there, it does not exist yet.
120
121
"""
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
+
121
130
async with cls .get_alias_init_lock ():
122
131
if cls ._alias_storages_initialized :
123
132
return
Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import base64
4
+ import logging
4
5
from logging import getLogger
5
6
from typing import TYPE_CHECKING
6
7
@@ -89,6 +90,12 @@ def _create_fernet(token: str) -> Fernet:
89
90
return Fernet (base64 .urlsafe_b64encode (token_32 ))
90
91
91
92
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
+
92
99
default_kvs_client = await self .get_default_kvs_client ()
93
100
await default_kvs_client .get ()
94
101
@@ -117,7 +124,7 @@ async def get_default_kvs_client() -> KeyValueStoreClientAsync:
117
124
# Create Apify client with the provided token and API URL
118
125
119
126
configuration = Configuration .get_global_configuration ()
120
- if configuration .is_at_home :
127
+ if not configuration .is_at_home :
121
128
raise NotImplementedError ('Alias storages are only supported on Apify platform at the moment.' )
122
129
123
130
apify_client_async = ApifyClientAsync (
You can’t perform that action at this time.
0 commit comments