mirror of
https://github.com/clearml/clearml-session
synced 2025-02-07 05:20:45 +00:00
Fix connect to session created by SSH application
This commit is contained in:
parent
cee824dd8f
commit
d4acd670bc
@ -741,7 +741,7 @@ def clone_task(state, project_id=None):
|
|||||||
return task
|
return task
|
||||||
|
|
||||||
|
|
||||||
def wait_for_machine(state, task):
|
def wait_for_machine(state, task, only_wait_for_ssh=False):
|
||||||
# wait until task is running
|
# wait until task is running
|
||||||
print('Waiting for remote machine allocation [id={}]'.format(task.id))
|
print('Waiting for remote machine allocation [id={}]'.format(task.id))
|
||||||
last_status = None
|
last_status = None
|
||||||
@ -781,9 +781,9 @@ def wait_for_machine(state, task):
|
|||||||
state['vscode_server'] = vscode_server.strip().lower() != 'false'
|
state['vscode_server'] = vscode_server.strip().lower() != 'false'
|
||||||
|
|
||||||
wait_properties = ['properties/internal_ssh_port']
|
wait_properties = ['properties/internal_ssh_port']
|
||||||
if state.get('jupyter_lab'):
|
if state.get('jupyter_lab') and not only_wait_for_ssh:
|
||||||
wait_properties += ['properties/jupyter_port']
|
wait_properties += ['properties/jupyter_port']
|
||||||
if state.get('vscode_server'):
|
if state.get('vscode_server') and not only_wait_for_ssh:
|
||||||
wait_properties += ['properties/vscode_port']
|
wait_properties += ['properties/vscode_port']
|
||||||
|
|
||||||
last_lines = []
|
last_lines = []
|
||||||
@ -1467,6 +1467,7 @@ def cli():
|
|||||||
task = _get_previous_session(client, args, state, task_id=args.attach)
|
task = _get_previous_session(client, args, state, task_id=args.attach)
|
||||||
|
|
||||||
delete_old_tasks_callback = None
|
delete_old_tasks_callback = None
|
||||||
|
only_wait_for_ssh = False
|
||||||
|
|
||||||
if task:
|
if task:
|
||||||
state['task_id'] = task.id
|
state['task_id'] = task.id
|
||||||
@ -1475,6 +1476,7 @@ def cli():
|
|||||||
state['username'] = args.username
|
state['username'] = args.username
|
||||||
if args.password:
|
if args.password:
|
||||||
state['password'] = args.password
|
state['password'] = args.password
|
||||||
|
only_wait_for_ssh = True
|
||||||
else:
|
else:
|
||||||
state.pop('task_id', None)
|
state.pop('task_id', None)
|
||||||
save_state(state, state_file)
|
save_state(state, state_file)
|
||||||
@ -1511,7 +1513,7 @@ def cli():
|
|||||||
|
|
||||||
# wait for machine to become available
|
# wait for machine to become available
|
||||||
try:
|
try:
|
||||||
wait_for_machine(state, task)
|
wait_for_machine(state, task, only_wait_for_ssh=only_wait_for_ssh)
|
||||||
except ValueError as ex:
|
except ValueError as ex:
|
||||||
print('\nERROR: {}'.format(ex))
|
print('\nERROR: {}'.format(ex))
|
||||||
return 1
|
return 1
|
||||||
|
@ -132,7 +132,7 @@ def init_task(param, a_default_ssh_fingerprint):
|
|||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
a_default_ssh_fingerprint.clear()
|
a_default_ssh_fingerprint.clear()
|
||||||
a_default_ssh_fingerprint.update(old_default_ssh_fingerprint)
|
a_default_ssh_fingerprint.update(old_default_ssh_fingerprint)
|
||||||
if param.get('default_docker'):
|
if param.get('default_docker') and task.running_locally():
|
||||||
task.set_base_docker("{} --network host".format(param['default_docker']))
|
task.set_base_docker("{} --network host".format(param['default_docker']))
|
||||||
# leave local process, only run remotely
|
# leave local process, only run remotely
|
||||||
task.execute_remotely()
|
task.execute_remotely()
|
||||||
|
Loading…
Reference in New Issue
Block a user