mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-06 14:18:11 +08:00
fixe bug in status.json
This commit is contained in:
@@ -314,17 +314,23 @@ def do_GET_status():
|
|||||||
|
|
||||||
@app.route("/cache_status.json", methods=["GET"])
|
@app.route("/cache_status.json", methods=["GET"])
|
||||||
def do_GET_status_json():
|
def do_GET_status_json():
|
||||||
|
def map_entry(entry):
|
||||||
|
dataset = entry.key.h5ad_item.descriptor
|
||||||
|
annotation_file = entry.key.annotation_descriptor
|
||||||
|
return {
|
||||||
|
"dataset": dataset,
|
||||||
|
"annotation_file": annotation_file,
|
||||||
|
"launchtime": entry.launchtime,
|
||||||
|
"last_access": entry.timestamp,
|
||||||
|
"status": entry.status.name,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return json.dumps(
|
return json.dumps(
|
||||||
{
|
{
|
||||||
"launchtime": app.extensions.get("cellxgene_gateway", {}).get("launchtime"),
|
"launchtime": app.extensions.get("cellxgene_gateway", {}).get("launchtime"),
|
||||||
"entry_list": [
|
"entry_list": [
|
||||||
{
|
map_entry(entry)
|
||||||
"dataset": entry.key.dataset,
|
|
||||||
"annotation_file": entry.key.annotation_file,
|
|
||||||
"launchtime": entry.launchtime,
|
|
||||||
"last_access": entry.timestamp,
|
|
||||||
"status": entry.status,
|
|
||||||
}
|
|
||||||
for entry in cache.entry_list
|
for entry in cache.entry_list
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-31
@@ -53,36 +53,36 @@ export GATEWAY_ENABLE_BACKED_MODE=${GATEWAY_ENABLE_BACKED_MODE:-true}
|
|||||||
# Check if uwsgi is installed
|
# Check if uwsgi is installed
|
||||||
if ! command -v uwsgi &> /dev/null; then
|
if ! command -v uwsgi &> /dev/null; then
|
||||||
echo "Error: uwsgi not found. Install with: pip install uwsgi"
|
echo "Error: uwsgi not found. Install with: pip install uwsgi"
|
||||||
exit 1
|
else
|
||||||
|
# Display configuration
|
||||||
|
echo "Starting Cellxgene Gateway with uWSGI..."
|
||||||
|
echo "Configuration:"
|
||||||
|
echo " Data source: ${CELLXGENE_DATA:-$CELLXGENE_BUCKET}"
|
||||||
|
echo " Binding to: $HOST:$PORT"
|
||||||
|
echo " Workers: $WORKERS"
|
||||||
|
echo " Threads: $THREADS"
|
||||||
|
echo " Timeout: ${TIMEOUT}s"
|
||||||
|
echo " Backed mode: ${GATEWAY_ENABLE_BACKED_MODE}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
|
# Start uWSGI with optimized settings
|
||||||
|
# Additional options you can add via environment variables:
|
||||||
|
# - UWSGI_MAX_REQUESTS: Restart worker after N requests (prevents memory leaks)
|
||||||
|
uwsgi \
|
||||||
|
--http "$HOST:$PORT" \
|
||||||
|
--module cellxgene_gateway.gateway:app \
|
||||||
|
--workers "$WORKERS" \
|
||||||
|
--threads "$THREADS" \
|
||||||
|
--harakiri "$TIMEOUT" \
|
||||||
|
--master \
|
||||||
|
--enable-threads \
|
||||||
|
--single-interpreter \
|
||||||
|
--need-app \
|
||||||
|
--die-on-term \
|
||||||
|
--log-x-forwarded-for \
|
||||||
|
${UWSGI_MAX_REQUESTS:+--max-requests "$UWSGI_MAX_REQUESTS"} \
|
||||||
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Display configuration
|
|
||||||
echo "Starting Cellxgene Gateway with uWSGI..."
|
|
||||||
echo "Configuration:"
|
|
||||||
echo " Data source: ${CELLXGENE_DATA:-$CELLXGENE_BUCKET}"
|
|
||||||
echo " Binding to: $HOST:$PORT"
|
|
||||||
echo " Workers: $WORKERS"
|
|
||||||
echo " Threads: $THREADS"
|
|
||||||
echo " Timeout: ${TIMEOUT}s"
|
|
||||||
echo " Backed mode: ${GATEWAY_ENABLE_BACKED_MODE}"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
cd "$SCRIPT_DIR"
|
|
||||||
|
|
||||||
# Start uWSGI with optimized settings
|
|
||||||
# Additional options you can add via environment variables:
|
|
||||||
# - UWSGI_MAX_REQUESTS: Restart worker after N requests (prevents memory leaks)
|
|
||||||
exec uwsgi \
|
|
||||||
--http "$HOST:$PORT" \
|
|
||||||
--module cellxgene_gateway.gateway:app \
|
|
||||||
--workers "$WORKERS" \
|
|
||||||
--threads "$THREADS" \
|
|
||||||
--harakiri "$TIMEOUT" \
|
|
||||||
--master \
|
|
||||||
--enable-threads \
|
|
||||||
--single-interpreter \
|
|
||||||
--need-app \
|
|
||||||
--die-on-term \
|
|
||||||
--log-x-forwarded-for \
|
|
||||||
${UWSGI_MAX_REQUESTS:+--max-requests "$UWSGI_MAX_REQUESTS"} \
|
|
||||||
"$@"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user