omnata-plugin-runtime 0.2.99__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.
@@ -745,7 +745,7 @@ class SyncScheduleSnowflakeTask(SubscriptableBaseModel):
745
745
 
746
746
  """
747
747
 
748
- mode: Literal["snowflake_task"]
748
+ mode: Literal["snowflake_task"] = "snowflake_task"
749
749
  sync_frequency: str
750
750
  sync_frequency_name: Literal["1 min", "5 mins", "15 mins", "Hourly", "Daily","Custom"]
751
751
  warehouse: str = None
@@ -770,7 +770,7 @@ class SyncScheduleDbt(SubscriptableBaseModel):
770
770
  is_dbt_cloud (bool): If true, dbt cloud is in use
771
771
  """
772
772
 
773
- mode: Literal["dbt"]
773
+ mode: Literal["dbt"] = "dbt"
774
774
  dbt_prod_target_name: str = "prod"
775
775
  task_warehouse_dbt_defined: bool = True
776
776
  warehouse: str
@@ -792,7 +792,7 @@ class SyncScheduleDependant(SubscriptableBaseModel):
792
792
  selected_sync (int): The sync ID of the sync to depend on
793
793
  """
794
794
 
795
- mode: Literal["dependent"]
795
+ mode: Literal["dependent"] = "dependent"
796
796
  run_when: Literal[
797
797
  "after_parent_completes", "at_same_time_as"
798
798
  ] = "after_parent_completes"
@@ -810,7 +810,7 @@ class SyncScheduleManual(SubscriptableBaseModel):
810
810
  time_limit_mins (int): The maximum time the sync can run for before being cancelled
811
811
  """
812
812
 
813
- mode: Literal["manual"]
813
+ mode: Literal["manual"] = "manual"
814
814
  warehouse: str
815
815
  time_limit_mins: int = 60 * 4
816
816
 
@@ -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.2.99
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
@@ -0,0 +1,12 @@
1
+ omnata_plugin_runtime/__init__.py,sha256=w63LVME5nY-hQ4BBzfacy9kvTunwqHGs8iiSPGAX2ns,1214
2
+ omnata_plugin_runtime/api.py,sha256=_N5ok5LN7GDO4J9n3yduXp3tpjmhpySY__U2baiygrs,6217
3
+ omnata_plugin_runtime/configuration.py,sha256=at29ExowF_T4_2U9gY0BF4IVdwC-vDytmNRHL7UCWh8,34742
4
+ omnata_plugin_runtime/forms.py,sha256=30CJB24TqfLYNnkplZdUbeqA-P9rUIBujVKXw_S-wKY,18371
5
+ omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
6
+ omnata_plugin_runtime/omnata_plugin.py,sha256=yqzFoAHbJ7zumfG27o9wVXTum0v1sYcYDxHPdYsjYLU,86572
7
+ omnata_plugin_runtime/plugin_entrypoints.py,sha256=4qpTzUrfL_gGMDYhGnEwHgCRUJII1yU2AB4WgCko_8Q,26650
8
+ omnata_plugin_runtime/rate_limiting.py,sha256=se6MftQI5NrVHaLb1hByPCgAESPQhkAgIG7KIU1clDU,16562
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,,
@@ -1,12 +0,0 @@
1
- omnata_plugin_runtime/__init__.py,sha256=w63LVME5nY-hQ4BBzfacy9kvTunwqHGs8iiSPGAX2ns,1214
2
- omnata_plugin_runtime/api.py,sha256=_N5ok5LN7GDO4J9n3yduXp3tpjmhpySY__U2baiygrs,6217
3
- omnata_plugin_runtime/configuration.py,sha256=Glj4Xd9lz1QAMkpSkIaLeEcwWs0ns_WgS9U8BODgbA8,34690
4
- omnata_plugin_runtime/forms.py,sha256=30CJB24TqfLYNnkplZdUbeqA-P9rUIBujVKXw_S-wKY,18371
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
8
- omnata_plugin_runtime/rate_limiting.py,sha256=se6MftQI5NrVHaLb1hByPCgAESPQhkAgIG7KIU1clDU,16562
9
- omnata_plugin_runtime-0.2.99.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
- omnata_plugin_runtime-0.2.99.dist-info/METADATA,sha256=rVxLnjPiwTigT54fLH9eBlcl00ZKE3ZecUMov6PVryw,1605
11
- omnata_plugin_runtime-0.2.99.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
12
- omnata_plugin_runtime-0.2.99.dist-info/RECORD,,