omnata-plugin-runtime 0.8.0a189__tar.gz → 0.8.0a190__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/PKG-INFO +1 -1
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/pyproject.toml +1 -1
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/src/omnata_plugin_runtime/rate_limiting.py +15 -9
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/LICENSE +0 -0
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/README.md +0 -0
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/src/omnata_plugin_runtime/__init__.py +0 -0
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/src/omnata_plugin_runtime/api.py +0 -0
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/src/omnata_plugin_runtime/configuration.py +0 -0
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/src/omnata_plugin_runtime/forms.py +0 -0
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/src/omnata_plugin_runtime/logging.py +0 -0
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/src/omnata_plugin_runtime/omnata_plugin.py +0 -0
- {omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/src/omnata_plugin_runtime/plugin_entrypoints.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "omnata-plugin-runtime"
|
3
|
-
version = "0.8.0-
|
3
|
+
version = "0.8.0-a190"
|
4
4
|
description = "Classes and common runtime components for building and running Omnata Plugins"
|
5
5
|
authors = ["James Weakley <james.weakley@omnata.com>"]
|
6
6
|
readme = "README.md"
|
@@ -19,6 +19,9 @@ from .logging import logger
|
|
19
19
|
import pytz
|
20
20
|
from requests.adapters import HTTPAdapter
|
21
21
|
from urllib3.util.retry import Retry
|
22
|
+
from opentelemetry import trace
|
23
|
+
|
24
|
+
tracer = trace.get_tracer(__name__)
|
22
25
|
|
23
26
|
TimeUnitType = Literal["second", "minute", "hour", "day"]
|
24
27
|
|
@@ -383,11 +386,12 @@ class RetryWithLogging(Retry):
|
|
383
386
|
retry_after = self.get_retry_after(response)
|
384
387
|
if retry_after:
|
385
388
|
logger.info(f"Retrying after {retry_after} seconds due to Retry-After header")
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
389
|
+
with tracer.start_as_current_span("http_retry_wait"):
|
390
|
+
if self.thread_cancellation_token is None:
|
391
|
+
time.sleep(retry_after)
|
392
|
+
else:
|
393
|
+
if self.thread_cancellation_token.wait(retry_after):
|
394
|
+
raise InterruptedWhileWaitingException(message="The sync was interrupted while waiting for rate limiting to expire")
|
391
395
|
return True
|
392
396
|
return False
|
393
397
|
|
@@ -504,8 +508,9 @@ class RateLimitedSession(requests.Session):
|
|
504
508
|
raise InterruptedWhileWaitingException(message=f"The rate limiting wait time ({wait_time} seconds) would exceed the run deadline")
|
505
509
|
logger.info(f"Waiting for {wait_time} seconds before retrying {method} request to {url}")
|
506
510
|
# if wait() returns true, it means that the thread was cancelled
|
507
|
-
|
508
|
-
|
511
|
+
with tracer.start_as_current_span("http_retry_wait"):
|
512
|
+
if self.thread_cancellation_token.wait(wait_time):
|
513
|
+
raise InterruptedWhileWaitingException(message="The sync was interrupted while waiting for rate limiting to expire")
|
509
514
|
else:
|
510
515
|
current_url_retries = self.increment_retries(url)
|
511
516
|
if current_url_retries >= self.max_retries:
|
@@ -514,8 +519,9 @@ class RateLimitedSession(requests.Session):
|
|
514
519
|
if datetime.datetime.now(pytz.UTC) + datetime.timedelta(seconds=backoff_time) > self.run_deadline:
|
515
520
|
raise InterruptedWhileWaitingException(message=f"The rate limiting backoff time ({backoff_time} seconds) would exceed the run deadline")
|
516
521
|
logger.info(f"Waiting for {backoff_time} seconds before retrying {method} request to {url}")
|
517
|
-
|
518
|
-
|
522
|
+
with tracer.start_as_current_span("http_retry_wait"):
|
523
|
+
if self.thread_cancellation_token.wait(backoff_time):
|
524
|
+
raise InterruptedWhileWaitingException(message="The sync was interrupted while waiting for rate limiting backoff")
|
519
525
|
else:
|
520
526
|
self.set_retries(url,0) # Reset retries if the request is successful
|
521
527
|
return response
|
File without changes
|
File without changes
|
File without changes
|
{omnata_plugin_runtime-0.8.0a189 → omnata_plugin_runtime-0.8.0a190}/src/omnata_plugin_runtime/api.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|