outerbounds 0.3.179rc3__py3-none-any.whl → 0.3.179rc5__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.
@@ -25,6 +25,7 @@ from .app_config import (
25
25
  CAPSULE_DEBUG,
26
26
  AuthType,
27
27
  )
28
+ from .perimeters import PerimeterExtractor
28
29
  from .cli_to_config import build_config_from_options
29
30
  from .utils import CommaSeparatedListType, KVPairType, KVDictType
30
31
  from . import experimental
@@ -137,28 +138,16 @@ def app(ctx):
137
138
  config_dir = os.path.expanduser(
138
139
  os.environ.get("METAFLOW_HOME", "~/.metaflowconfig")
139
140
  )
140
- api_url = metaflowconfig.get_sanitized_url_from_config(
141
- config_dir, profile, "OBP_API_SERVER"
141
+ perimeter, api_server = PerimeterExtractor.for_ob_cli(
142
+ config_dir=config_dir, profile=profile
142
143
  )
143
- ctx.obj.api_url = api_url
144
- if os.environ.get("OB_CURRENT_PERIMETER") or os.environ.get("OBP_PERIMETER"):
145
- ctx.obj.perimeter = os.environ.get("OB_CURRENT_PERIMETER") or os.environ.get(
146
- "OBP_PERIMETER"
147
- )
148
- else:
149
- ob_config_file_path = metaflowconfig.get_ob_config_file_path(
150
- config_dir, profile
144
+ if perimeter is None or api_server is None:
145
+ raise AppConfigError(
146
+ "Perimeter not found in the environment, Found perimeter: %s, api_server: %s"
147
+ % (perimeter, api_server)
151
148
  )
152
- if os.path.exists(ob_config_file_path):
153
- with open(ob_config_file_path, "r") as f:
154
- ob_config = json.load(f)
155
- ctx.obj.perimeter = ob_config.get("OB_CURRENT_PERIMETER")
156
- else:
157
- raise AppConfigError(
158
- "OB_CURRENT_PERIMETER or OBP_PERIMETER is not set and no ob_config.json file found in %s for Profile %s. It was checking it in the following location: %s"
159
- % (config_dir, profile, ob_config_file_path)
160
- )
161
-
149
+ ctx.obj.perimeter = perimeter
150
+ ctx.obj.api_url = api_server
162
151
  os.makedirs(ctx.obj.app_state_dir, exist_ok=True)
163
152
 
164
153
 
@@ -0,0 +1,51 @@
1
+ import os
2
+ import json
3
+ from typing import Tuple
4
+
5
+
6
+ class PerimeterExtractor:
7
+ @classmethod
8
+ def for_ob_cli(cls, config_dir: str, profile: str) -> Tuple[str, str]:
9
+ """
10
+ This function will be called when we are trying to extract the perimeter
11
+ via the ob cli's execution. We will rely on the following logic:
12
+ 1. check environment variables like OB_CURRENT_PERIMETER / OBP_PERIMETER
13
+ 2. run init config to extract the perimeter related configurations.
14
+
15
+ Returns
16
+ -------
17
+ Tuple[str, str] : Tuple containing perimeter name , API server url.
18
+ """
19
+ from outerbounds.utils import metaflowconfig
20
+
21
+ perimeter = None
22
+ api_server = None
23
+ if os.environ.get("OB_CURRENT_PERIMETER") or os.environ.get("OBP_PERIMETER"):
24
+ perimeter = os.environ.get("OB_CURRENT_PERIMETER") or os.environ.get(
25
+ "OBP_PERIMETER"
26
+ )
27
+
28
+ if os.environ.get("OBP_API_SERVER"):
29
+ api_server = os.environ.get("OBP_API_SERVER")
30
+
31
+ if perimeter is None or api_server is None:
32
+ metaflow_config = metaflowconfig.init_config(config_dir, profile)
33
+ perimeter = metaflow_config.get("OBP_PERIMETER")
34
+ api_server = metaflowconfig.get_sanitized_url_from_config(
35
+ config_dir, profile, "OBP_API_SERVER"
36
+ )
37
+
38
+ return perimeter, api_server
39
+
40
+ pass
41
+
42
+ @classmethod
43
+ def during_metaflow_execution(cls):
44
+ pass # todo: implement this
45
+
46
+
47
+ def general_purpose_perimeter_extractor(config_dir: str, profile: str) -> str:
48
+ """
49
+ This function will rely on a mix of configuration variables and utilities with ob package to extract the perimeter
50
+ from the current environment.
51
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: outerbounds
3
- Version: 0.3.179rc3
3
+ Version: 0.3.179rc5
4
4
  Summary: More Data Science, Less Administration
5
5
  License: Proprietary
6
6
  Keywords: data science,machine learning,MLOps
@@ -29,8 +29,8 @@ Requires-Dist: google-cloud-secret-manager (>=2.20.0,<3.0.0) ; extra == "gcp"
29
29
  Requires-Dist: google-cloud-storage (>=2.14.0,<3.0.0) ; extra == "gcp"
30
30
  Requires-Dist: metaflow-checkpoint (==0.2.1)
31
31
  Requires-Dist: ob-metaflow (==2.15.17.1)
32
- Requires-Dist: ob-metaflow-extensions (==1.1.166rc4)
33
- Requires-Dist: ob-metaflow-stubs (==6.0.3.179rc3)
32
+ Requires-Dist: ob-metaflow-extensions (==1.1.166rc6)
33
+ Requires-Dist: ob-metaflow-stubs (==6.0.3.179rc5)
34
34
  Requires-Dist: opentelemetry-distro (>=0.41b0) ; extra == "otel"
35
35
  Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.20.0) ; extra == "otel"
36
36
  Requires-Dist: opentelemetry-instrumentation-requests (>=0.41b0) ; extra == "otel"
@@ -40,7 +40,7 @@ outerbounds/_vendor/yaml/scanner.py,sha256=ZcI8IngR56PaQ0m27WU2vxCqmDCuRjz-hr7pi
40
40
  outerbounds/_vendor/yaml/serializer.py,sha256=8wFZRy9SsQSktF_f9OOroroqsh4qVUe53ry07P9UgCc,4368
41
41
  outerbounds/_vendor/yaml/tokens.py,sha256=JBSu38wihGr4l73JwbfMA7Ks1-X84g8-NskTz7KwPmA,2578
42
42
  outerbounds/apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
- outerbounds/apps/app_cli.py,sha256=ZVQws3h8Kqb6x9cEpycq6DO9ezFRmjyPAdEU2ge_hjE,25074
43
+ outerbounds/apps/app_cli.py,sha256=r-cwgZ04qL6yAa1mYMKLR4y7zKc7lzLR7tA6oCT78rs,24534
44
44
  outerbounds/apps/app_config.py,sha256=KBmW9grhiuG9XZG-R0GZkM-024cjj6ztGzOX_2wZW34,11291
45
45
  outerbounds/apps/artifacts.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  outerbounds/apps/capsule.py,sha256=5lx2M8z8hYNf4_5sX1jk61alrqpEDM8aC0ZVUXu69wI,18883
@@ -52,6 +52,7 @@ outerbounds/apps/config_schema.yaml,sha256=27uanKvGQkhOj8jsGRKkenxuYpMLAFnlx486r
52
52
  outerbounds/apps/dependencies.py,sha256=SqvdFQdFZZW0wXX_CHMHCrfE0TwaRkTvGCRbQ2Mx3q0,3935
53
53
  outerbounds/apps/deployer.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  outerbounds/apps/experimental/__init__.py,sha256=ExPFIJSF8FcE1pKVyiNQnX8aBi3Rz8YFQ2_s5NVeU7I,3056
55
+ outerbounds/apps/perimeters.py,sha256=DKWKMbkSx8WObf4yA74UolleT417B9c_6POioztMHxY,1766
55
56
  outerbounds/apps/secrets.py,sha256=27qf04lOBqRjvcswj0ldHOmntP2T6SEjtMJtkJQ_GUg,6100
56
57
  outerbounds/apps/utils.py,sha256=549dmQ-r61ihDf5nIAKQv7kDJuxBaO4Xd6BR2xMsI_w,8086
57
58
  outerbounds/apps/validations.py,sha256=AVEw9eCvkzqq1m5ZC8btaWrSR6kWYKzarELfrASuAwQ,1117
@@ -72,7 +73,7 @@ outerbounds/utils/metaflowconfig.py,sha256=l2vJbgPkLISU-XPGZFaC8ZKmYFyJemlD6bwB-
72
73
  outerbounds/utils/schema.py,sha256=lMUr9kNgn9wy-sO_t_Tlxmbt63yLeN4b0xQXbDUDj4A,2331
73
74
  outerbounds/utils/utils.py,sha256=4Z8cszNob_8kDYCLNTrP-wWads_S_MdL3Uj3ju4mEsk,501
74
75
  outerbounds/vendor.py,sha256=gRLRJNXtZBeUpPEog0LOeIsl6GosaFFbCxUvR4bW6IQ,5093
75
- outerbounds-0.3.179rc3.dist-info/METADATA,sha256=EcUNjyINCJVGyTvORAJ-YOaJuw0y9Z8JO6cq48kSOvI,1846
76
- outerbounds-0.3.179rc3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
77
- outerbounds-0.3.179rc3.dist-info/entry_points.txt,sha256=AP6rZg7y5SK9e9a9iVq0Fi9Q2KPjPZSwtZ6R98rLw-8,56
78
- outerbounds-0.3.179rc3.dist-info/RECORD,,
76
+ outerbounds-0.3.179rc5.dist-info/METADATA,sha256=cjPsWOH79wlMmmImHivpplehIzVoRaFctGbS9tFAOk0,1846
77
+ outerbounds-0.3.179rc5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
78
+ outerbounds-0.3.179rc5.dist-info/entry_points.txt,sha256=AP6rZg7y5SK9e9a9iVq0Fi9Q2KPjPZSwtZ6R98rLw-8,56
79
+ outerbounds-0.3.179rc5.dist-info/RECORD,,