omnata-plugin-runtime 0.11.7__py3-none-any.whl → 0.11.7a324__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.
- omnata_plugin_runtime/omnata_plugin.py +19 -30
- {omnata_plugin_runtime-0.11.7.dist-info → omnata_plugin_runtime-0.11.7a324.dist-info}/METADATA +1 -1
- {omnata_plugin_runtime-0.11.7.dist-info → omnata_plugin_runtime-0.11.7a324.dist-info}/RECORD +5 -5
- {omnata_plugin_runtime-0.11.7.dist-info → omnata_plugin_runtime-0.11.7a324.dist-info}/WHEEL +0 -0
- {omnata_plugin_runtime-0.11.7.dist-info → omnata_plugin_runtime-0.11.7a324.dist-info}/licenses/LICENSE +0 -0
|
@@ -49,11 +49,6 @@ from snowflake.snowpark.functions import col
|
|
|
49
49
|
from tenacity import Retrying, stop_after_attempt, wait_fixed, retry_if_exception_message
|
|
50
50
|
|
|
51
51
|
from .logging import OmnataPluginLogHandler, logger, tracer, meter
|
|
52
|
-
stream_duration_gauge = meter.create_gauge(
|
|
53
|
-
name="omnata.sync_run.stream_duration",
|
|
54
|
-
description="The duration of stream processing",
|
|
55
|
-
unit="s",
|
|
56
|
-
)
|
|
57
52
|
from opentelemetry import context
|
|
58
53
|
import math
|
|
59
54
|
import numpy as np
|
|
@@ -1102,8 +1097,6 @@ class InboundSyncRequest(SyncRequest):
|
|
|
1102
1097
|
self.state_register_table_name = results_table.get_fully_qualified_state_register_table_name()
|
|
1103
1098
|
# this is keyed on stream name, each containing a list of dataframes and state updates mixed
|
|
1104
1099
|
self._apply_results: Dict[str, List[pandas.DataFrame | Dict]] = {}
|
|
1105
|
-
# track the start times of each stream, so we can calculate durations. The int is a epoch (time.time()) value
|
|
1106
|
-
self._stream_start_times: Dict[str, int] = {}
|
|
1107
1100
|
|
|
1108
1101
|
def apply_results_queue(self):
|
|
1109
1102
|
"""
|
|
@@ -1357,13 +1350,6 @@ class InboundSyncRequest(SyncRequest):
|
|
|
1357
1350
|
if sum([x.memory_usage(index=True).sum() for x in all_dfs if isinstance(x, pandas.DataFrame)]) > 200000000:
|
|
1358
1351
|
logger.debug(f"Applying criteria deletes queue immediately due to combined dataframe size")
|
|
1359
1352
|
self.apply_results_queue()
|
|
1360
|
-
|
|
1361
|
-
def mark_stream_started(self, stream_name: str):
|
|
1362
|
-
"""
|
|
1363
|
-
Marks a stream as started, this is called automatically per stream when using @managed_inbound_processing.
|
|
1364
|
-
"""
|
|
1365
|
-
logger.debug(f"Marking stream {stream_name} as started locally")
|
|
1366
|
-
self._stream_start_times[stream_name] = time.time()
|
|
1367
1353
|
|
|
1368
1354
|
def mark_stream_complete(self, stream_name: str):
|
|
1369
1355
|
"""
|
|
@@ -1371,20 +1357,6 @@ class InboundSyncRequest(SyncRequest):
|
|
|
1371
1357
|
If @managed_inbound_processing is not used, call this whenever a stream has finished recieving records.
|
|
1372
1358
|
"""
|
|
1373
1359
|
logger.debug(f"Marking stream {stream_name} as completed locally")
|
|
1374
|
-
if stream_name in self._stream_start_times:
|
|
1375
|
-
start_time = self._stream_start_times[stream_name]
|
|
1376
|
-
duration = time.time() - start_time
|
|
1377
|
-
stream_duration_gauge.set(
|
|
1378
|
-
amount=duration,
|
|
1379
|
-
attributes={
|
|
1380
|
-
"stream_name": stream_name,
|
|
1381
|
-
"sync_run_id": str(self._run_id),
|
|
1382
|
-
"sync_id": str(self._sync_id),
|
|
1383
|
-
"branch_name": str(self._branch_name) if self._branch_name is not None else 'main',
|
|
1384
|
-
"sync_direction": "inbound",
|
|
1385
|
-
"plugin_id": self.plugin_instance.get_manifest().plugin_id,
|
|
1386
|
-
},
|
|
1387
|
-
)
|
|
1388
1360
|
with self._apply_results_lock:
|
|
1389
1361
|
self._completed_streams.append(stream_name)
|
|
1390
1362
|
# dedup just in case it's called twice
|
|
@@ -2361,8 +2333,12 @@ def __managed_inbound_processing_worker(
|
|
|
2361
2333
|
sync_request: InboundSyncRequest = cast(
|
|
2362
2334
|
InboundSyncRequest, plugin_class_obj._sync_request
|
|
2363
2335
|
) # pylint: disable=protected-access
|
|
2364
|
-
|
|
2365
|
-
|
|
2336
|
+
stream_duration_gauge = meter.create_gauge(
|
|
2337
|
+
name="omnata.sync_run.stream_duration",
|
|
2338
|
+
description="The duration of stream processing",
|
|
2339
|
+
unit="s",
|
|
2340
|
+
)
|
|
2341
|
+
start_time = time.time()
|
|
2366
2342
|
# restore the first argument, was originally the dataframe/generator but now it's the appropriately sized dataframe
|
|
2367
2343
|
try:
|
|
2368
2344
|
with tracer.start_as_current_span("managed_inbound_processing") as managed_inbound_processing_span:
|
|
@@ -2394,6 +2370,19 @@ def __managed_inbound_processing_worker(
|
|
|
2394
2370
|
omnata_plugin_logger.error(f"{type(e).__name__} syncing stream {stream.stream_name}",
|
|
2395
2371
|
exc_info=True,
|
|
2396
2372
|
extra={'stream_name':stream.stream_name})
|
|
2373
|
+
finally:
|
|
2374
|
+
duration = time.time() - start_time
|
|
2375
|
+
stream_duration_gauge.set(
|
|
2376
|
+
amount=duration,
|
|
2377
|
+
attributes={
|
|
2378
|
+
"stream_name": stream.stream_name,
|
|
2379
|
+
"sync_run_id": str(sync_request._run_id),
|
|
2380
|
+
"sync_id": str(sync_request._sync_id),
|
|
2381
|
+
"branch_name": str(sync_request._branch_name) if sync_request._branch_name is not None else 'main',
|
|
2382
|
+
"sync_direction": "inbound",
|
|
2383
|
+
"plugin_id": plugin_class_obj.get_manifest().plugin_id,
|
|
2384
|
+
},
|
|
2385
|
+
)
|
|
2397
2386
|
except queue.Empty:
|
|
2398
2387
|
logger.debug("streams queue is empty")
|
|
2399
2388
|
return
|
{omnata_plugin_runtime-0.11.7.dist-info → omnata_plugin_runtime-0.11.7a324.dist-info}/RECORD
RENAMED
|
@@ -4,10 +4,10 @@ omnata_plugin_runtime/configuration.py,sha256=SffokJfgvy6V3kUsoEjXcK3GdNgHo6U3mg
|
|
|
4
4
|
omnata_plugin_runtime/forms.py,sha256=Lrbr3otsFDrvHWJw7v-slsW4PvEHJ6BG1Yl8oaJfiDo,20529
|
|
5
5
|
omnata_plugin_runtime/json_schema.py,sha256=ZfHMG-XSJBE9Smt33Y6GPpl5skF7pB1TRCf9AvWuw-Y,59705
|
|
6
6
|
omnata_plugin_runtime/logging.py,sha256=qUtRA9syQNnjfJZHA2W18K282voXX6vHwrBIPOBo1n8,4521
|
|
7
|
-
omnata_plugin_runtime/omnata_plugin.py,sha256=
|
|
7
|
+
omnata_plugin_runtime/omnata_plugin.py,sha256=3D0VkrEXoCaxuQarf7p_YX35AfwS-lH1ZvqfEE-iOQk,143130
|
|
8
8
|
omnata_plugin_runtime/plugin_entrypoints.py,sha256=_1pDLov3iQorGmfcae8Sw2bVjxw1vYeowBaKKNzRclQ,32629
|
|
9
9
|
omnata_plugin_runtime/rate_limiting.py,sha256=qpr5esU4Ks8hMzuMpSR3gLFdor2ZUXYWCjmsQH_K6lQ,25882
|
|
10
|
-
omnata_plugin_runtime-0.11.
|
|
11
|
-
omnata_plugin_runtime-0.11.
|
|
12
|
-
omnata_plugin_runtime-0.11.
|
|
13
|
-
omnata_plugin_runtime-0.11.
|
|
10
|
+
omnata_plugin_runtime-0.11.7a324.dist-info/METADATA,sha256=sYs4i8JrMvlgTi0gudwjNDwcDPYUMa9jwB5U4GmLSVs,2183
|
|
11
|
+
omnata_plugin_runtime-0.11.7a324.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
12
|
+
omnata_plugin_runtime-0.11.7a324.dist-info/licenses/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
|
|
13
|
+
omnata_plugin_runtime-0.11.7a324.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|