omnata-plugin-runtime 0.4.0a89__tar.gz → 0.4.0a91__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/PKG-INFO +2 -1
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/pyproject.toml +2 -1
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/src/omnata_plugin_runtime/omnata_plugin.py +13 -46
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/LICENSE +0 -0
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/README.md +0 -0
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/src/omnata_plugin_runtime/__init__.py +0 -0
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/src/omnata_plugin_runtime/api.py +0 -0
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/src/omnata_plugin_runtime/configuration.py +0 -0
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/src/omnata_plugin_runtime/forms.py +0 -0
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/src/omnata_plugin_runtime/logging.py +0 -0
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/src/omnata_plugin_runtime/plugin_entrypoints.py +0 -0
- {omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/src/omnata_plugin_runtime/rate_limiting.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: omnata-plugin-runtime
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.0a91
|
4
4
|
Summary: Classes and common runtime components for building and running Omnata Plugins
|
5
5
|
Author: James Weakley
|
6
6
|
Author-email: james.weakley@omnata.com
|
@@ -25,6 +25,7 @@ Requires-Dist: pytz (<=2023.3.post1)
|
|
25
25
|
Requires-Dist: requests (>=2,<=2.31.0)
|
26
26
|
Requires-Dist: setuptools (>=68.2.2)
|
27
27
|
Requires-Dist: snowflake-snowpark-python (>=1,<2)
|
28
|
+
Requires-Dist: tenacity (>=8,<=8.2.2)
|
28
29
|
Requires-Dist: tomlkit (>=0.11.1)
|
29
30
|
Requires-Dist: urllib3 (<=2.1.0)
|
30
31
|
Requires-Dist: wheel (<=0.41.2)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "omnata-plugin-runtime"
|
3
|
-
version = "0.4.0-
|
3
|
+
version = "0.4.0-a91"
|
4
4
|
description = "Classes and common runtime components for building and running Omnata Plugins"
|
5
5
|
authors = ["James Weakley <james.weakley@omnata.com>"]
|
6
6
|
readme = "README.md"
|
@@ -26,6 +26,7 @@ pytz = "<=2023.3.post1" # latest version available on Snowflake Anaconda
|
|
26
26
|
requests = "^2, <=2.31.0" # latest version available on Snowflake Anaconda
|
27
27
|
setuptools = ">=68.2.2" # 68.2.2 was latest version available on Snowflake Anaconda
|
28
28
|
tomlkit = ">=0.11.1" # 0.11.1 was latest version available on Snowflake Anaconda
|
29
|
+
tenacity = "^8, <=8.2.2" # latest version available on Snowflake Anaconda
|
29
30
|
urllib3 = "<=2.1.0" # latest version available on Snowflake Anaconda
|
30
31
|
wheel = "<=0.41.2" # latest version available on Snowflake Anaconda
|
31
32
|
|
@@ -40,6 +40,7 @@ from snowflake.connector.pandas_tools import write_pandas
|
|
40
40
|
from snowflake.connector.version import VERSION
|
41
41
|
from snowflake.snowpark import Session
|
42
42
|
from snowflake.snowpark.functions import col
|
43
|
+
from tenacity import Retrying, stop_after_attempt, wait_fixed, retry_if_exception_message
|
43
44
|
|
44
45
|
from .logging import OmnataPluginLogHandler
|
45
46
|
|
@@ -690,9 +691,8 @@ class OutboundSyncRequest(SyncRequest):
|
|
690
691
|
logger.info("applying results to table")
|
691
692
|
# use a random table name with a random string to avoid collisions
|
692
693
|
with self._snowflake_query_lock:
|
693
|
-
|
694
|
-
|
695
|
-
try:
|
694
|
+
for attempt in Retrying(stop=stop_after_attempt(30),wait=wait_fixed(2),reraise=True,retry=retry_if_exception_message(match=".*is being committed.*")):
|
695
|
+
with attempt:
|
696
696
|
success, nchunks, nrows, _ = write_pandas(
|
697
697
|
conn=self._session._conn._cursor.connection, # pylint: disable=protected-access
|
698
698
|
df=self._preprocess_results_dataframe(results_df),
|
@@ -707,18 +707,6 @@ class OutboundSyncRequest(SyncRequest):
|
|
707
707
|
logger.info(
|
708
708
|
f"Wrote {nrows} rows and {nchunks} chunks to table {self._full_results_table_name}"
|
709
709
|
)
|
710
|
-
return
|
711
|
-
except Exception as e:
|
712
|
-
if 'is being committed' not in str(e):
|
713
|
-
raise e
|
714
|
-
logger.error(
|
715
|
-
f"Transaction clash writing results to table {self._full_results_table_name}: {e}"
|
716
|
-
)
|
717
|
-
attempts_remaining -= 1
|
718
|
-
time.sleep(5)
|
719
|
-
raise ValueError(
|
720
|
-
f"Failed to write results to table {self._full_results_table_name} after {attempts_remaining} attempts"
|
721
|
-
)
|
722
710
|
|
723
711
|
def __dataframe_wrapper(
|
724
712
|
self, data_frame: pandas.DataFrame, render_jinja: bool = True
|
@@ -963,8 +951,6 @@ class InboundSyncRequest(SyncRequest):
|
|
963
951
|
for stream_name in stream_names:
|
964
952
|
self._apply_results[stream_name] = None
|
965
953
|
self._apply_results = {}
|
966
|
-
# update the inbound stream record counts, so we can see progress
|
967
|
-
self.apply_progress_updates()
|
968
954
|
|
969
955
|
# also take care of uploading delete requests
|
970
956
|
if hasattr(self,'_apply_results_criteria_deletes') and self._apply_results_criteria_deletes is not None:
|
@@ -984,6 +970,12 @@ class InboundSyncRequest(SyncRequest):
|
|
984
970
|
self._apply_criteria_deletes_dataframe(all_dfs)
|
985
971
|
# clear the delete requests
|
986
972
|
self._apply_results_criteria_deletes = {}
|
973
|
+
|
974
|
+
|
975
|
+
# update the inbound stream record counts, so we can see progress
|
976
|
+
# we do this last, because marking a stream as completed will cause the sync engine to process it
|
977
|
+
# so we need to make sure all the results are applied first
|
978
|
+
self.apply_progress_updates()
|
987
979
|
|
988
980
|
def apply_progress_updates(self):
|
989
981
|
"""
|
@@ -1323,9 +1315,8 @@ class InboundSyncRequest(SyncRequest):
|
|
1323
1315
|
"""
|
1324
1316
|
if len(results_df) > 0:
|
1325
1317
|
with self._snowflake_query_lock:
|
1326
|
-
|
1327
|
-
|
1328
|
-
try:
|
1318
|
+
for attempt in Retrying(stop=stop_after_attempt(30),wait=wait_fixed(2),reraise=True,retry=retry_if_exception_message(match=".*is being committed.*")):
|
1319
|
+
with attempt:
|
1329
1320
|
logger.info(
|
1330
1321
|
f"Applying {len(results_df)} results to {self._full_results_table_name}"
|
1331
1322
|
)
|
@@ -1354,18 +1345,6 @@ class InboundSyncRequest(SyncRequest):
|
|
1354
1345
|
# )
|
1355
1346
|
for stream_name in stream_names:
|
1356
1347
|
self._results_exist[stream_name] = True
|
1357
|
-
return
|
1358
|
-
except Exception as e:
|
1359
|
-
if 'is being committed' not in str(e):
|
1360
|
-
raise e
|
1361
|
-
logger.error(
|
1362
|
-
f"Transaction clash writing results to table {self._full_results_table_name}: {e}"
|
1363
|
-
)
|
1364
|
-
attempts_remaining -= 1
|
1365
|
-
time.sleep(5)
|
1366
|
-
raise ValueError(
|
1367
|
-
f"Failed to write results to table {self._full_results_table_name} after {attempts_remaining} attempts"
|
1368
|
-
)
|
1369
1348
|
else:
|
1370
1349
|
logger.info("Results dataframe is empty, not applying")
|
1371
1350
|
|
@@ -1383,9 +1362,8 @@ class InboundSyncRequest(SyncRequest):
|
|
1383
1362
|
"""
|
1384
1363
|
if len(results_df) > 0:
|
1385
1364
|
with self._snowflake_query_lock:
|
1386
|
-
|
1387
|
-
|
1388
|
-
try:
|
1365
|
+
for attempt in Retrying(stop=stop_after_attempt(30),wait=wait_fixed(2),reraise=True,retry=retry_if_exception_message(match=".*is being committed.*")):
|
1366
|
+
with attempt:
|
1389
1367
|
logger.info(
|
1390
1368
|
f"Applying {len(results_df)} criteria deletes to {self._criteria_deletes_table_name}"
|
1391
1369
|
)
|
@@ -1405,17 +1383,6 @@ class InboundSyncRequest(SyncRequest):
|
|
1405
1383
|
f"Wrote {nrows} rows and {nchunks} chunks to table {self._criteria_deletes_table_name}"
|
1406
1384
|
)
|
1407
1385
|
return
|
1408
|
-
except Exception as e:
|
1409
|
-
if 'is being committed' not in str(e):
|
1410
|
-
raise e
|
1411
|
-
logger.error(
|
1412
|
-
f"Transaction clash writing results to table {self._full_results_table_name}: {e}"
|
1413
|
-
)
|
1414
|
-
attempts_remaining -= 1
|
1415
|
-
time.sleep(5)
|
1416
|
-
raise ValueError(
|
1417
|
-
f"Failed to write results to table {self._full_results_table_name} after {attempts_remaining} attempts"
|
1418
|
-
)
|
1419
1386
|
else:
|
1420
1387
|
logger.info("Results dataframe is empty, not applying")
|
1421
1388
|
|
File without changes
|
File without changes
|
File without changes
|
{omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/src/omnata_plugin_runtime/api.py
RENAMED
File without changes
|
File without changes
|
{omnata_plugin_runtime-0.4.0a89 → omnata_plugin_runtime-0.4.0a91}/src/omnata_plugin_runtime/forms.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|