|
18 | 18 | from dstack._internal.core.models.files import FileArchiveMapping |
19 | 19 | from dstack._internal.core.models.instances import ( |
20 | 20 | InstanceStatus, |
21 | | - RemoteConnectionInfo, |
22 | 21 | SSHConnectionParams, |
23 | 22 | ) |
24 | 23 | from dstack._internal.core.models.metrics import Metric |
|
54 | 53 | from dstack._internal.server.services import events, services |
55 | 54 | from dstack._internal.server.services import files as files_services |
56 | 55 | from dstack._internal.server.services import logs as logs_services |
57 | | -from dstack._internal.server.services.instances import get_instance_ssh_private_keys |
| 56 | +from dstack._internal.server.services.instances import ( |
| 57 | + get_instance_remote_connection_info, |
| 58 | + get_instance_ssh_private_keys, |
| 59 | +) |
58 | 60 | from dstack._internal.server.services.jobs import ( |
59 | 61 | find_job, |
60 | 62 | get_job_attached_volumes, |
@@ -870,14 +872,11 @@ async def _maybe_register_replica( |
870 | 872 | ssh_head_proxy: Optional[SSHConnectionParams] = None |
871 | 873 | ssh_head_proxy_private_key: Optional[str] = None |
872 | 874 | instance = common_utils.get_or_error(job_model.instance) |
873 | | - if instance.remote_connection_info is not None: |
874 | | - rci: RemoteConnectionInfo = RemoteConnectionInfo.__response__.parse_raw( |
875 | | - instance.remote_connection_info |
876 | | - ) |
877 | | - if rci.ssh_proxy is not None: |
878 | | - ssh_head_proxy = rci.ssh_proxy |
879 | | - ssh_head_proxy_keys = common_utils.get_or_error(rci.ssh_proxy_keys) |
880 | | - ssh_head_proxy_private_key = ssh_head_proxy_keys[0].private |
| 875 | + rci = get_instance_remote_connection_info(instance) |
| 876 | + if rci is not None and rci.ssh_proxy is not None: |
| 877 | + ssh_head_proxy = rci.ssh_proxy |
| 878 | + ssh_head_proxy_keys = common_utils.get_or_error(rci.ssh_proxy_keys) |
| 879 | + ssh_head_proxy_private_key = ssh_head_proxy_keys[0].private |
881 | 880 | try: |
882 | 881 | await services.register_replica( |
883 | 882 | session, |
@@ -1090,9 +1089,8 @@ def _submit_job_to_runner( |
1090 | 1089 | None if repo_credentials is None else repo_credentials.clone_url, |
1091 | 1090 | ) |
1092 | 1091 | instance = job_model.instance |
1093 | | - if instance is not None and instance.remote_connection_info is not None: |
1094 | | - remote_info = RemoteConnectionInfo.__response__.parse_raw(instance.remote_connection_info) |
1095 | | - instance_env = remote_info.env |
| 1092 | + if instance is not None and (rci := get_instance_remote_connection_info(instance)) is not None: |
| 1093 | + instance_env = rci.env |
1096 | 1094 | else: |
1097 | 1095 | instance_env = None |
1098 | 1096 |
|
|
0 commit comments