outerbounds 0.3.52rc1__py3-none-any.whl → 0.3.52rc4__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,28 +1,28 @@
1
- from base64 import b64decode, b64encode
2
- from importlib.machinery import PathFinder
3
- from os import path
4
- from pathlib import Path
1
+ import base64
2
+ import hashlib
5
3
  import json
6
4
  import os
7
5
  import re
6
+ import subprocess
8
7
  import sys
9
8
  import zlib
10
- from typing import Dict, Any
9
+ from base64 import b64decode, b64encode
10
+ from importlib.machinery import PathFinder
11
+ from os import path
12
+ from pathlib import Path
13
+ from typing import Any, Callable, Dict, List
11
14
 
12
15
  import boto3
13
16
  import click
14
- import subprocess
17
+ import requests
18
+ from requests.exceptions import HTTPError
19
+
15
20
  from ..utils import kubeconfig, metaflowconfig
16
21
  from ..utils.schema import (
17
- OuterboundsCommandResponse,
18
22
  CommandStatus,
23
+ OuterboundsCommandResponse,
19
24
  OuterboundsCommandStatus,
20
25
  )
21
- import requests
22
- from requests.exceptions import HTTPError
23
- import hashlib
24
- import base64
25
- from typing import Callable, List
26
26
 
27
27
  NO_METAFLOW_INSTALL_MESSAGE = "Resolution of 'metaflow' module succeeded but no Metaflow installation was detected."
28
28
 
@@ -592,7 +592,15 @@ class ConfigurationWriter:
592
592
  def process_decoded_config(self):
593
593
  config_type = self.decoded_config.get("OB_CONFIG_TYPE", "inline")
594
594
  if config_type == "inline":
595
- return
595
+ if "OBP_METAFLOW_CONFIG_URL" in self.decoded_config:
596
+ self.decoded_config = {
597
+ "OBP_METAFLOW_CONFIG_URL": self.decoded_config[
598
+ "OBP_METAFLOW_CONFIG_URL"
599
+ ],
600
+ "METAFLOW_SERVICE_AUTH_KEY": self.decoded_config[
601
+ "METAFLOW_SERVICE_AUTH_KEY"
602
+ ],
603
+ }
596
604
  elif config_type == "aws-secrets-manager":
597
605
  try:
598
606
  secret_arn = self.decoded_config["AWS_SECRETS_MANAGER_SECRET_ARN"]
@@ -607,7 +615,7 @@ class ConfigurationWriter:
607
615
  self.decoded_config = json.loads(response["SecretBinary"])
608
616
  except Exception as e:
609
617
  raise DecodedConfigProcessingError(
610
- f"Failed to retrieve secret {secret_arn}\n\n{str(e)}"
618
+ f"Failed to retrieve secret {secret_arn}\n\n{str(e)} from AWS Secrets Manager"
611
619
  )
612
620
  else:
613
621
  raise DecodedConfigProcessingError(f"Unknown config type: {config_type}")
@@ -759,9 +767,7 @@ def configure(
759
767
  try:
760
768
  writer.process_decoded_config()
761
769
  except DecodedConfigProcessingError as e:
762
- click.secho(
763
- "Resolving the configuration from AWS Secrets Manager failed.", fg="red"
764
- )
770
+ click.secho("Resolving the configuration remotely failed.", fg="red")
765
771
  click.secho(str(e), fg="magenta")
766
772
  sys.exit(1)
767
773
  try:
@@ -799,22 +805,6 @@ def switch_perimeter(output="", id=None, force=False):
799
805
  "Perimeter was successfully switched!",
800
806
  )
801
807
 
802
- if "WORKSTATION_ID" not in os.environ:
803
- click.secho(
804
- "outerbounds switch-perimeter is only supported on workstations.",
805
- fg="red",
806
- err=True,
807
- )
808
- switch_perimeter_step.update(
809
- status=OuterboundsCommandStatus.FAIL,
810
- reason="outerbounds switch-perimeter is only supported on workstations.",
811
- mitigation="",
812
- )
813
- switch_perimeter_response.add_step(switch_perimeter_step)
814
- if output == "json":
815
- click.echo(json.dumps(switch_perimeter_response.as_dict(), indent=4))
816
- return
817
-
818
808
  metaflow_home_dir = path.expanduser(
819
809
  os.environ.get("METAFLOW_HOME", "~/.metaflowconfig")
820
810
  )
@@ -875,6 +865,7 @@ def switch_perimeter(output="", id=None, force=False):
875
865
  click.secho(
876
866
  "Force flag is set. Perimeter will be switched, but can have unintended consequences on other running processes.",
877
867
  fg="yellow",
868
+ err=True,
878
869
  )
879
870
 
880
871
  ob_config_dict = {"OB_CURRENT_PERIMETER": id}
@@ -883,9 +874,12 @@ def switch_perimeter(output="", id=None, force=False):
883
874
  with os.fdopen(fd, "w") as file:
884
875
  json.dump(ob_config_dict, file, indent=4)
885
876
 
886
- click.secho("Perimeter switched to {}".format(id), fg="green")
877
+ click.secho("Perimeter switched to {}".format(id), fg="green", err=True)
887
878
  except BlockingIOError:
888
879
  # This exception is raised if the file is already locked (non-blocking mode)
880
+ # Note that its the metaflow package (the extension actually) that acquires a shared read lock
881
+ # on the file whenever a process imports metaflow.
882
+ # In the future we might want to get smarter about it and show which process is holding the lock.
889
883
  click.secho(
890
884
  "Can't switch perimeter while Metaflow is in use. Please make sure there are no running python processes or notebooks using metaflow.",
891
885
  fg="red",
@@ -920,22 +914,6 @@ def show_current_perimeter(output=""):
920
914
  "Current Perimeter Fetch Successful.",
921
915
  )
922
916
 
923
- if "WORKSTATION_ID" not in os.environ:
924
- click.secho(
925
- "outerbounds switch-perimeter is only supported on workstations.",
926
- fg="red",
927
- err=True,
928
- )
929
- show_current_perimeter_step.update(
930
- status=OuterboundsCommandStatus.FAIL,
931
- reason="outerbounds show-current-perimeter is only supported on workstations.",
932
- mitigation="",
933
- )
934
- show_current_perimeter_response.add_step(show_current_perimeter_step)
935
- if output == "json":
936
- click.echo(json.dumps(show_current_perimeter_response.as_dict(), indent=4))
937
- return
938
-
939
917
  metaflow_home_dir = path.expanduser(
940
918
  os.environ.get("METAFLOW_HOME", "~/.metaflowconfig")
941
919
  )
@@ -994,6 +972,7 @@ def show_current_perimeter(output=""):
994
972
  click.secho(
995
973
  "Current Perimeter: {}".format(ob_config_dict["OB_CURRENT_PERIMETER"]),
996
974
  fg="green",
975
+ err=True,
997
976
  )
998
977
  show_current_perimeter_response.add_or_update_data(
999
978
  "current_perimeter", ob_config_dict["OB_CURRENT_PERIMETER"]
@@ -1037,22 +1016,6 @@ def list_perimeters(output=""):
1037
1016
  "ListPerimeters", OuterboundsCommandStatus.OK, "Perimeter Fetch Successful."
1038
1017
  )
1039
1018
 
1040
- if "WORKSTATION_ID" not in os.environ:
1041
- click.secho(
1042
- "outerbounds list-perimeters is only supported on workstations.",
1043
- fg="red",
1044
- err=True,
1045
- )
1046
- list_perimeters_step.update(
1047
- status=OuterboundsCommandStatus.FAIL,
1048
- reason="outerbounds list-perimeters is only supported on workstations.",
1049
- mitigation="",
1050
- )
1051
- list_perimeters_response.add_step(list_perimeters_step)
1052
- if output == "json":
1053
- click.echo(json.dumps(list_perimeters_response.as_dict(), indent=4))
1054
- return
1055
-
1056
1019
  metaflow_home_dir = path.expanduser(
1057
1020
  os.environ.get("METAFLOW_HOME", "~/.metaflowconfig")
1058
1021
  )
@@ -1128,8 +1091,12 @@ def list_perimeters(output=""):
1128
1091
  ),
1129
1092
  )
1130
1093
  list_perimeters_response.add_step(list_perimeters_step)
1094
+ if output == "json":
1095
+ click.echo(json.dumps(list_perimeters_response.as_dict(), indent=4))
1131
1096
  return
1132
1097
 
1098
+ click.secho("Perimeter: {} (active)".format(active_perimeter), fg="green", err=True)
1099
+
1133
1100
  perimeter_list = []
1134
1101
  for file in os.listdir(metaflow_home_dir):
1135
1102
  if file.startswith("config_") and file.endswith(".json"):
@@ -1138,6 +1105,10 @@ def list_perimeters(output=""):
1138
1105
  {"id": perimeter_id, "active": perimeter_id == active_perimeter}
1139
1106
  )
1140
1107
 
1108
+ if perimeter_id != active_perimeter:
1109
+ click.secho("Perimeter: {}".format(perimeter_id), err=True)
1110
+
1141
1111
  list_perimeters_response.add_or_update_data("perimeters", perimeter_list)
1112
+
1142
1113
  if output == "json":
1143
1114
  click.echo(json.dumps(list_perimeters_response.as_dict(), indent=4))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: outerbounds
3
- Version: 0.3.52rc1
3
+ Version: 0.3.52rc4
4
4
  Summary: More Data Science, Less Administration
5
5
  License: Proprietary
6
6
  Keywords: data science,machine learning,MLOps
@@ -14,13 +14,17 @@ Classifier: Programming Language :: Python :: 3.9
14
14
  Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Provides-Extra: azure
17
+ Provides-Extra: gcp
17
18
  Requires-Dist: PyYAML (>=6.0,<7.0)
18
19
  Requires-Dist: azure-identity (>=1.15.0,<2.0.0) ; extra == "azure"
19
20
  Requires-Dist: azure-storage-blob (>=12.9.0,<13.0.0) ; extra == "azure"
20
21
  Requires-Dist: boto3
21
22
  Requires-Dist: click (>=8.1.3,<9.0.0)
22
- Requires-Dist: ob-metaflow (==2.11.0.3)
23
- Requires-Dist: ob-metaflow-extensions (==1.1.42rc0)
23
+ Requires-Dist: google-api-core (>=2.16.1,<3.0.0) ; extra == "gcp"
24
+ Requires-Dist: google-auth (>=2.27.0,<3.0.0) ; extra == "gcp"
25
+ Requires-Dist: google-cloud-storage (>=2.14.0,<3.0.0) ; extra == "gcp"
26
+ Requires-Dist: ob-metaflow (==2.11.0.4)
27
+ Requires-Dist: ob-metaflow-extensions (==1.1.42rc1)
24
28
  Requires-Dist: opentelemetry-distro (==0.41b0)
25
29
  Requires-Dist: opentelemetry-exporter-otlp-proto-http (==1.20.0)
26
30
  Requires-Dist: opentelemetry-instrumentation-requests (==0.41b0)
@@ -2,13 +2,13 @@ outerbounds/__init__.py,sha256=GPdaubvAYF8pOFWJ3b-sPMKCpyfpteWVMZWkmaYhxRw,32
2
2
  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
- outerbounds/command_groups/local_setup_cli.py,sha256=HOTvOlb22cF86QmDpdQc6UVx4gFa2hBzsM8qI7Yj6vY,41486
5
+ outerbounds/command_groups/local_setup_cli.py,sha256=fHZJTFJJO49X0_uhAmDwyOMtvOZVlbMxAF9iLs8euwo,40672
6
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
9
  outerbounds/utils/metaflowconfig.py,sha256=_Khqzu0KE6X05KkVbb39GXN6CFpG2WRr6Xs35pT2l7A,3299
10
10
  outerbounds/utils/schema.py,sha256=4_ONlvZGpBb51KKd-q6mNSKWI9P1huOKafrsf9kVqp8,2152
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,,
11
+ outerbounds-0.3.52rc4.dist-info/METADATA,sha256=LJHnhTVbFMczpzkSvjtj1YsPo70s2jnxDCuEy-tJLf4,1367
12
+ outerbounds-0.3.52rc4.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
13
+ outerbounds-0.3.52rc4.dist-info/entry_points.txt,sha256=7ye0281PKlvqxu15rjw60zKg2pMsXI49_A8BmGqIqBw,47
14
+ outerbounds-0.3.52rc4.dist-info/RECORD,,