Files
wehub-resource-sync 6ede33ccdb
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / compute_version (push) Waiting to run
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Blocked by required conditions
Build and Push Docker Images / verify_digests (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Blocked by required conditions
Build and Push Docker Images / finalize_release (push) Blocked by required conditions
Obsidian Plugin Lint / lint (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:33:44 +08:00

57 lines
1.8 KiB
Python

import argparse
import asyncio
import logging
import sys
import uvicorn
from dotenv import load_dotenv
from app.config.uvicorn import load_uvicorn_config
_old_log_record_factory = logging.getLogRecordFactory()
def _otel_safe_log_record_factory(*args, **kwargs):
record = _old_log_record_factory(*args, **kwargs)
if not hasattr(record, "otelTraceID"):
record.otelTraceID = "0"
if not hasattr(record, "otelSpanID"):
record.otelSpanID = "0"
return record
logging.setLogRecordFactory(_otel_safe_log_record_factory)
logging.basicConfig(
level=logging.INFO,
format=(
"%(asctime)s - %(name)s - %(levelname)s - "
"[trace_id=%(otelTraceID)s span_id=%(otelSpanID)s] %(message)s"
),
datefmt="%Y-%m-%d %H:%M:%S",
)
load_dotenv()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Run the SurfSense application")
parser.add_argument("--reload", action="store_true", help="Enable hot reloading")
args = parser.parse_args()
config_kwargs = load_uvicorn_config(args)
config = uvicorn.Config(**config_kwargs)
server = uvicorn.Server(config)
if sys.platform == "win32":
# Windows needs a split-loop setup: psycopg's async driver requires a
# SelectorEventLoop (no add_reader on Proactor), so the SERVER loop is
# forced to Selector via loop_factory. The global policy is left at
# its default (Proactor) so worker threads that call
# asyncio.new_event_loop() — playwright/patchright sync API used by
# the scrapers, unstructured, etc. — get a loop that CAN spawn
# subprocesses. Do not set WindowsSelectorEventLoopPolicy globally:
# that breaks every browser-based scraper with NotImplementedError.
asyncio.run(server.serve(), loop_factory=asyncio.SelectorEventLoop)
else:
server.run()