ob-metaflow-extensions 1.1.148__py2.py3-none-any.whl → 1.1.150__py2.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.

Potentially problematic release.


This version of ob-metaflow-extensions might be problematic. Click here for more details.

@@ -4,13 +4,48 @@ from typing import Dict
4
4
  import base64
5
5
  import json
6
6
  import requests
7
+ import random
7
8
  import time
9
+ import sys
8
10
 
9
11
 
10
12
  class OuterboundsSecretsException(Exception):
11
13
  pass
12
14
 
13
15
 
16
+ def _api_server_get(*args, conn_error_retries=2, **kwargs):
17
+ """
18
+ There are two categories of errors that we need to handle when dealing with any API server.
19
+ 1. HTTP errors. These are are errors that are returned from the API server.
20
+ - How to handle retries for this case will be application specific.
21
+ 2. Errors when the API server may not be reachable (DNS resolution / network issues)
22
+ - In this scenario, we know that something external to the API server is going wrong causing the issue.
23
+ - Failing pre-maturely in the case might not be the best course of action since critical user jobs might crash on intermittent issues.
24
+ - So in this case, we can just planely retry the request.
25
+
26
+ This function handles the second case. It's a simple wrapper to handle the retry logic for connection errors.
27
+ If this function is provided a `conn_error_retries` of 5, then the last retry will have waited 32 seconds.
28
+ Generally this is a safe enough number of retries after which we can assume that something is really broken. Until then,
29
+ there can be intermittent issues that would resolve themselves if we retry gracefully.
30
+ """
31
+ _num_retries = 0
32
+ noise = random.uniform(-0.5, 0.5)
33
+ while _num_retries < conn_error_retries:
34
+ try:
35
+ return requests.get(*args, **kwargs)
36
+ except requests.exceptions.ConnectionError:
37
+ if _num_retries <= conn_error_retries - 1:
38
+ # Exponential backoff with 2^(_num_retries+1) seconds
39
+ time.sleep((2 ** (_num_retries + 1)) + noise)
40
+ _num_retries += 1
41
+ else:
42
+ print(
43
+ "[@secrets] Failed to connect to the API server. ",
44
+ file=sys.stderr,
45
+ )
46
+ raise
47
+
48
+
14
49
  class OuterboundsSecretsApiResponse:
15
50
  def __init__(self, response):
16
51
  self.response = response
@@ -133,7 +168,9 @@ class OuterboundsSecretsProvider(SecretsProvider):
133
168
  retryable_status_codes = [409]
134
169
  json_payload = json.dumps(payload)
135
170
  for attempt in range(2): # 0 = initial attempt, 1-2 = retries
136
- response = requests.get(url, data=json_payload, headers=request_headers)
171
+ response = _api_server_get(
172
+ url, data=json_payload, headers=request_headers, conn_error_retries=5
173
+ )
137
174
  if response.status_code not in retryable_status_codes:
138
175
  break
139
176
 
@@ -141,7 +178,6 @@ class OuterboundsSecretsProvider(SecretsProvider):
141
178
  sleep_time = 0.5 * (attempt + 1)
142
179
  time.sleep(sleep_time)
143
180
 
144
- response = requests.get(url, data=json_payload, headers=request_headers)
145
181
  self._handle_error_response(response)
146
182
  return OuterboundsSecretsApiResponse(response.json())
147
183
 
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ob-metaflow-extensions
3
- Version: 1.1.148
3
+ Version: 1.1.150
4
4
  Summary: Outerbounds Platform Extensions for Metaflow
5
5
  Author: Outerbounds, Inc.
6
6
  License: Commercial
7
7
  Description-Content-Type: text/markdown
8
8
  Requires-Dist: boto3
9
9
  Requires-Dist: kubernetes
10
- Requires-Dist: ob-metaflow (==2.15.10.1)
10
+ Requires-Dist: ob-metaflow (==2.15.11.1)
11
11
 
12
12
  # Outerbounds platform package
13
13
 
@@ -40,7 +40,7 @@ metaflow_extensions/outerbounds/plugins/ollama/ollama.py,sha256=KlP8_EmnUoi8-Pid
40
40
  metaflow_extensions/outerbounds/plugins/profilers/deco_injector.py,sha256=oI_C3c64XBm7n88FILqHwn-Nnc5DeT_68I67lM9rXaI,2434
41
41
  metaflow_extensions/outerbounds/plugins/profilers/gpu_profile_decorator.py,sha256=gDHQ2sMIp4NuZSzUspbSd8RGdFAoO5mgZAyFcZ2a51Y,2619
42
42
  metaflow_extensions/outerbounds/plugins/secrets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
- metaflow_extensions/outerbounds/plugins/secrets/secrets.py,sha256=2bLrrzcZdIX8RYTnO6f0GszQS36Wc1IvtpenX-K3qls,6623
43
+ metaflow_extensions/outerbounds/plugins/secrets/secrets.py,sha256=3s98hO_twKkM22tKyDdcUjGQNfYpSXW_jLKISV9ju_U,8433
44
44
  metaflow_extensions/outerbounds/plugins/snowflake/__init__.py,sha256=RG4ixt3jwqcK1_tt0QxLcUbNmf7wWAMnZhBx-ZMGgLk,114
45
45
  metaflow_extensions/outerbounds/plugins/snowflake/snowflake.py,sha256=zoWSHM4CJSfUmJSP-_i4zREWyQOW4USBlgjhQnEhlTE,13669
46
46
  metaflow_extensions/outerbounds/plugins/snowpark/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -61,7 +61,7 @@ metaflow_extensions/outerbounds/toplevel/plugins/gcp/__init__.py,sha256=BbZiaH3u
61
61
  metaflow_extensions/outerbounds/toplevel/plugins/kubernetes/__init__.py,sha256=5zG8gShSj8m7rgF4xgWBZFuY3GDP5n1T0ktjRpGJLHA,69
62
62
  metaflow_extensions/outerbounds/toplevel/plugins/ollama/__init__.py,sha256=GRSz2zwqkvlmFS6bcfYD_CX6CMko9DHQokMaH1iBshA,47
63
63
  metaflow_extensions/outerbounds/toplevel/plugins/snowflake/__init__.py,sha256=LptpH-ziXHrednMYUjIaosS1SXD3sOtF_9_eRqd8SJw,50
64
- ob_metaflow_extensions-1.1.148.dist-info/METADATA,sha256=JMOBwxmg167Pp0EsDI3KVAfgDFfNwxTvtZtYaWuqG0Q,521
65
- ob_metaflow_extensions-1.1.148.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
66
- ob_metaflow_extensions-1.1.148.dist-info/top_level.txt,sha256=NwG0ukwjygtanDETyp_BUdtYtqIA_lOjzFFh1TsnxvI,20
67
- ob_metaflow_extensions-1.1.148.dist-info/RECORD,,
64
+ ob_metaflow_extensions-1.1.150.dist-info/METADATA,sha256=0stXBYhOaQQvZRBO8sAKGNW5E0VgODLNT-LaWtqyxZI,521
65
+ ob_metaflow_extensions-1.1.150.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
66
+ ob_metaflow_extensions-1.1.150.dist-info/top_level.txt,sha256=NwG0ukwjygtanDETyp_BUdtYtqIA_lOjzFFh1TsnxvI,20
67
+ ob_metaflow_extensions-1.1.150.dist-info/RECORD,,