digitalhub 0.13.1__py3-none-any.whl → 0.13.2__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.
Potentially problematic release.
This version of digitalhub might be problematic. Click here for more details.
- digitalhub/context/context.py +12 -0
- digitalhub/stores/credentials/configurator.py +2 -1
- digitalhub/stores/data/s3/configurator.py +2 -2
- digitalhub/stores/readers/data/pandas/reader.py +9 -3
- {digitalhub-0.13.1.dist-info → digitalhub-0.13.2.dist-info}/METADATA +1 -1
- {digitalhub-0.13.1.dist-info → digitalhub-0.13.2.dist-info}/RECORD +9 -9
- {digitalhub-0.13.1.dist-info → digitalhub-0.13.2.dist-info}/WHEEL +0 -0
- {digitalhub-0.13.1.dist-info → digitalhub-0.13.2.dist-info}/licenses/AUTHORS +0 -0
- {digitalhub-0.13.1.dist-info → digitalhub-0.13.2.dist-info}/licenses/LICENSE +0 -0
digitalhub/context/context.py
CHANGED
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
|
+
import os
|
|
7
8
|
import typing
|
|
8
9
|
from pathlib import Path
|
|
9
10
|
|
|
11
|
+
from digitalhub.runtimes.enums import RuntimeEnvVar
|
|
12
|
+
|
|
10
13
|
if typing.TYPE_CHECKING:
|
|
11
14
|
from digitalhub.entities.project._base.entity import Project
|
|
12
15
|
from digitalhub.stores.client._base.client import Client
|
|
@@ -47,6 +50,15 @@ class Context:
|
|
|
47
50
|
|
|
48
51
|
self.is_running: bool = False
|
|
49
52
|
self._run_ctx: str | None = None
|
|
53
|
+
self._search_run_ctx()
|
|
54
|
+
|
|
55
|
+
def _search_run_ctx(self) -> None:
|
|
56
|
+
"""
|
|
57
|
+
Search for an existing run id in env.
|
|
58
|
+
"""
|
|
59
|
+
run_id = os.getenv(RuntimeEnvVar.RUN_ID.value)
|
|
60
|
+
if run_id is not None:
|
|
61
|
+
self.set_run(run_id)
|
|
50
62
|
|
|
51
63
|
def set_run(self, run_ctx: str) -> None:
|
|
52
64
|
"""
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
|
-
from datetime import datetime, timezone
|
|
7
|
+
from datetime import datetime, timedelta, timezone
|
|
8
8
|
|
|
9
9
|
from botocore.config import Config
|
|
10
10
|
|
|
@@ -111,5 +111,5 @@ class S3StoreConfigurator(Configurator):
|
|
|
111
111
|
return False
|
|
112
112
|
dt = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%SZ")
|
|
113
113
|
dt = dt.replace(tzinfo=timezone.utc)
|
|
114
|
-
now = datetime.now(timezone.utc) +
|
|
114
|
+
now = datetime.now(timezone.utc) + timedelta(seconds=120)
|
|
115
115
|
return dt < now
|
|
@@ -133,7 +133,9 @@ class DataframeReaderPandas(DataframeReader):
|
|
|
133
133
|
-------
|
|
134
134
|
None
|
|
135
135
|
"""
|
|
136
|
-
|
|
136
|
+
if "index" not in kwargs:
|
|
137
|
+
kwargs["index"] = False
|
|
138
|
+
df.to_csv(dst, **kwargs)
|
|
137
139
|
|
|
138
140
|
@staticmethod
|
|
139
141
|
def write_parquet(df: pd.DataFrame, dst: str | BytesIO, **kwargs) -> None:
|
|
@@ -153,7 +155,9 @@ class DataframeReaderPandas(DataframeReader):
|
|
|
153
155
|
-------
|
|
154
156
|
None
|
|
155
157
|
"""
|
|
156
|
-
|
|
158
|
+
if "index" not in kwargs:
|
|
159
|
+
kwargs["index"] = False
|
|
160
|
+
df.to_parquet(dst, **kwargs)
|
|
157
161
|
|
|
158
162
|
@staticmethod
|
|
159
163
|
def write_table(df: pd.DataFrame, table: str, engine: Any, schema: str | None = None, **kwargs) -> None:
|
|
@@ -177,7 +181,9 @@ class DataframeReaderPandas(DataframeReader):
|
|
|
177
181
|
-------
|
|
178
182
|
None
|
|
179
183
|
"""
|
|
180
|
-
|
|
184
|
+
if "index" not in kwargs:
|
|
185
|
+
kwargs["index"] = False
|
|
186
|
+
df.to_sql(table, engine, schema=schema, **kwargs)
|
|
181
187
|
|
|
182
188
|
##############################
|
|
183
189
|
# Utils
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: digitalhub
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.2
|
|
4
4
|
Summary: Python SDK for Digitalhub
|
|
5
5
|
Project-URL: Homepage, https://github.com/scc-digitalhub/digitalhub-sdk
|
|
6
6
|
Author-email: Fondazione Bruno Kessler <digitalhub@fbk.eu>, Matteo Martini <mmartini@fbk.eu>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
digitalhub/__init__.py,sha256=JrwZhABki1rBFSP3uHBJOckWQiF213_UXuJRoX7QFHA,2572
|
|
2
2
|
digitalhub/context/api.py,sha256=eIVsYhneu8bEQiUV15sUNlv5WlZu6zV7Dvidvg_0FfA,1500
|
|
3
3
|
digitalhub/context/builder.py,sha256=NM4xcD2n4jXwdTS2hl3MAobf-BVUQH-9LB6U3J_F3pM,2826
|
|
4
|
-
digitalhub/context/context.py,sha256=
|
|
4
|
+
digitalhub/context/context.py,sha256=IXgrLtI6nKp0S9XclqiyiMcsbkTVveNVkkVnURBFvFc,2569
|
|
5
5
|
digitalhub/entities/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
|
|
6
6
|
digitalhub/entities/builders.py,sha256=I-RVAFNgnZGmx7Dyz8_n7gfsG-BVgbgfraJal5NWipE,2054
|
|
7
7
|
digitalhub/entities/_base/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
|
|
@@ -209,7 +209,7 @@ digitalhub/stores/client/local/key_builder.py,sha256=ijISHvPcMyx591gHlSP1IZdiRrF
|
|
|
209
209
|
digitalhub/stores/client/local/params_builder.py,sha256=_hR4bwn0bpGc74iKb3PM3WUJ6s3GAgsc1zcXoWjy560,3589
|
|
210
210
|
digitalhub/stores/credentials/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
|
|
211
211
|
digitalhub/stores/credentials/api.py,sha256=mwClY8tCG62eAhbwrmK-kzYQzEJ5ZmCW52WmYsQ-004,738
|
|
212
|
-
digitalhub/stores/credentials/configurator.py,sha256=
|
|
212
|
+
digitalhub/stores/credentials/configurator.py,sha256=RbvkmHyf_vhLC3WamNEjC6V6NtqfSXQMuONEj4pyGwk,5505
|
|
213
213
|
digitalhub/stores/credentials/enums.py,sha256=uRJ6af0ujk3Ki4DXM9rFqBROyhlbf4EYNWml_CSdJL8,1665
|
|
214
214
|
digitalhub/stores/credentials/handler.py,sha256=CHrs3vmTkCQrtTenvVQ9QlRIntyrOOqZN-9BBJFG6JI,4355
|
|
215
215
|
digitalhub/stores/credentials/ini_module.py,sha256=ouHCGuAA_odbpKJKuwfCQMt40jRCCh9wLID_HucKo5o,3750
|
|
@@ -225,7 +225,7 @@ digitalhub/stores/data/local/store.py,sha256=_XuIp3HpEa7hxxMfQhK05EscPA_RBiQyb61
|
|
|
225
225
|
digitalhub/stores/data/remote/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
|
|
226
226
|
digitalhub/stores/data/remote/store.py,sha256=DTrBW62zc1ix7UbLnY6YeqN0_8kGeUH_h9k7Br2HY3k,6130
|
|
227
227
|
digitalhub/stores/data/s3/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
|
|
228
|
-
digitalhub/stores/data/s3/configurator.py,sha256=
|
|
228
|
+
digitalhub/stores/data/s3/configurator.py,sha256=BDgvjlD3ES-Ri01ncq87cQtxvOa4u3_MYR81yZMZ35A,3703
|
|
229
229
|
digitalhub/stores/data/s3/store.py,sha256=hwcvTkKaBWcCc7fDGuoddgT2v5b8Jr5LtTojja9tdZ8,19583
|
|
230
230
|
digitalhub/stores/data/s3/utils.py,sha256=jCzXp9X2tnF3iHRSmvfnp1e5ahbZkMaMMC35FfysFZw,1894
|
|
231
231
|
digitalhub/stores/data/sql/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
|
|
@@ -240,7 +240,7 @@ digitalhub/stores/readers/data/_base/builder.py,sha256=N_e5qlGrxyqnyr8F7SvbSLrgt
|
|
|
240
240
|
digitalhub/stores/readers/data/_base/reader.py,sha256=q6s37uI_2J1cJlpvRzwr2Az8aD9lDsKvzbi82CUO3PU,1862
|
|
241
241
|
digitalhub/stores/readers/data/pandas/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
|
|
242
242
|
digitalhub/stores/readers/data/pandas/builder.py,sha256=ucnW7ReZgQ9XmGifYMkaDxpBVc_0XMMazOyPnUlY4os,804
|
|
243
|
-
digitalhub/stores/readers/data/pandas/reader.py,sha256=
|
|
243
|
+
digitalhub/stores/readers/data/pandas/reader.py,sha256=LLbp_tWSmyQizM8ULpiax3rl7bIfSs5SwVc13afNS5E,8260
|
|
244
244
|
digitalhub/stores/readers/query/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
|
|
245
245
|
digitalhub/utils/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
|
|
246
246
|
digitalhub/utils/enums.py,sha256=FvvBBkryy2-Ji0MhBMeJC6oLnd_ba0b0y1uCcWT-mvU,377
|
|
@@ -252,8 +252,8 @@ digitalhub/utils/io_utils.py,sha256=p2K9VFJGzl3PmXc7GfXKZkPyg5hImduvXlfYVpnsMck,
|
|
|
252
252
|
digitalhub/utils/logger.py,sha256=hH3gGE35L8jRxrg8EPXGZZAK1OA5-CvWnayuBZzteBM,545
|
|
253
253
|
digitalhub/utils/types.py,sha256=orCxY43zXMJfKZsOj6FUR85u9wRBPJ0wdkzrBHTnVW8,217
|
|
254
254
|
digitalhub/utils/uri_utils.py,sha256=Go787CxAOo2MMjFIEt8XssomtyV8vTdIrpyjSQK3gAM,4408
|
|
255
|
-
digitalhub-0.13.
|
|
256
|
-
digitalhub-0.13.
|
|
257
|
-
digitalhub-0.13.
|
|
258
|
-
digitalhub-0.13.
|
|
259
|
-
digitalhub-0.13.
|
|
255
|
+
digitalhub-0.13.2.dist-info/METADATA,sha256=eX13WzRWm-g-BL4xyAJjrF3a8ufDVEKBItHOHJWpEsM,18026
|
|
256
|
+
digitalhub-0.13.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
257
|
+
digitalhub-0.13.2.dist-info/licenses/AUTHORS,sha256=iDleK_2EAMmh0o8Te_E9mdXQCP4rBfFr9dW9d0-pCno,301
|
|
258
|
+
digitalhub-0.13.2.dist-info/licenses/LICENSE,sha256=z3xQCHfGmTnigfoUe3uidW_GUSVeFBdos30w9VNTRec,11361
|
|
259
|
+
digitalhub-0.13.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|