port-ocean 0.29.3__py3-none-any.whl → 0.29.4__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.
@@ -2,4 +2,4 @@ if test -e /usr/local/share/ca-certificates/cert.crt; then
2
2
  sudo update-ca-certificates
3
3
  fi
4
4
 
5
- ocean sail
5
+ exec ocean sail
@@ -102,4 +102,3 @@ class ResyncStateUpdater:
102
102
  await ocean.metrics.report_sync_metrics(
103
103
  kinds=[ocean.metrics.current_resource_kind()]
104
104
  )
105
- ocean.metrics.event_id = f"{ocean.metrics.event_id}-done"
@@ -735,10 +735,15 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
735
735
  self._register_in_batches(resource, user_agent_type)
736
736
  )
737
737
  event.on_abort(lambda: task.cancel())
738
- kind_results: tuple[list[Entity], list[Exception]] = await task
739
738
 
740
- if ocean.metrics.sync_state != SyncState.FAILED:
741
- ocean.metrics.sync_state = SyncState.COMPLETED
739
+ try:
740
+ kind_results: tuple[list[Entity], list[Exception]] = await task
741
+ if ocean.metrics.sync_state != SyncState.FAILED:
742
+ ocean.metrics.sync_state = SyncState.COMPLETED
743
+ except asyncio.CancelledError:
744
+ logger.warning(f"Resource {resource.kind} processing was aborted")
745
+ ocean.metrics.sync_state = SyncState.ABORTED
746
+ raise
742
747
 
743
748
  await ocean.metrics.send_metrics_to_webhook(kind=resource_kind_id)
744
749
  await ocean.metrics.report_kind_sync_metrics(
@@ -1022,7 +1027,7 @@ class SyncRawMixin(HandlerMixin, EventsMixin):
1022
1027
  )
1023
1028
 
1024
1029
  async with metric_resource_context(MetricResourceKind.RUNTIME):
1025
- ocean.metrics.sync_state = SyncState.FAILED
1030
+ ocean.metrics.sync_state = SyncState.ABORTED
1026
1031
  await ocean.metrics.send_metrics_to_webhook(kind=MetricResourceKind.RUNTIME)
1027
1032
  await ocean.metrics.report_sync_metrics(kinds=[MetricResourceKind.RUNTIME])
1028
1033
  raise
@@ -57,6 +57,7 @@ class SyncState:
57
57
  COMPLETED = "completed"
58
58
  PENDING = "pending"
59
59
  FAILED = "failed"
60
+ ABORTED = "aborted"
60
61
 
61
62
 
62
63
  class MetricResourceKind:
port_ocean/ocean.py CHANGED
@@ -108,7 +108,7 @@ class Ocean:
108
108
  )
109
109
  self.app_initialized = False
110
110
 
111
- signal_handler.register(self._report_resync_aborted)
111
+ signal_handler.register(self._report_resync_aborted, priority=100)
112
112
 
113
113
  async def _report_resync_aborted(self) -> None:
114
114
  """
@@ -116,13 +116,26 @@ class Ocean:
116
116
  This ensures Port is notified that the integration was interrupted.
117
117
  """
118
118
  try:
119
- if self.metrics.event_id.find("-done") == -1:
120
- await self.resync_state_updater.update_after_resync(
121
- IntegrationStateStatus.Aborted
119
+ if self.resync_state_updater:
120
+ current_integration = await self.port_client.get_current_integration()
121
+ current_status = (
122
+ current_integration.get("resyncState", {}).get("status")
123
+ if current_integration
124
+ else None
122
125
  )
123
- logger.info("Resync status reported as aborted due to app shutdown")
126
+ if current_status == IntegrationStateStatus.Running.value:
127
+ await self.resync_state_updater.update_after_resync(
128
+ status=IntegrationStateStatus.Aborted
129
+ )
130
+ logger.info(
131
+ "Graceful shutdown completed - sync state set to aborted"
132
+ )
133
+ else:
134
+ logger.info(
135
+ "Graceful shutdown completed - sync was already completed, status unchanged"
136
+ )
124
137
  except Exception as e:
125
- logger.warning(f"Failed to report resync status on shutdown: {e}")
138
+ logger.warning(f"Error during graceful shutdown: {e}")
126
139
 
127
140
  def _get_process_execution_mode(self) -> ProcessExecutionMode:
128
141
  if self.config.process_execution_mode:
@@ -160,7 +173,10 @@ class Ocean:
160
173
  )
161
174
  except asyncio.CancelledError:
162
175
  logger.warning(
163
- "resync was cancelled by the scheduled resync, skipping state update"
176
+ "resync was cancelled by the scheduled resync, updating state to aborted"
177
+ )
178
+ await self.resync_state_updater.update_after_resync(
179
+ IntegrationStateStatus.Aborted
164
180
  )
165
181
  except Exception as e:
166
182
  await self.resync_state_updater.update_after_resync(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: port-ocean
3
- Version: 0.29.3
3
+ Version: 0.29.4
4
4
  Summary: Port Ocean is a CLI tool for managing your Port projects.
5
5
  Home-page: https://app.getport.io
6
6
  Keywords: ocean,port-ocean,port
@@ -8,7 +8,7 @@ integrations/_infra/Makefile,sha256=YgLKvuF_Dw4IA7X98Nus6zIW_3cJ60M1QFGs3imj5c4,
8
8
  integrations/_infra/README.md,sha256=ZtJFSMCTU5zTeM8ddRuW1ZL1ga8z7Ic2F3mxmgOSjgo,1195
9
9
  integrations/_infra/entry_local.sh,sha256=Sn2TexTEpruH2ixIAGsk-fZV6Y7pT3jd2Pi9TxBeFuw,633
10
10
  integrations/_infra/grpcio.sh,sha256=m924poYznoRZ6Tt7Ct8Cs5AV_cmmOx598yIZ3z4DvZE,616
11
- integrations/_infra/init.sh,sha256=yyAall_O2PHRA1qS5_Pm-kGm7HKlASLFfzmyWGic6vg,104
11
+ integrations/_infra/init.sh,sha256=oVsYmJDseEZXuuzcuicgXkFbKHNyN8F6AIBHDwIMPb8,109
12
12
  port_ocean/__init__.py,sha256=uMpjg5d_cXgnyCxA_LmICR8zqBmC6Fe9Ivu9hcvJ7EY,313
13
13
  port_ocean/bootstrap.py,sha256=CN1M5pVecZ7z_Vfu86Dk2HjFMiuiwt6E_SSOLFCYRMk,1321
14
14
  port_ocean/cache/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -117,7 +117,7 @@ port_ocean/core/handlers/queue/abstract_queue.py,sha256=SaivrYbqg8qsX6wtQlJZyxgc
117
117
  port_ocean/core/handlers/queue/group_queue.py,sha256=JvvJOwz9z_aI4CjPr7yQX-0rOgqLI5wMdxWk2x5x-34,4989
118
118
  port_ocean/core/handlers/queue/local_queue.py,sha256=Y6qabDbrQ8aOPTN6Ct3lnMU7JnT8O8iTpoxMoVt6lFs,643
119
119
  port_ocean/core/handlers/resync_state_updater/__init__.py,sha256=kG6y-JQGpPfuTHh912L_bctIDCzAK4DN-d00S7rguWU,81
120
- port_ocean/core/handlers/resync_state_updater/updater.py,sha256=UWUwHX8-Sr6UxCjcpgInonM_2SbO2WWgawONtZJZQB8,3937
120
+ port_ocean/core/handlers/resync_state_updater/updater.py,sha256=pbKhmqvTMY3DnnIgYjvSVKNt_A2P0wGLROhLRU8ofgo,3871
121
121
  port_ocean/core/handlers/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
122
  port_ocean/core/handlers/webhook/abstract_webhook_processor.py,sha256=8oCYaJwr_b8HP-xS0oR1Zia0YYmwJT9vJ4fOvgDlvDY,4362
123
123
  port_ocean/core/handlers/webhook/processor_manager.py,sha256=QAidsITckOuYGLMEGA3OAzS4hBNfPiWds5WHdYvQ2qc,13751
@@ -129,7 +129,7 @@ port_ocean/core/integrations/mixins/events.py,sha256=2L7P3Jhp8XBqddh2_o9Cn4N261n
129
129
  port_ocean/core/integrations/mixins/handler.py,sha256=mZ7-0UlG3LcrwJttFbMe-R4xcOU2H_g33tZar7PwTv8,3771
130
130
  port_ocean/core/integrations/mixins/live_events.py,sha256=zM24dhNc7uHx9XYZ6toVhDADPA90EnpOmZxgDegFZbA,4196
131
131
  port_ocean/core/integrations/mixins/sync.py,sha256=Vm_898pLKBwfVewtwouDWsXoxcOLicnAy6pzyqqk6U8,4053
132
- port_ocean/core/integrations/mixins/sync_raw.py,sha256=ed-f2t8Gb-Pjywhf8YxKBkQPAaYi23Mr81twINDYKQc,41054
132
+ port_ocean/core/integrations/mixins/sync_raw.py,sha256=coBJZvPGRTVF-akRgnH6mQ4mDHdD6uq_aQ83FoiWrt0,41293
133
133
  port_ocean/core/integrations/mixins/utils.py,sha256=JegPuIQGBXMnywHBIX30i7gYz0gY7_bW_Jx5LUuQM9c,13718
134
134
  port_ocean/core/models.py,sha256=sN7viTJbqEEy7j8VEgeffusML31cQWgzI7k8JP64Mbg,3769
135
135
  port_ocean/core/ocean_types.py,sha256=bkLlTd8XfJK6_JDl0eXUHfE_NygqgiInSMwJ4YJH01Q,1399
@@ -148,7 +148,7 @@ port_ocean/exceptions/utils.py,sha256=gjOqpi-HpY1l4WlMFsGA9yzhxDhajhoGGdDDyGbLnq
148
148
  port_ocean/exceptions/webhook_processor.py,sha256=4SnkVzVwiacH_Ip4qs1hRHa6GanhnojW_TLTdQQtm7Y,363
149
149
  port_ocean/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
150
150
  port_ocean/helpers/async_client.py,sha256=M8gKUjX8ZwRbmJ-U6KNq-p-nfGr0CwHdS0eN_pbZAJ0,2103
151
- port_ocean/helpers/metric/metric.py,sha256=6SMxov1WcZAV0NehMGMqWiLoOIpw-2fOpVbtPWhmW1c,14544
151
+ port_ocean/helpers/metric/metric.py,sha256=kBRMCSBrCmwloBt4qnlJWZoZWU-b9hm3Mvm7rCjhtDs,14568
152
152
  port_ocean/helpers/metric/utils.py,sha256=1lAgrxnZLuR_wUNDyPOPzLrm32b8cDdioob2lvnPQ1A,1619
153
153
  port_ocean/helpers/retry.py,sha256=yL0TJvA-0jol-zyUO57pYBCRmq3ZglkrgCdX3QZ6tHs,20288
154
154
  port_ocean/helpers/stream.py,sha256=_UwsThzXynxWzL8OlBT1pmb2evZBi9HaaqeAGNuTuOI,2338
@@ -157,7 +157,7 @@ port_ocean/log/handlers.py,sha256=LJ1WAfq7wYCrBpeLPihMKmWjdSahKKXNHFMRYkbk0Co,36
157
157
  port_ocean/log/logger_setup.py,sha256=wcr5WOkYRtng4pW6ZRl4Av3GqtZ2omSWIqYhB_8Duuc,2700
158
158
  port_ocean/log/sensetive.py,sha256=lVKiZH6b7TkrZAMmhEJRhcl67HNM94e56x12DwFgCQk,2920
159
159
  port_ocean/middlewares.py,sha256=9wYCdyzRZGK1vjEJ28FY_DkfwDNENmXp504UKPf5NaQ,2727
160
- port_ocean/ocean.py,sha256=4KRqRZdeaZ4tGLRglZ3eFKWz-aE_Rqs3-iz5EQvHN2o,10858
160
+ port_ocean/ocean.py,sha256=vymehuoh2ZlMg16y4zl5I4IisgCWG22_-bwlzvJSE9s,11600
161
161
  port_ocean/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
162
  port_ocean/run.py,sha256=CmKz14bxfdOooNbQ5QqH1MwX-XLYVG4NgT4KbrzFaqI,2216
163
163
  port_ocean/sonar-project.properties,sha256=X_wLzDOkEVmpGLRMb2fg9Rb0DxWwUFSvESId8qpvrPI,73
@@ -218,8 +218,8 @@ port_ocean/utils/repeat.py,sha256=U2OeCkHPWXmRTVoPV-VcJRlQhcYqPWI5NfmPlb1JIbc,32
218
218
  port_ocean/utils/signal.py,sha256=J1sI-e_32VHP_VUa5bskLMFoJjJOAk5isrnewKDikUI,2125
219
219
  port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
220
220
  port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
221
- port_ocean-0.29.3.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
222
- port_ocean-0.29.3.dist-info/METADATA,sha256=ifeuG4g7Bp8E2lXHktm0nju_-RAMW7oOqRvF3JpHcZI,7054
223
- port_ocean-0.29.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
224
- port_ocean-0.29.3.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
225
- port_ocean-0.29.3.dist-info/RECORD,,
221
+ port_ocean-0.29.4.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
222
+ port_ocean-0.29.4.dist-info/METADATA,sha256=8i6m2rimeX2fiAW0Hwm7Xnpolo7HCBhwPYMNsrN_uAE,7054
223
+ port_ocean-0.29.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
224
+ port_ocean-0.29.4.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
225
+ port_ocean-0.29.4.dist-info/RECORD,,