spark_on_k8s.api
Implementation reference. These symbols describe how the project works; their presence here does not make them supported application imports. Use the documented entry points and support policy .
logger = logging . getLogger ( 'spark_on_k8s.api' )
module-attribute
AsyncHttpClientSingleton
Async HTTP client singleton.
Source code in spark_on_k8s/api/__init__.py
35
36
37
38
39
40
41
42
43
44 class AsyncHttpClientSingleton :
"""Async HTTP client singleton."""
_client : AsyncClient | None = None
@classmethod
def client ( cls ) -> AsyncClient :
if not cls . _client :
cls . _client = AsyncClient ()
return cls . _client
client ()
classmethod
Source code in spark_on_k8s/api/__init__.py
@classmethod
def client ( cls ) -> AsyncClient :
if not cls . _client :
cls . _client = AsyncClient ()
return cls . _client
KubernetesClientSingleton
Kubernetes client singleton.
Source code in spark_on_k8s/api/__init__.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 class KubernetesClientSingleton :
"""Kubernetes client singleton."""
client_manager : KubernetesAsyncClientManager = KubernetesAsyncClientManager (
config_file = Configuration . SPARK_ON_K8S_CONFIG_FILE ,
context = Configuration . SPARK_ON_K8S_CONTEXT ,
client_configuration = Configuration . SPARK_ON_K8S_ASYNC_CLIENT_CONFIG ,
in_cluster = Configuration . SPARK_ON_K8S_IN_CLUSTER ,
)
_client : ApiClient | None = None
@classmethod
async def client ( cls ) -> ApiClient :
if not cls . _client :
cls . _client = await cls . client_manager . create_client ()
return cls . _client
client_manager = KubernetesAsyncClientManager ( config_file = Configuration . SPARK_ON_K8S_CONFIG_FILE , context = Configuration . SPARK_ON_K8S_CONTEXT , client_configuration = Configuration . SPARK_ON_K8S_ASYNC_CLIENT_CONFIG , in_cluster = Configuration . SPARK_ON_K8S_IN_CLUSTER )
class-attribute
instance-attribute
client ()
async
classmethod
Source code in spark_on_k8s/api/__init__.py
@classmethod
async def client ( cls ) -> ApiClient :
if not cls . _client :
cls . _client = await cls . client_manager . create_client ()
return cls . _client