decentriq_util 0.1.0.dev7__tar.gz → 0.1.0.dev9__tar.gz
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.
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/PKG-INFO +2 -1
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/spark/__init__.py +10 -4
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/pyproject.toml +2 -1
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/__init__.py +0 -0
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/error.py +0 -0
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/proto/__init__.py +0 -0
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/python/__init__.py +0 -0
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/sql/__init__.py +0 -0
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/sql/proto/__init__.py +0 -0
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/sql/proto/compute_sql_pb2.py +0 -0
- {decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/sql/proto/compute_sql_pb2.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: decentriq_util
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev9
|
|
4
4
|
Summary: Utility functions for Python code run in Decentriq workers
|
|
5
5
|
Author: hafenr
|
|
6
6
|
Author-email: robin.hafen@gmail.com
|
|
@@ -9,6 +9,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.10
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Requires-Dist: numpy (>=1.26.1,<2.0.0)
|
|
12
13
|
Requires-Dist: pandas (>=2.1.1,<3.0.0)
|
|
13
14
|
Requires-Dist: protobuf (>=4.21,<5.0)
|
|
14
15
|
Requires-Dist: psutil (>=5.9.6,<6.0.0)
|
|
@@ -11,6 +11,9 @@ import pyarrow.parquet as pq
|
|
|
11
11
|
from pyspark.sql import SparkSession
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
_DEFAULT_HEAP_SIZE_EXTRA_ROOM = 2 * 512 * 1024 * 1024
|
|
15
|
+
|
|
16
|
+
|
|
14
17
|
def _get_cgroup_memory() -> int:
|
|
15
18
|
max_memory_str = None
|
|
16
19
|
if os.path.isfile("/sys/fs/cgroup/memory.max"):
|
|
@@ -126,12 +129,12 @@ def _get_num_partitions(
|
|
|
126
129
|
|
|
127
130
|
def _determine_optimal_spark_settings(
|
|
128
131
|
files: list[str],
|
|
129
|
-
heap_size_extra_room
|
|
132
|
+
heap_size_extra_room = _DEFAULT_HEAP_SIZE_EXTRA_ROOM
|
|
130
133
|
) -> list[Tuple[str, str]]:
|
|
131
134
|
def get_spark_memory() -> int:
|
|
132
135
|
"""Determine the amount of memory available to spark"""
|
|
133
136
|
cgroup_memory = _get_cgroup_memory()
|
|
134
|
-
spark_memory = cgroup_memory -
|
|
137
|
+
spark_memory = cgroup_memory - heap_size_extra_room
|
|
135
138
|
return spark_memory
|
|
136
139
|
|
|
137
140
|
cpu_count = multiprocessing.cpu_count()
|
|
@@ -154,7 +157,7 @@ def _create_spark_session(
|
|
|
154
157
|
name: str = "local_spark_session",
|
|
155
158
|
parallelism: int = 8,
|
|
156
159
|
heap_size: Optional[int] = None,
|
|
157
|
-
heap_size_extra_room: int =
|
|
160
|
+
heap_size_extra_room: int = _DEFAULT_HEAP_SIZE_EXTRA_ROOM,
|
|
158
161
|
config: list[Tuple[str, Any]] = [],
|
|
159
162
|
java_tmp_dir = "/output",
|
|
160
163
|
) -> SparkSession:
|
|
@@ -231,7 +234,10 @@ def spark_session(temp_dir: str = "/scratch", input_files: list[str] = None, **k
|
|
|
231
234
|
config_dict = dict(config)
|
|
232
235
|
if input_files is not None and input_files:
|
|
233
236
|
optimal_settings = _determine_optimal_spark_settings(
|
|
234
|
-
input_files,
|
|
237
|
+
input_files,
|
|
238
|
+
heap_size_extra_room=kwargs.get(
|
|
239
|
+
"heap_size_extra_room", _DEFAULT_HEAP_SIZE_EXTRA_ROOM
|
|
240
|
+
)
|
|
235
241
|
)
|
|
236
242
|
for key, value in optimal_settings:
|
|
237
243
|
if key not in config_dict:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "decentriq_util"
|
|
3
|
-
version = "0.1.0-
|
|
3
|
+
version = "0.1.0-dev9"
|
|
4
4
|
description = "Utility functions for Python code run in Decentriq workers"
|
|
5
5
|
authors = ["hafenr <robin.hafen@gmail.com>"]
|
|
6
6
|
|
|
@@ -11,6 +11,7 @@ pandas = "^2.1.1"
|
|
|
11
11
|
pyspark = "^3.5.0"
|
|
12
12
|
psutil = "^5.9.6"
|
|
13
13
|
pyarrow = "^14.0.0"
|
|
14
|
+
numpy = "^1.26.1"
|
|
14
15
|
|
|
15
16
|
[tool.poetry.dev-dependencies]
|
|
16
17
|
pytest = "^7.2.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/sql/proto/__init__.py
RENAMED
|
File without changes
|
{decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/sql/proto/compute_sql_pb2.py
RENAMED
|
File without changes
|
{decentriq_util-0.1.0.dev7 → decentriq_util-0.1.0.dev9}/decentriq_util/sql/proto/compute_sql_pb2.pyi
RENAMED
|
File without changes
|