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

Update typeservice to V3 #2924

Merged
merged 6 commits into from
Sep 26, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-v3-conf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add `v3` to the types service, and at it to the Services page. No change to environment required.
4 changes: 3 additions & 1 deletion context/app/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ def get_vitessce_conf_cells_and_lifted_uuid(self, entity, marker=None, wrap_erro
else:
try:
def get_assay(name):
type_client = TypeClient(current_app.config["TYPE_SERVICE_ENDPOINT"])
type_client = TypeClient(
current_app.config["TYPE_SERVICE_ENDPOINT"]
+ current_app.config["TYPE_SERVICE_PATH"])
return type_client.getAssayType(name)
Builder = get_view_config_builder(entity=entity, get_assay=get_assay)
builder = Builder(entity, self.groups_token, current_app.config["ASSETS_ENDPOINT"])
Expand Down
12 changes: 11 additions & 1 deletion context/app/default_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from datetime import timedelta


# By keeping this in code rather than configuration,
# we can atomically release changes that uses new service features,
# rather than requiring backward compatibility from new API versions.
version = 'v3'


class DefaultConfig(object):
# This should be updated when app.conf is updated:
# Test runs will only see this config and not app.conf.
Expand All @@ -12,7 +18,10 @@ class DefaultConfig(object):
PERMANENT_SESSION_LIFETIME = timedelta(minutes=60)
SESSION_COOKIE_SAMESITE = 'Lax'

PORTAL_INDEX_PATH = '/v3/portal/search'
# These app-wide configurations do not vary between environments:

TYPE_SERVICE_PATH = f'/{version}'
PORTAL_INDEX_PATH = f'/{version}/portal/search'
CCF_INDEX_PATH = '/entities/search'

# Everything else should be overridden in app.conf:
Expand All @@ -23,6 +32,7 @@ class DefaultConfig(object):

GATEWAY_ENDPOINT = 'should-be-overridden'
ELASTICSEARCH_ENDPOINT = 'should-be-overridden'
TYPE_SERVICE_ENDPOINT = 'should-be-overridden'
ASSETS_ENDPOINT = 'should-be-overridden'
XMODALITY_ENDPOINT = 'should-be-overridden'
WORKSPACES_ENDPOINT = 'should-be-overridden'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function ServiceStatusTable({
entityEndpoint,
gatewayEndpoint,
workspacesEndpoint,
typeServiceEndpoint,
}) {
const gatewayStatus = useGatewayStatus(`${gatewayEndpoint}/status.json`);

Expand Down Expand Up @@ -85,6 +86,13 @@ function ServiceStatusTable({
response: gatewayStatus.search_api,
noteFunction: (api) => `ES: ${api.elasticsearch_connection}; ES Status: ${api.elasticsearch_status}`,
}),
buildServiceStatus({
apiName: 'type-api',
githubUrl: 'https://github.com/dbmi-pitt/search-adaptor',
endpointUrl: typeServiceEndpoint,
response: gatewayStatus.search_api,
noteFunction: () => 'Included in search-api for historical reasons.',
}),
buildServiceStatus({
apiName: 'uuid-api',
response: gatewayStatus.uuid_api,
Expand Down
2 changes: 2 additions & 0 deletions context/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def get_default_flask_data():
'gatewayEndpoint': current_app.config['GATEWAY_ENDPOINT'],
'elasticsearchEndpoint': current_app.config['ELASTICSEARCH_ENDPOINT']
+ current_app.config['PORTAL_INDEX_PATH'],
'typeServiceEndpoint': current_app.config['TYPE_SERVICE_ENDPOINT']
+ current_app.config['TYPE_SERVICE_PATH'],
'assetsEndpoint': current_app.config['ASSETS_ENDPOINT'],
'entityEndpoint': current_app.config['ENTITY_API_BASE'],
'xmodalityEndpoint': current_app.config['XMODALITY_ENDPOINT'],
Expand Down