Skip to content

Commit aa91217

Browse files
authored
Fix SparkKubernetesConfig (#137)
Move network calls to __post_init__ from static context
1 parent 18785ca commit aa91217

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

spark_utils/models/k8s_config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class SparkKubernetesConfig:
1313
Configuration parameters required to launch a k8s driver in client mode.
1414
"""
1515

16+
def __post_init__(self):
17+
self.driver_ip = socket.gethostbyname(socket.gethostname())
18+
self.driver_name = socket.gethostname()
19+
1620
# Spark Application name for this session.
1721
application_name: str
1822

@@ -32,10 +36,10 @@ class SparkKubernetesConfig:
3236
default_executor_memory: Optional[int] = 2000
3337

3438
# Name of a driver host.
35-
driver_name: Optional[str] = socket.gethostname()
39+
driver_name: Optional[str] = None
3640

3741
# IP address of a driver host.
38-
driver_ip: Optional[str] = socket.gethostbyname(socket.gethostname())
42+
driver_ip: Optional[str] = None
3943

4044
# Prefix to use when naming executors.
4145
executor_name_prefix: Optional[str] = None

0 commit comments

Comments
 (0)