omnata-plugin-runtime 0.4.3a98__py3-none-any.whl → 0.4.4a99__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.
@@ -427,7 +427,7 @@ class SyncRequest(ABC):
427
427
  """
428
428
  return not self._thread_cancellation_token.wait(seconds)
429
429
 
430
- def update_activity(self, current_activity: str):
430
+ def update_activity(self, current_activity: str) -> Dict:
431
431
  """
432
432
  Provides an update to the user on what's happening inside the sync run. It should
433
433
  be used before commencing a potential long-running phase, like polling and waiting or
@@ -436,11 +436,11 @@ class SyncRequest(ABC):
436
436
  Avoid lengthy diagnostic messages, anything like this should be logged the normal way.
437
437
  """
438
438
  logger.info(f"Activity update: {current_activity}")
439
- self._plugin_message(
439
+ return self._plugin_message(
440
440
  PluginMessageCurrentActivity(current_activity=current_activity)
441
441
  )
442
442
 
443
- def _plugin_message(self, message: PluginMessage) -> Dict:
443
+ def _plugin_message(self, message: PluginMessage, ignore_errors:bool = True) -> Dict:
444
444
  """
445
445
  Sends a message back to the plugin. This is used to send back the results of a sync run.
446
446
  """
@@ -456,9 +456,13 @@ class SyncRequest(ABC):
456
456
  ).collect()
457
457
  )
458
458
  except Exception as e:
459
- logger.error(
460
- f"Error sending plugin message: {e}", exc_info=True, stack_info=True
461
- )
459
+ if ignore_errors:
460
+ logger.error(
461
+ f"Error sending plugin message: {e}", exc_info=True, stack_info=True
462
+ )
463
+ return None
464
+ else:
465
+ raise e
462
466
 
463
467
 
464
468
  class HttpRateLimiting:
@@ -978,7 +982,7 @@ class InboundSyncRequest(SyncRequest):
978
982
  # so we need to make sure all the results are applied first
979
983
  self.apply_progress_updates()
980
984
 
981
- def apply_progress_updates(self):
985
+ def apply_progress_updates(self, ignore_errors:bool = True):
982
986
  """
983
987
  Sends a message to the plugin with the current progress of the sync run, if it has changed since last time.
984
988
  """
@@ -989,10 +993,14 @@ class InboundSyncRequest(SyncRequest):
989
993
  total_records_estimate=self._total_records_estimate
990
994
  )
991
995
  if self._last_stream_progress_update is None or new_progress_update != self._last_stream_progress_update:
992
- self._plugin_message(
993
- message=new_progress_update
996
+ result = self._plugin_message(
997
+ message=new_progress_update,
998
+ ignore_errors=ignore_errors
994
999
  )
1000
+ if result is None:
1001
+ return False
995
1002
  self._last_stream_progress_update = new_progress_update
1003
+ return True
996
1004
 
997
1005
  def apply_cancellation(self):
998
1006
  """
@@ -221,7 +221,8 @@ class PluginEntrypoint:
221
221
  logger.info("Calling apply_rate_limit_state")
222
222
  inbound_sync_request.apply_rate_limit_state()
223
223
  logger.info("Calling apply_progress_updates")
224
- inbound_sync_request.apply_progress_updates()
224
+ # we can't ignore errors here, because the sync engine needs to get the progress updates before we return
225
+ inbound_sync_request.apply_progress_updates(ignore_errors=False)
225
226
  if inbound_sync_request.deadline_reached:
226
227
  # if we actually hit the deadline, this is flagged by the cancellation checking worker and the cancellation
227
228
  # token is set. We throw it here as an error since that's currently how it flows back to the engine with a DELAYED state
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.4.3a98
3
+ Version: 0.4.4a99
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
@@ -3,10 +3,10 @@ omnata_plugin_runtime/api.py,sha256=W79CsAcl127Dzy-XVS9CzvzsbS3IigVH4QAhFFDkaXg,
3
3
  omnata_plugin_runtime/configuration.py,sha256=7cMekoY8CeZAJHpASU6tCMidF55Hzfr7CD74jtebqIY,35742
4
4
  omnata_plugin_runtime/forms.py,sha256=pw_aKVsXSz47EP8PFBI3VDwdSN5IjvZxp8JTjO1V130,18421
5
5
  omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
6
- omnata_plugin_runtime/omnata_plugin.py,sha256=mCZ0904ONvYx6VFsoTHI45gA4dvUv30fYBO9DWIYDa0,107734
7
- omnata_plugin_runtime/plugin_entrypoints.py,sha256=wco1QqubxxE-cMYQiu8D3pUZss3QeiAlrF2UFg5m0GM,28404
6
+ omnata_plugin_runtime/omnata_plugin.py,sha256=UJZNTcG6s5APZ7EIOYc5N4bFiyFEq3ekbSP6EK7tCBY,108065
7
+ omnata_plugin_runtime/plugin_entrypoints.py,sha256=GN3JuVFi74TTXICiK2XdWpT7ohJYuxh4R9v_cGdm59A,28549
8
8
  omnata_plugin_runtime/rate_limiting.py,sha256=29Hjsr0i1rE8jERVdIFGINfQfp_kI3PDft-IM_ZxvCA,21509
9
- omnata_plugin_runtime-0.4.3a98.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
- omnata_plugin_runtime-0.4.3a98.dist-info/METADATA,sha256=rpNCKscoxP2dRXmV4qwct3hY5d97z3_cnnkZpjugKSA,1641
11
- omnata_plugin_runtime-0.4.3a98.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
- omnata_plugin_runtime-0.4.3a98.dist-info/RECORD,,
9
+ omnata_plugin_runtime-0.4.4a99.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
+ omnata_plugin_runtime-0.4.4a99.dist-info/METADATA,sha256=k8fKkKrk4-CEMglO_a1oI39azjoE76N8E8Cujpy8TQM,1641
11
+ omnata_plugin_runtime-0.4.4a99.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
+ omnata_plugin_runtime-0.4.4a99.dist-info/RECORD,,