Skip to content

Commit

Permalink
Merge branch 'master' into deploy-improve
Browse files Browse the repository at this point in the history
  • Loading branch information
shifucun authored May 23, 2024
2 parents 9a305b5 + a16b8c7 commit 87a31ce
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions nl_server/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,20 @@

bp = Blueprint('main', __name__, url_prefix='/')

#
# A global bool to ensure we keep failing healthz till we
# load the default embeddings fully on the server.
#
default_embeddings_loaded = False


@bp.route('/healthz')
def healthz():
global default_embeddings_loaded

if default_embeddings_loaded:
return 'OK', 200

default_index_type = current_app.config[
config.EMBEDDINGS_SPEC_KEY].default_index
if not default_index_type:
Expand All @@ -48,6 +59,7 @@ def healthz():
result: VarCandidates = search.search_vars([nl_embeddings],
[query]).get(query)
if result and result.svs:
default_embeddings_loaded = True
return 'OK', 200
else:
logging.warning(f'Health Check Failed: query "{query}" failed!')
Expand Down
4 changes: 2 additions & 2 deletions server/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="nav-about-dropdown">
<a class="dropdown-item" href="{{ url_for('static.about') }}">{% trans %}About Data Commons{% endtrans
%}</a>
<a class="dropdown-item" href="https://docs.datacommons.org/blog.html">{% trans %}Blog{% endtrans
<a class="dropdown-item" href="https://blog.datacommons.org/">{% trans %}Blog{% endtrans
%}</a>
<a class="dropdown-item" href="https://docs.datacommons.org/datasets/">{% trans %}Data Sources{%
endtrans %}</a>
Expand Down Expand Up @@ -223,7 +223,7 @@ <h6>{% trans %}Data Commons{% endtrans %}</h6>
{# TRANSLATORS: The label for a link to the project's about page. #}
<a href="{{ url_for('static.about') }}"><span class="material-icons-outlined">arrow_forward</span><span>{% trans %}About Data Commons{% endtrans %}</span></a>
{# TRANSLATORS: The label for a link to the project's blog. #}
<a href="https://docs.datacommons.org/blog.html"><span class="material-icons-outlined">arrow_forward</span><span>{% trans %}Blog{% endtrans %}</span></a>
<a href="https://blog.datacommons.org/"><span class="material-icons-outlined">arrow_forward</span><span>{% trans %}Blog{% endtrans %}</span></a>
{# TRANSLATORS: The label for a link to data sources included in the Data Commons knowledge graph. #}
<a href="https://docs.datacommons.org/datasets/"><span class="material-icons-outlined">arrow_forward</span><span>{% trans %}Data Sources{% endtrans %}</span></a>
{# TRANSLATORS: The label for a link to instructions about sending feedback. #}
Expand Down
4 changes: 2 additions & 2 deletions server/templates/custom_dc/stanford/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="nav-about-dropdown">
<a class="dropdown-item" href="{{ url_for('static.about') }}">{% trans %}About Data Commons{% endtrans
%}</a>
<a class="dropdown-item" href="https://docs.datacommons.org/blog.html">{% trans %}Blog{% endtrans
<a class="dropdown-item" href="https://blog.datacommons.org">{% trans %}Blog{% endtrans
%}</a>
<a class="dropdown-item" href="https://docs.datacommons.org/datasets/">{% trans %}Data Sources{%
endtrans %}</a>
Expand Down Expand Up @@ -206,7 +206,7 @@ <h6>{% trans %}Data Commons{% endtrans %}</h6>
{# TRANSLATORS: The label for a link to the project's about page. #}
<a href="{{ url_for('static.about') }}">{% trans %}About Data Commons{% endtrans %}</a>
{# TRANSLATORS: The label for a link to the project's blog. #}
<a href="https://docs.datacommons.org/blog.html">{% trans %}Blog{% endtrans %}</a>
<a href="https://blog.datacommons.org/">{% trans %}Blog{% endtrans %}</a>
{# TRANSLATORS: The label for a link to data sources included in the Data Commons knowledge graph. #}
<a href="https://docs.datacommons.org/datasets/">{% trans %}Data Sources{% endtrans %}</a>
{# TRANSLATORS: The label for a link to instructions about sending feedback. #}
Expand Down

0 comments on commit 87a31ce

Please sign in to comment.