cloe-nessy 0.3.14.4b0__py3-none-any.whl → 0.3.14.5b0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cloe_nessy/session/session_manager.py +42 -27
- {cloe_nessy-0.3.14.4b0.dist-info → cloe_nessy-0.3.14.5b0.dist-info}/METADATA +1 -2
- {cloe_nessy-0.3.14.4b0.dist-info → cloe_nessy-0.3.14.5b0.dist-info}/RECORD +5 -5
- {cloe_nessy-0.3.14.4b0.dist-info → cloe_nessy-0.3.14.5b0.dist-info}/WHEEL +0 -0
- {cloe_nessy-0.3.14.4b0.dist-info → cloe_nessy-0.3.14.5b0.dist-info}/top_level.txt +0 -0
|
@@ -153,57 +153,72 @@ class SessionManager:
|
|
|
153
153
|
import errors or other exceptions.
|
|
154
154
|
"""
|
|
155
155
|
if cls._env is not None:
|
|
156
|
+
print(f"DEBUG: Environment already detected: {cls._env}")
|
|
156
157
|
return cls._env
|
|
157
158
|
|
|
158
|
-
|
|
159
|
-
from databricks.sdk.dbutils import RemoteDbUtils # type: ignore
|
|
159
|
+
print("DEBUG: Starting environment detection...")
|
|
160
160
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
except (ImportError, NameError):
|
|
165
|
-
pass
|
|
161
|
+
# Debug: Print relevant environment variables
|
|
162
|
+
databricks_host = os.getenv("DATABRICKS_HOST")
|
|
163
|
+
nessy_spark_config = os.getenv("NESSY_SPARK_CONFIG")
|
|
166
164
|
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
print(f"DEBUG: DATABRICKS_HOST = {databricks_host}")
|
|
166
|
+
print(f"DEBUG: NESSY_SPARK_CONFIG = {nessy_spark_config}")
|
|
169
167
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
if nessy_spark_config:
|
|
169
|
+
try:
|
|
170
|
+
config = json.loads(nessy_spark_config)
|
|
171
|
+
if "remote" in config:
|
|
172
|
+
print(f"DEBUG: Remote Spark configuration detected: {config['remote']}")
|
|
173
|
+
return cls.Environment.OTHER_REMOTE_SPARK
|
|
174
|
+
return cls.Environment.STANDALONE_SPARK
|
|
175
|
+
except json.JSONDecodeError as e:
|
|
176
|
+
print(f"DEBUG: Invalid JSON in NESSY_SPARK_CONFIG: {e}")
|
|
177
|
+
raise ValueError(f"Invalid JSON in NESSY_SPARK_CONFIG: {e}") from e
|
|
174
178
|
|
|
179
|
+
print("DEBUG: Checking for Databricks Connect...")
|
|
175
180
|
try:
|
|
176
|
-
from
|
|
181
|
+
from databricks.sdk.dbutils import RemoteDbUtils # type: ignore # noqa: F401
|
|
182
|
+
|
|
183
|
+
print("DEBUG: ✓ Detected DATABRICKS_CONNECT via RemoteDbUtils instance")
|
|
184
|
+
cls._env = cls.Environment.DATABRICKS_CONNECT
|
|
185
|
+
return cls.Environment.DATABRICKS_CONNECT
|
|
177
186
|
|
|
178
|
-
cls._env = cls.Environment.DATABRICKS_UI
|
|
179
|
-
return cls._env
|
|
180
187
|
except ImportError:
|
|
181
|
-
|
|
188
|
+
print("DEBUG: RemoteDbUtils not available")
|
|
182
189
|
|
|
190
|
+
print("DEBUG: Checking for Databricks UI...")
|
|
183
191
|
try:
|
|
184
|
-
from
|
|
185
|
-
SparkSession as RemoteSparkSession, # type: ignore [import-not-found] # noqa: F401
|
|
186
|
-
)
|
|
192
|
+
from dbruntime.dbutils import DBUtils # type: ignore [import-not-found] # noqa: F401
|
|
187
193
|
|
|
188
|
-
|
|
194
|
+
print("DEBUG: ✓ Detected DATABRICKS_UI via dbruntime.dbutils")
|
|
195
|
+
cls._env = cls.Environment.DATABRICKS_UI
|
|
189
196
|
return cls._env
|
|
190
197
|
except ImportError:
|
|
191
|
-
|
|
198
|
+
print("DEBUG: dbruntime.dbutils not available")
|
|
192
199
|
|
|
200
|
+
print("DEBUG: Checking for Fabric UI...")
|
|
193
201
|
try:
|
|
194
|
-
from
|
|
202
|
+
from notebookutils import mssparkutils # type: ignore # noqa: F401
|
|
195
203
|
|
|
196
|
-
|
|
204
|
+
print("DEBUG: ✓ Detected FABRIC_UI via notebookutils")
|
|
205
|
+
cls._env = cls.Environment.FABRIC_UI
|
|
197
206
|
return cls._env
|
|
198
207
|
except ImportError:
|
|
199
|
-
|
|
208
|
+
print("DEBUG: notebookutils not available")
|
|
200
209
|
|
|
201
|
-
|
|
210
|
+
print("DEBUG: No environment could be detected")
|
|
211
|
+
raise RuntimeError(
|
|
212
|
+
"Cannot detect environment. This usually means you're not in a recognized Spark environment. "
|
|
213
|
+
"Ensure you're running in a supported environment (Databricks, Fabric, or with proper Spark "
|
|
214
|
+
"installation configured via NESSY_SPARK_CONFIG)."
|
|
215
|
+
)
|
|
202
216
|
|
|
203
217
|
@classmethod
|
|
204
218
|
def get_spark_builder(cls):
|
|
205
219
|
"""Get the SparkSession builder based on the current environment."""
|
|
206
|
-
cls.
|
|
220
|
+
if cls._env is None:
|
|
221
|
+
cls._detect_env()
|
|
207
222
|
builders = {
|
|
208
223
|
cls.Environment.DATABRICKS_UI: SparkSession.builder,
|
|
209
224
|
cls.Environment.FABRIC_UI: SparkSession.builder,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloe-nessy
|
|
3
|
-
Version: 0.3.14.
|
|
3
|
+
Version: 0.3.14.5b0
|
|
4
4
|
Summary: Your friendly datalake monster.
|
|
5
5
|
Author-email: initions <ICSMC_EXT_PYPIORG@accenture.com>
|
|
6
6
|
License: MIT
|
|
@@ -31,7 +31,6 @@ Requires-Dist: matplotlib<4.0.0,>=3.9.2
|
|
|
31
31
|
Requires-Dist: types-networkx<4.0.0.0,>=3.2.1.20240820
|
|
32
32
|
Requires-Dist: fsspec<2025.7.1,>=2025.7.0
|
|
33
33
|
Requires-Dist: cloe-logging[databricks,log-analytics]<0.4,>=0.3.8
|
|
34
|
-
Requires-Dist: delta-spark>=3.3.2
|
|
35
34
|
|
|
36
35
|
# cloe-nessy
|
|
37
36
|
|
|
@@ -89,12 +89,12 @@ cloe_nessy/pipeline/actions/write_delta_append.py,sha256=fuL29SK9G5K14ycckU3iPex
|
|
|
89
89
|
cloe_nessy/pipeline/actions/write_delta_merge.py,sha256=Hir7QZZZJ9hmQZXiJ9iz6u06OCmcHFpyKFVB_I1saSM,5043
|
|
90
90
|
cloe_nessy/pipeline/actions/write_file.py,sha256=H8LRst045yij-8XJ5pRB9m5d1lZpZjFa0WSVdSFesPo,2984
|
|
91
91
|
cloe_nessy/session/__init__.py,sha256=t7_YjUhJYW3km_FrucaUdbIl1boQtwkyhw_8yE10qzc,74
|
|
92
|
-
cloe_nessy/session/session_manager.py,sha256=
|
|
92
|
+
cloe_nessy/session/session_manager.py,sha256=eyiSiQDpLg6GUwLUiZ8bZbrwh1jN_vYeLiuWFEl7RJo,9123
|
|
93
93
|
cloe_nessy/settings/__init__.py,sha256=ZbkneO3WaKOxon7qHFHnou7EnBOSnBFyKMDZblIEvzM,101
|
|
94
94
|
cloe_nessy/settings/settings.py,sha256=I4n129lrujriW-d8q4as2Kb4_kI932ModfZ5Ow_UpVM,3653
|
|
95
95
|
cloe_nessy/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
96
96
|
cloe_nessy/utils/file_and_directory_handler.py,sha256=r2EVt9xG81p6ScaJCwETC5an6pMT6WseB0jMOR-JlpU,602
|
|
97
|
-
cloe_nessy-0.3.14.
|
|
98
|
-
cloe_nessy-0.3.14.
|
|
99
|
-
cloe_nessy-0.3.14.
|
|
100
|
-
cloe_nessy-0.3.14.
|
|
97
|
+
cloe_nessy-0.3.14.5b0.dist-info/METADATA,sha256=nEbjVCZ8v13CJ9gE-KM_U-Uj1hdw5eSfdMPzU9jW3Ls,3294
|
|
98
|
+
cloe_nessy-0.3.14.5b0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
99
|
+
cloe_nessy-0.3.14.5b0.dist-info/top_level.txt,sha256=Z7izn8HmQpg2wBUb-0jzaKlYKMU7Ypzuc9__9vPtW_I,11
|
|
100
|
+
cloe_nessy-0.3.14.5b0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|