omnata-plugin-runtime 0.10.21a275__py3-none-any.whl → 0.10.22__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.
@@ -50,6 +50,8 @@ from tenacity import Retrying, stop_after_attempt, wait_fixed, retry_if_exceptio
50
50
 
51
51
  from .logging import OmnataPluginLogHandler, logger, tracer
52
52
  from opentelemetry import context
53
+ import math
54
+ import numpy as np
53
55
 
54
56
  from .api import (
55
57
  PluginMessage,
@@ -653,6 +655,21 @@ class HttpRateLimiting:
653
655
  def __exit__(self, exc_type, exc_value, traceback):
654
656
  http.client.HTTPConnection.putrequest = self.original_putrequest # type: ignore
655
657
 
658
+ def wrap_result_value(x):
659
+ # Check for NaN (float or numpy.nan)
660
+ if x is None:
661
+ return None
662
+ if isinstance(x, float) and math.isnan(x):
663
+ return None
664
+ if isinstance(x, str):
665
+ return json.dumps({"value": x})
666
+ try:
667
+ # Try to detect pandas NaN (which is float('nan'))
668
+ if isinstance(x, np.floating) and np.isnan(x):
669
+ return None
670
+ except ImportError:
671
+ return None
672
+ return json.dumps(x)
656
673
 
657
674
  class OutboundSyncRequest(SyncRequest):
658
675
  """
@@ -810,9 +827,7 @@ class OutboundSyncRequest(SyncRequest):
810
827
  if "LOADBATCH_ID" not in results_df:
811
828
  results_df["LOADBATCH_ID"] = self._get_next_loadbatch_id()
812
829
  # we dump the result data to a json string to make uploading to Snowflake less error prone, but only if it's not None
813
- results_df["RESULT"] = results_df["RESULT"].apply(
814
- lambda x: json.dumps(x) if x is not None else None
815
- )
830
+ results_df["RESULT"] = results_df["RESULT"].apply(wrap_result_value)
816
831
  # trim out the columns we don't need to return
817
832
  return results_df[
818
833
  results_df.columns.intersection(
@@ -1911,7 +1926,7 @@ class FixedSizeGenerator:
1911
1926
 
1912
1927
  def __next__(self):
1913
1928
  with self.thread_lock:
1914
- logger.debug(f"initial leftovers: {self.leftovers}")
1929
+ logger.debug(f"FixedSizeGenerator initial leftovers: {len(self.leftovers) if self.leftovers is not None else 0}")
1915
1930
  records_df = self.leftovers
1916
1931
  self.leftovers = None
1917
1932
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.10.21a275
3
+ Version: 0.10.22
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
@@ -4,10 +4,10 @@ omnata_plugin_runtime/configuration.py,sha256=ud3O9R03BbUjGUJDVpGbnADqKw5oLVy65E
4
4
  omnata_plugin_runtime/forms.py,sha256=Lrbr3otsFDrvHWJw7v-slsW4PvEHJ6BG1Yl8oaJfiDo,20529
5
5
  omnata_plugin_runtime/json_schema.py,sha256=rqpJ5wjZiaE6shFB6Rv5CRHIl8xGxntibNjlh4A6Zr0,45902
6
6
  omnata_plugin_runtime/logging.py,sha256=WBuZt8lF9E5oFWM4KYQbE8dDJ_HctJ1pN3BHwU6rcd0,4461
7
- omnata_plugin_runtime/omnata_plugin.py,sha256=hssSfMkdwnZjkeMu7rsOtsHgF8-UzA69QdzMq6KqE6k,133542
7
+ omnata_plugin_runtime/omnata_plugin.py,sha256=1tEm-RPx6i9n7v6xYe7qYKsY6WNYRf7Du9uqYlpsXck,134026
8
8
  omnata_plugin_runtime/plugin_entrypoints.py,sha256=iqGl8_nEEnPGKg3Aem4YLSQ6d5xS3ju5gq8MJbx6sCA,31968
9
9
  omnata_plugin_runtime/rate_limiting.py,sha256=qpr5esU4Ks8hMzuMpSR3gLFdor2ZUXYWCjmsQH_K6lQ,25882
10
- omnata_plugin_runtime-0.10.21a275.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
11
- omnata_plugin_runtime-0.10.21a275.dist-info/METADATA,sha256=TKcGQiX-wmSMadoPZf94lKvH4CtEw8kkcfUeoDCeCPY,2212
12
- omnata_plugin_runtime-0.10.21a275.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
13
- omnata_plugin_runtime-0.10.21a275.dist-info/RECORD,,
10
+ omnata_plugin_runtime-0.10.22.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
11
+ omnata_plugin_runtime-0.10.22.dist-info/METADATA,sha256=eh4KD3913zPx5PFGNBFjlqHEFOCLytUnTd1rg7l87fY,2208
12
+ omnata_plugin_runtime-0.10.22.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
13
+ omnata_plugin_runtime-0.10.22.dist-info/RECORD,,