Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added notification message and exception for starting a non-configured endpoint #435

Merged
merged 1 commit into from Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions funcx_endpoint/funcx_endpoint/endpoint/endpoint.py
Expand Up @@ -90,6 +90,16 @@ def start_endpoint(
endpoint_uuid : str
"""
endpoint_dir = os.path.join(manager.funcx_dir, name)

if not os.path.exists(endpoint_dir):
msg = (f'\nEndpoint {name} is not configured!\n'
'1. Please create a configuration template with:\n'
f'\tfuncx-endpoint configure {name}\n'
'2. Update the configuration\n'
'3. Start the endpoint\n')
print(msg)
return

endpoint_config = SourceFileLoader('config',
os.path.join(endpoint_dir, manager.funcx_config_file_name)).load_module()
manager.start_endpoint(name, endpoint_uuid, endpoint_config)
Expand Down
8 changes: 0 additions & 8 deletions funcx_endpoint/funcx_endpoint/endpoint/endpoint_manager.py
Expand Up @@ -136,14 +136,6 @@ def start_endpoint(self, name, endpoint_uuid, endpoint_config):
endpoint_dir = os.path.join(self.funcx_dir, self.name)
endpoint_json = os.path.join(endpoint_dir, 'endpoint.json')

if not os.path.exists(endpoint_dir):
print(f'Endpoint {self.name} is not configured!')
print('1. Please create a configuration template with:')
print(f' funcx-endpoint configure {self.name}')
print('2. Update configuration')
print('3. Start the endpoint.')
return

# These certs need to be recreated for every registration
keys_dir = os.path.join(endpoint_dir, 'certificates')
os.makedirs(keys_dir, exist_ok=True)
Expand Down