outerbounds 0.3.52rc0__py3-none-any.whl → 0.3.52rc1__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.
@@ -110,8 +110,10 @@ def configure_cloud_workstation(config_dir=None, profile=None, binary=None, outp
110
110
  kubeconfig_configure_step = CommandStatus(
111
111
  "ConfigureKubeConfig", OuterboundsCommandStatus.OK, "Kubeconfig is configured"
112
112
  )
113
-
114
113
  try:
114
+ if not profile:
115
+ profile = metaflowconfig.get_metaflow_profile()
116
+
115
117
  metaflow_token = metaflowconfig.get_metaflow_token_from_config(
116
118
  config_dir, profile
117
119
  )
@@ -196,6 +198,9 @@ def configure_cloud_workstation(config_dir=None, profile=None, binary=None, outp
196
198
  )
197
199
  def list_workstations(config_dir=None, profile=None):
198
200
  try:
201
+ if not profile:
202
+ profile = metaflowconfig.get_metaflow_profile()
203
+
199
204
  metaflow_token = metaflowconfig.get_metaflow_token_from_config(
200
205
  config_dir, profile
201
206
  )
@@ -215,7 +220,7 @@ def list_workstations(config_dir=None, profile=None):
215
220
  )
216
221
  except Exception as e:
217
222
  click.secho("Failed to list workstations", fg="red")
218
- click.secho("Error: {}".format(str(e)))
223
+ click.secho("Error: {}".format(str(e)), fg="red")
219
224
 
220
225
 
221
226
  @cli.command(help="Hibernate workstation", hidden=True)
@@ -243,6 +248,8 @@ def hibernate_workstation(config_dir=None, profile=None, workstation=None):
243
248
  click.secho("Please specify a workstation ID", fg="red")
244
249
  return
245
250
  try:
251
+ if not profile:
252
+ profile = metaflowconfig.get_metaflow_profile()
246
253
  metaflow_token = metaflowconfig.get_metaflow_token_from_config(
247
254
  config_dir, profile
248
255
  )
@@ -267,7 +274,7 @@ def hibernate_workstation(config_dir=None, profile=None, workstation=None):
267
274
  )
268
275
  except Exception as e:
269
276
  click.secho("Failed to hibernate workstation", fg="red")
270
- click.secho("Error: {}".format(str(e)))
277
+ click.secho("Error: {}".format(str(e)), fg="red")
271
278
 
272
279
 
273
280
  @cli.command(help="Restart workstation to the int", hidden=True)
@@ -295,6 +302,9 @@ def restart_workstation(config_dir=None, profile=None, workstation=None):
295
302
  click.secho("Please specify a workstation ID", fg="red")
296
303
  return
297
304
  try:
305
+ if not profile:
306
+ profile = metaflowconfig.get_metaflow_profile()
307
+
298
308
  metaflow_token = metaflowconfig.get_metaflow_token_from_config(
299
309
  config_dir, profile
300
310
  )
@@ -319,7 +329,7 @@ def restart_workstation(config_dir=None, profile=None, workstation=None):
319
329
  )
320
330
  except Exception as e:
321
331
  click.secho("Failed to restart workstation", fg="red")
322
- click.secho("Error: {}".format(str(e)))
332
+ click.secho("Error: {}".format(str(e)), fg="red")
323
333
 
324
334
 
325
335
  @cli.command(help="Install dependencies needed by workstations", hidden=True)
@@ -1,11 +1,12 @@
1
1
  import json
2
2
  import os
3
+ from os import path
3
4
 
4
5
 
5
6
  def init_config():
6
7
  # Read configuration from $METAFLOW_HOME/config_<profile>.json.
7
8
  home = os.environ.get("METAFLOW_HOME", "~/.metaflowconfig")
8
- profile = os.environ.get("METAFLOW_PROFILE")
9
+ profile = get_metaflow_profile()
9
10
  path_to_config = os.path.join(home, "config.json")
10
11
  if profile:
11
12
  path_to_config = os.path.join(home, "config_%s.json" % profile)
@@ -21,6 +22,35 @@ def init_config():
21
22
  return config
22
23
 
23
24
 
25
+ def get_metaflow_profile():
26
+ # If OBP_CONFIG_DIR is set, use that, otherwise use METAFLOW_HOME
27
+ # If neither are set, use ~/.metaflowconfig
28
+ obp_config_dir = path.expanduser(
29
+ os.environ.get(
30
+ "OBP_CONFIG_DIR", os.environ.get("METAFLOW_HOME", "~/.metaflowconfig")
31
+ )
32
+ )
33
+
34
+ file_path = os.path.join(obp_config_dir, "ob_config.json")
35
+
36
+ if os.path.exists(file_path):
37
+ with open(file_path, "r") as f:
38
+ ob_config = json.loads(f.read())
39
+
40
+ if "OB_CURRENT_PERIMETER" in ob_config:
41
+ return ob_config["OB_CURRENT_PERIMETER"]
42
+ else:
43
+ raise Exception(f"OB_CURRENT_PERIMETER not found in {file_path}")
44
+ elif "OBP_CONFIG_DIR" in os.environ:
45
+ raise Exception(
46
+ "OBP_CONFIG_DIR is set, but no ob_config.json found in that directory"
47
+ )
48
+ elif "METAFLOW_PROFILE" in os.environ:
49
+ return os.environ["METAFLOW_PROFILE"]
50
+
51
+ return ""
52
+
53
+
24
54
  def get_metaflow_token_from_config(config_dir: str, profile: str) -> str:
25
55
  """
26
56
  Return the Metaflow service auth key from the config file.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: outerbounds
3
- Version: 0.3.52rc0
3
+ Version: 0.3.52rc1
4
4
  Summary: More Data Science, Less Administration
5
5
  License: Proprietary
6
6
  Keywords: data science,machine learning,MLOps
@@ -3,12 +3,12 @@ outerbounds/cli_main.py,sha256=e9UMnPysmc7gbrimq2I4KfltggyU7pw59Cn9aEguVcU,74
3
3
  outerbounds/command_groups/__init__.py,sha256=QPWtj5wDRTINDxVUL7XPqG3HoxHNvYOg08EnuSZB2Hc,21
4
4
  outerbounds/command_groups/cli.py,sha256=61VsBlPG2ykP_786eCyllqeM8DMhPAOfj2FhktrSd7k,207
5
5
  outerbounds/command_groups/local_setup_cli.py,sha256=HOTvOlb22cF86QmDpdQc6UVx4gFa2hBzsM8qI7Yj6vY,41486
6
- outerbounds/command_groups/workstations_cli.py,sha256=VgydQzCas3mlAFyzZuanjl1E8Zh7pBrbKbbP6t6N2WU,18237
6
+ outerbounds/command_groups/workstations_cli.py,sha256=rV8_DlF7coEmJ84VLEtqo6-HyY3ALAyU_ig6Cy-8npk,18605
7
7
  outerbounds/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  outerbounds/utils/kubeconfig.py,sha256=l1mUP1j9VIq3fsffi5bJ1Nk-hYlwd1dIqkpj7DvVS1E,7936
9
- outerbounds/utils/metaflowconfig.py,sha256=zdSeZEc1h4yJAZUrfWIO9EYSy84wdE_JCSEiCxb-su8,2341
9
+ outerbounds/utils/metaflowconfig.py,sha256=_Khqzu0KE6X05KkVbb39GXN6CFpG2WRr6Xs35pT2l7A,3299
10
10
  outerbounds/utils/schema.py,sha256=4_ONlvZGpBb51KKd-q6mNSKWI9P1huOKafrsf9kVqp8,2152
11
- outerbounds-0.3.52rc0.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
12
- outerbounds-0.3.52rc0.dist-info/entry_points.txt,sha256=7ye0281PKlvqxu15rjw60zKg2pMsXI49_A8BmGqIqBw,47
13
- outerbounds-0.3.52rc0.dist-info/METADATA,sha256=xkqrbbaDvrjERYy5fZ0kqk8Y_TEGneAjF5H0e6-uiNs,1148
14
- outerbounds-0.3.52rc0.dist-info/RECORD,,
11
+ outerbounds-0.3.52rc1.dist-info/METADATA,sha256=H7kYM9NyYPvO2csoZeCGTlN-tVOxiRJG4UBYvIsRJAg,1148
12
+ outerbounds-0.3.52rc1.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
13
+ outerbounds-0.3.52rc1.dist-info/entry_points.txt,sha256=7ye0281PKlvqxu15rjw60zKg2pMsXI49_A8BmGqIqBw,47
14
+ outerbounds-0.3.52rc1.dist-info/RECORD,,