aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-03-29 20:51:45 -0700
committerBryan Newbold <bnewbold@archive.org>2021-03-29 20:51:45 -0700
commit30b93dc18464bd8c1675d8279d2cf7493ba24a12 (patch)
tree151b1150b1856e7142ece2b1c3602f7aeab29a76 /fatcat_scholar
parentfc6ebef14cf3398ac1664b9f585d6ed5e7caf609 (diff)
downloadfatcat-scholar-30b93dc18464bd8c1675d8279d2cf7493ba24a12.tar.gz
fatcat-scholar-30b93dc18464bd8c1675d8279d2cf7493ba24a12.zip
make fmt
Diffstat (limited to 'fatcat_scholar')
-rw-r--r--fatcat_scholar/kafka.py3
-rw-r--r--fatcat_scholar/search.py1
-rw-r--r--fatcat_scholar/web.py11
3 files changed, 12 insertions, 3 deletions
diff --git a/fatcat_scholar/kafka.py b/fatcat_scholar/kafka.py
index bee2fee..f412f8a 100644
--- a/fatcat_scholar/kafka.py
+++ b/fatcat_scholar/kafka.py
@@ -103,8 +103,7 @@ class KafkaWorker:
# check for partition-specific commit errors
if p.error:
print(
- f"Kafka consumer commit error: {p.error}",
- file=sys.stderr,
+ f"Kafka consumer commit error: {p.error}", file=sys.stderr,
)
raise KafkaException(p.error)
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py
index 026c030..2ae0ba9 100644
--- a/fatcat_scholar/search.py
+++ b/fatcat_scholar/search.py
@@ -416,6 +416,7 @@ def do_fulltext_search(
results=results,
)
+
def es_scholar_index_exists() -> bool:
"""
Checks if the configured back-end elasticsearch index exists.
diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py
index 005c22b..6cda5b7 100644
--- a/fatcat_scholar/web.py
+++ b/fatcat_scholar/web.py
@@ -21,7 +21,12 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
from fatcat_scholar.config import settings, GIT_REVISION
from fatcat_scholar.hacks import Jinja2Templates, parse_accept_lang
-from fatcat_scholar.search import process_query, FulltextQuery, FulltextHits, es_scholar_index_exists
+from fatcat_scholar.search import (
+ process_query,
+ FulltextQuery,
+ FulltextHits,
+ es_scholar_index_exists,
+)
from fatcat_scholar.schema import ScholarDoc
@@ -97,6 +102,7 @@ api = APIRouter()
async def home() -> Any:
return {"endpoints": {"/": "this", "/search": "fulltext search"}}
+
@api.head("/", include_in_schema=False)
async def root_head() -> Any:
"""
@@ -106,6 +112,7 @@ async def root_head() -> Any:
"""
return Response()
+
@api.get("/_health", operation_id="get_health")
def health_get() -> Any:
"""
@@ -115,10 +122,12 @@ def health_get() -> Any:
raise HTTPException(status_code=503)
return Response()
+
@api.head("/_health", include_in_schema=False)
def health_head() -> Any:
return health_get()
+
class HitsModel(BaseModel):
count_returned: int
count_found: int