Support clearml-init hosts detection for WebApp with no port (#1031)

Support clearml-init hosts detection for WebApp with no port and api/files hosts use the default ports.
This commit is contained in:
Paweł Kotiuk 2023-06-06 15:52:40 +02:00 committed by GitHub
parent 66061af1aa
commit 1ccdff5e77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,6 +237,12 @@ def parse_known_host(parsed_host):
api_host = parsed_host.scheme + "://" + parsed_host.netloc.replace(':8080', ':8008', 1) + parsed_host.path
web_host = parsed_host.scheme + "://" + parsed_host.netloc + parsed_host.path
files_host = parsed_host.scheme + "://" + parsed_host.netloc.replace(':8080', ':8081', 1) + parsed_host.path
elif parsed_host.port is None:
print('Web app hosted on standard port using ' + parsed_host.scheme + ' protocol.')
print('Assuming files and api ports are unchanged and use the same (' + parsed_host.scheme + ') protocol')
api_host = parsed_host.scheme + "://" + parsed_host.netloc + ':8008' + parsed_host.path
web_host = parsed_host.scheme + "://" + parsed_host.netloc + parsed_host.path
files_host = parsed_host.scheme + "://" + parsed_host.netloc+ ':8081' + parsed_host.path
else:
print("Warning! Could not parse host name")
api_host = ''