mirror of
https://github.com/clearml/clearml-agent
synced 2025-02-12 07:38:04 +00:00
Improve trains-agent config wizard
This commit is contained in:
parent
79babdd149
commit
bd73be928a
@ -78,20 +78,24 @@ def main():
|
|||||||
web_host = ''
|
web_host = ''
|
||||||
files_host = ''
|
files_host = ''
|
||||||
if not parsed_host.port:
|
if not parsed_host.port:
|
||||||
print('Host port not detected, do you wish to use the default 8008 port n/[y]? ', end='')
|
print('Host port not detected, do you wish to use the default 8080 port n/[y]? ', end='')
|
||||||
replace_port = input().lower()
|
replace_port = input().lower()
|
||||||
if not replace_port or replace_port == 'y' or replace_port == 'yes':
|
if not replace_port or replace_port == 'y' or replace_port == 'yes':
|
||||||
api_host = parsed_host.scheme + "://" + parsed_host.netloc + ':8008' + parsed_host.path
|
api_host = parsed_host.scheme + "://" + parsed_host.netloc + ':8008' + parsed_host.path
|
||||||
web_host = parsed_host.scheme + "://" + parsed_host.netloc + ':8080' + parsed_host.path
|
web_host = parsed_host.scheme + "://" + parsed_host.netloc + ':8080' + parsed_host.path
|
||||||
files_host = parsed_host.scheme + "://" + parsed_host.netloc + ':8081' + parsed_host.path
|
files_host = parsed_host.scheme + "://" + parsed_host.netloc + ':8081' + parsed_host.path
|
||||||
|
elif not replace_port or replace_port.lower() == 'n' or replace_port.lower() == 'no':
|
||||||
|
web_host = input_host_port("Web", parsed_host)
|
||||||
|
api_host = input_host_port("API", parsed_host)
|
||||||
|
files_host = input_host_port("Files", parsed_host)
|
||||||
if not api_host:
|
if not api_host:
|
||||||
api_host = parsed_host.scheme + "://" + parsed_host.netloc + parsed_host.path
|
api_host = parsed_host.scheme + "://" + parsed_host.netloc + parsed_host.path
|
||||||
|
|
||||||
api_host = input_url('API Host', api_host)
|
api_host = input_url('API Host', api_host)
|
||||||
files_host = input_url('File Store Host', files_host)
|
files_host = input_url('File Store Host', files_host)
|
||||||
|
|
||||||
print('\nTRAINS Hosts configuration:\nAPI: {}\nWeb App: {}\nFile Store: {}\n'.format(
|
print('\nTRAINS Hosts configuration:\nWeb App: {}\nAPI: {}\nFile Store: {}\n'.format(
|
||||||
api_host, web_host, files_host))
|
web_host, api_host, files_host))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
print(description.format(web_host), end='')
|
print(description.format(web_host), end='')
|
||||||
@ -188,12 +192,20 @@ def input_url(host_type, host=None):
|
|||||||
parse_input = input()
|
parse_input = input()
|
||||||
if host and (not parse_input or parse_input.lower() == 'yes' or parse_input.lower() == 'y'):
|
if host and (not parse_input or parse_input.lower() == 'yes' or parse_input.lower() == 'y'):
|
||||||
break
|
break
|
||||||
if parse_input and verify_url(parse_input):
|
parsed_host = verify_url(parse_input) if parse_input else None
|
||||||
host = parse_input
|
if parse_input and parsed_host:
|
||||||
|
host = parsed_host.scheme + "://" + parsed_host.netloc + parsed_host.path
|
||||||
break
|
break
|
||||||
return host
|
return host
|
||||||
|
|
||||||
|
|
||||||
|
def input_host_port(host_type, parsed_host):
|
||||||
|
print('Enter port for {} host '.format(host_type), end='')
|
||||||
|
replace_port = input().lower()
|
||||||
|
return parsed_host.scheme + "://" + parsed_host.netloc + (':{}'.format(replace_port) if replace_port else '') + \
|
||||||
|
parsed_host.path
|
||||||
|
|
||||||
|
|
||||||
def verify_url(parse_input):
|
def verify_url(parse_input):
|
||||||
try:
|
try:
|
||||||
if not parse_input.startswith('http://') and not parse_input.startswith('https://'):
|
if not parse_input.startswith('http://') and not parse_input.startswith('https://'):
|
||||||
|
Loading…
Reference in New Issue
Block a user