outerbounds 0.8.2__py3-none-any.whl → 0.8.3__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.
- outerbounds/command_groups/workstations_cli.py +29 -10
- {outerbounds-0.8.2.dist-info → outerbounds-0.8.3.dist-info}/METADATA +2 -2
- {outerbounds-0.8.2.dist-info → outerbounds-0.8.3.dist-info}/RECORD +5 -5
- {outerbounds-0.8.2.dist-info → outerbounds-0.8.3.dist-info}/WHEEL +0 -0
- {outerbounds-0.8.2.dist-info → outerbounds-0.8.3.dist-info}/entry_points.txt +0 -0
@@ -652,20 +652,38 @@ def prepare_for_ssh_access(
|
|
652
652
|
except Exception as e:
|
653
653
|
response["message"] = str(e)
|
654
654
|
response["status"] = "FAIL"
|
655
|
-
if output == "json":
|
656
|
-
click.echo(json.dumps(response, indent=4))
|
657
|
-
else:
|
658
|
-
click.secho(f"Failed to prepare for SSH access: {str(e)}", fg="red")
|
659
|
-
click.secho("Error: {}".format(str(e)), fg="red")
|
660
655
|
|
661
656
|
if output == "json":
|
662
657
|
click.echo(json.dumps(response, indent=4))
|
663
658
|
else:
|
659
|
+
colors = {"OK": "green", "FAIL": "red"}
|
660
|
+
message = {"OK": "", "FAIL": f'\nError: {response["message"]}'}
|
661
|
+
|
664
662
|
click.secho(
|
665
|
-
f"SSH access
|
663
|
+
f"SSH access setup status: {response['status']}. {message[response['status']]}",
|
664
|
+
fg=colors[response["status"]],
|
666
665
|
)
|
667
666
|
|
668
667
|
|
668
|
+
def get_workstation_namespace(workstation_id: str) -> str:
|
669
|
+
profile = ""
|
670
|
+
config_dir = os.getenv("METAFLOW_HOME", os.path.expanduser("~/.metaflowconfig"))
|
671
|
+
metaflow_token = metaflowconfig.get_metaflow_token_from_config(config_dir, profile)
|
672
|
+
api_url = metaflowconfig.get_sanitized_url_from_config(
|
673
|
+
config_dir, profile, "OBP_API_SERVER"
|
674
|
+
)
|
675
|
+
workstations_response = requests.get(
|
676
|
+
f"{api_url}/v1/workstations", headers={"x-api-key": metaflow_token}
|
677
|
+
)
|
678
|
+
workstations_response.raise_for_status()
|
679
|
+
|
680
|
+
for workstation in workstations_response.json()["workstations"]:
|
681
|
+
if workstation["instance_id"] == workstation_id:
|
682
|
+
return workstation["kubernetes_metadata"]["workstation_pod_namespace"]
|
683
|
+
|
684
|
+
raise Exception(f"Workstation {workstation_id} not found")
|
685
|
+
|
686
|
+
|
669
687
|
def prepare_for_ssh_access_local(workstation_id):
|
670
688
|
"""
|
671
689
|
SSH connection requires both local instance and workstation pod to do some work.
|
@@ -677,13 +695,14 @@ def prepare_for_ssh_access_local(workstation_id):
|
|
677
695
|
4. Ensures that the SSH config is setup with the right parameters.
|
678
696
|
"""
|
679
697
|
pod_name = f"{workstation_id}-0"
|
698
|
+
ws_namespace = get_workstation_namespace(workstation_id)
|
680
699
|
|
681
700
|
private_key_path, public_key_path = ssh_utils.create_ssh_key_pair()
|
682
701
|
|
683
702
|
# Create the .ssh directory if it doesn't exist
|
684
703
|
result, stdout, stderr = exec_in_pod(
|
685
704
|
pod_name,
|
686
|
-
|
705
|
+
ws_namespace,
|
687
706
|
"mkdir -p /home/ob-workspace/.ssh",
|
688
707
|
)
|
689
708
|
if result != 0:
|
@@ -692,7 +711,7 @@ def prepare_for_ssh_access_local(workstation_id):
|
|
692
711
|
# Copy the public key to the workstation
|
693
712
|
result, stdout, stderr = cp_to_pod(
|
694
713
|
pod_name,
|
695
|
-
|
714
|
+
ws_namespace,
|
696
715
|
public_key_path,
|
697
716
|
f"/home/ob-workspace/.ssh/{ssh_utils.EXPECTED_PUBLIC_KEY_NAME}",
|
698
717
|
)
|
@@ -702,7 +721,7 @@ def prepare_for_ssh_access_local(workstation_id):
|
|
702
721
|
# 4. Exec into the pod
|
703
722
|
result, stdout, stderr = exec_in_pod(
|
704
723
|
pod_name,
|
705
|
-
|
724
|
+
ws_namespace,
|
706
725
|
"outerbounds prepare-for-ssh-access -c remote",
|
707
726
|
)
|
708
727
|
if result != 0:
|
@@ -710,7 +729,7 @@ def prepare_for_ssh_access_local(workstation_id):
|
|
710
729
|
|
711
730
|
# 5. Add the entry to the ssh config file
|
712
731
|
ok, msg = ssh_utils.add_entry_to_ssh_config(
|
713
|
-
workstation_id,
|
732
|
+
workstation_id, ws_namespace, private_key_path
|
714
733
|
)
|
715
734
|
if not ok:
|
716
735
|
raise Exception(f"Failed to add entry to ssh config: {msg}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: outerbounds
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.3
|
4
4
|
Summary: More Data Science, Less Administration
|
5
5
|
License: Proprietary
|
6
6
|
Keywords: data science,machine learning,MLOps
|
@@ -30,7 +30,7 @@ Requires-Dist: google-cloud-storage (>=2.14.0,<3.0.0) ; extra == "gcp"
|
|
30
30
|
Requires-Dist: metaflow_checkpoint (==0.2.4)
|
31
31
|
Requires-Dist: ob-metaflow (==2.17.1.0)
|
32
32
|
Requires-Dist: ob-metaflow-extensions (==1.4.8)
|
33
|
-
Requires-Dist: ob-metaflow-stubs (==6.0.8.
|
33
|
+
Requires-Dist: ob-metaflow-stubs (==6.0.8.3)
|
34
34
|
Requires-Dist: ob-project-utils (==0.1.35)
|
35
35
|
Requires-Dist: opentelemetry-distro (>=0.41b0) ; extra == "otel"
|
36
36
|
Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.20.0) ; extra == "otel"
|
@@ -51,7 +51,7 @@ outerbounds/command_groups/local_setup_cli.py,sha256=tuuqJRXQ_guEwOuQSIf9wkUU0yg
|
|
51
51
|
outerbounds/command_groups/perimeters_cli.py,sha256=iF_Uw7ROiSctf6FgoJEy30iDBLVE1j9FKuR3shgJRmc,19050
|
52
52
|
outerbounds/command_groups/secrets_cli.py,sha256=Vgn_aiTo76a0s5hCJhNWEOrCVhyYeivD08ooQxz0y7c,2952
|
53
53
|
outerbounds/command_groups/tutorials_cli.py,sha256=UInFyiMqtscHFfi8YQwiY_6Sdw9quJOtRu5OukEBccw,3522
|
54
|
-
outerbounds/command_groups/workstations_cli.py,sha256
|
54
|
+
outerbounds/command_groups/workstations_cli.py,sha256=W3OFmInYUfd7Gl3baXIIleZWx6NI3bSeXAqCZ-uvYfA,27901
|
55
55
|
outerbounds/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
56
56
|
outerbounds/utils/kubeconfig.py,sha256=yvcyRXGR4AhQuqUDqmbGxEOHw5ixMFV0AZIDg1LI_Qo,7981
|
57
57
|
outerbounds/utils/kubectl_utils.py,sha256=YxiUVDfXTW7FDpCj639f9upkJNGPf2WuQTjUaBOzX5Q,1926
|
@@ -60,7 +60,7 @@ outerbounds/utils/schema.py,sha256=lMUr9kNgn9wy-sO_t_Tlxmbt63yLeN4b0xQXbDUDj4A,2
|
|
60
60
|
outerbounds/utils/ssh_utils.py,sha256=MRJ7Oy0M7Lqqs397JDJczTYvxvyHJ_XvBdjt4ZYKaPE,19599
|
61
61
|
outerbounds/utils/utils.py,sha256=4Z8cszNob_8kDYCLNTrP-wWads_S_MdL3Uj3ju4mEsk,501
|
62
62
|
outerbounds/vendor.py,sha256=gRLRJNXtZBeUpPEog0LOeIsl6GosaFFbCxUvR4bW6IQ,5093
|
63
|
-
outerbounds-0.8.
|
64
|
-
outerbounds-0.8.
|
65
|
-
outerbounds-0.8.
|
66
|
-
outerbounds-0.8.
|
63
|
+
outerbounds-0.8.3.dist-info/METADATA,sha256=qIJMOGyqaVJ3gdseQAytStZwnAniPyWMiUiuJfrvJNo,1873
|
64
|
+
outerbounds-0.8.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
65
|
+
outerbounds-0.8.3.dist-info/entry_points.txt,sha256=AP6rZg7y5SK9e9a9iVq0Fi9Q2KPjPZSwtZ6R98rLw-8,56
|
66
|
+
outerbounds-0.8.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|