Skip to content

Commit d4acd67

Browse files
author
allegroai
committed
Fix connect to session created by SSH application
1 parent cee824d commit d4acd67

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

clearml_session/__main__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ def clone_task(state, project_id=None):
741741
return task
742742

743743

744-
def wait_for_machine(state, task):
744+
def wait_for_machine(state, task, only_wait_for_ssh=False):
745745
# wait until task is running
746746
print('Waiting for remote machine allocation [id={}]'.format(task.id))
747747
last_status = None
@@ -781,9 +781,9 @@ def wait_for_machine(state, task):
781781
state['vscode_server'] = vscode_server.strip().lower() != 'false'
782782

783783
wait_properties = ['properties/internal_ssh_port']
784-
if state.get('jupyter_lab'):
784+
if state.get('jupyter_lab') and not only_wait_for_ssh:
785785
wait_properties += ['properties/jupyter_port']
786-
if state.get('vscode_server'):
786+
if state.get('vscode_server') and not only_wait_for_ssh:
787787
wait_properties += ['properties/vscode_port']
788788

789789
last_lines = []
@@ -1467,6 +1467,7 @@ def cli():
14671467
task = _get_previous_session(client, args, state, task_id=args.attach)
14681468

14691469
delete_old_tasks_callback = None
1470+
only_wait_for_ssh = False
14701471

14711472
if task:
14721473
state['task_id'] = task.id
@@ -1475,6 +1476,7 @@ def cli():
14751476
state['username'] = args.username
14761477
if args.password:
14771478
state['password'] = args.password
1479+
only_wait_for_ssh = True
14781480
else:
14791481
state.pop('task_id', None)
14801482
save_state(state, state_file)
@@ -1511,7 +1513,7 @@ def cli():
15111513

15121514
# wait for machine to become available
15131515
try:
1514-
wait_for_machine(state, task)
1516+
wait_for_machine(state, task, only_wait_for_ssh=only_wait_for_ssh)
15151517
except ValueError as ex:
15161518
print('\nERROR: {}'.format(ex))
15171519
return 1

clearml_session/interactive_session_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def init_task(param, a_default_ssh_fingerprint):
132132
except (TypeError, ValueError):
133133
a_default_ssh_fingerprint.clear()
134134
a_default_ssh_fingerprint.update(old_default_ssh_fingerprint)
135-
if param.get('default_docker'):
135+
if param.get('default_docker') and task.running_locally():
136136
task.set_base_docker("{} --network host".format(param['default_docker']))
137137
# leave local process, only run remotely
138138
task.execute_remotely()

0 commit comments

Comments
 (0)