omnata-plugin-runtime 0.3.0__py3-none-any.whl → 0.3.1__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.
@@ -169,6 +169,7 @@ class SyncRequest(ABC):
169
169
  :return: nothing
170
170
  """
171
171
  logger.info(f"Initiating SyncRequest for sync run {run_id}, run deadline: {run_deadline}")
172
+ self.deadline_reached:bool = False
172
173
  self._run_deadline = run_deadline
173
174
  self.plugin_instance = plugin_instance
174
175
  self._source_app_name = source_app_name
@@ -273,6 +274,7 @@ class SyncRequest(ABC):
273
274
  logger.info("cancel checking worker checking for cancellation")
274
275
  if (datetime.datetime.now(datetime.timezone.utc) > self._run_deadline): # pylint: disable=protected-access
275
276
  # if we've reached the deadline for the run, end it
277
+ self.deadline_reached = True
276
278
  self.apply_deadline_reached() # pylint: disable=protected-access
277
279
  return
278
280
 
@@ -30,6 +30,7 @@ from .omnata_plugin import (
30
30
  InboundSyncRequest,
31
31
  OmnataPlugin,
32
32
  OutboundSyncRequest,
33
+ DeadlineReachedException,
33
34
  )
34
35
  from .rate_limiting import ApiLimits, RateLimitState
35
36
 
@@ -147,6 +148,10 @@ class PluginEntrypoint:
147
148
  self._plugin_instance.sync_outbound(parameters, outbound_sync_request)
148
149
  outbound_sync_request.apply_results_queue()
149
150
  outbound_sync_request.apply_rate_limit_state()
151
+ if outbound_sync_request.deadline_reached:
152
+ # if we actually hit the deadline, this is flagged by the cancellation checking worker and the cancellation
153
+ # 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
154
+ raise DeadlineReachedException()
150
155
  finally:
151
156
  try:
152
157
  # cancel the thread so we don't leave anything hanging around and cop a nasty error
@@ -198,6 +203,10 @@ class PluginEntrypoint:
198
203
  logger.info("Calling apply_results_queue")
199
204
  inbound_sync_request.apply_results_queue()
200
205
  inbound_sync_request.apply_rate_limit_state()
206
+ if inbound_sync_request.deadline_reached:
207
+ # if we actually hit the deadline, this is flagged by the cancellation checking worker and the cancellation
208
+ # 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
209
+ raise DeadlineReachedException()
201
210
  finally:
202
211
  # cancel the thread so we don't leave anything hanging around and cop a nasty error
203
212
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.3.0
3
+ Version: 0.3.1
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=_N5ok5LN7GDO4J9n3yduXp3tpjmhpySY__U2baiygrs,
3
3
  omnata_plugin_runtime/configuration.py,sha256=at29ExowF_T4_2U9gY0BF4IVdwC-vDytmNRHL7UCWh8,34742
4
4
  omnata_plugin_runtime/forms.py,sha256=30CJB24TqfLYNnkplZdUbeqA-P9rUIBujVKXw_S-wKY,18371
5
5
  omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
6
- omnata_plugin_runtime/omnata_plugin.py,sha256=Gfy77vmLY-Y-rrmB9ytmh-KFfAEFIXyUU_4_K1a1EYM,86484
7
- omnata_plugin_runtime/plugin_entrypoints.py,sha256=WWgWFuZ24w2J2a6swW-F8NTYZ7FdN8mBDjxtIMh9sZ4,25859
6
+ omnata_plugin_runtime/omnata_plugin.py,sha256=yqzFoAHbJ7zumfG27o9wVXTum0v1sYcYDxHPdYsjYLU,86572
7
+ omnata_plugin_runtime/plugin_entrypoints.py,sha256=4qpTzUrfL_gGMDYhGnEwHgCRUJII1yU2AB4WgCko_8Q,26650
8
8
  omnata_plugin_runtime/rate_limiting.py,sha256=se6MftQI5NrVHaLb1hByPCgAESPQhkAgIG7KIU1clDU,16562
9
- omnata_plugin_runtime-0.3.0.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
- omnata_plugin_runtime-0.3.0.dist-info/METADATA,sha256=l-g9zG1LWcrYQ3tI5JoxyLIDW1_xwDtqW3qDgv7ELHo,1604
11
- omnata_plugin_runtime-0.3.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
12
- omnata_plugin_runtime-0.3.0.dist-info/RECORD,,
9
+ omnata_plugin_runtime-0.3.1.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
+ omnata_plugin_runtime-0.3.1.dist-info/METADATA,sha256=4n8-0Crp_6hG-Pwi36DbS0Vfw5JLVOdqZGjmrb_yeSc,1604
11
+ omnata_plugin_runtime-0.3.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
12
+ omnata_plugin_runtime-0.3.1.dist-info/RECORD,,