Spaces:
Running
Running
Sync from GitHub (tests passed)
Browse files- Dockerfile +4 -3
- app/main.py +3 -0
- app/schemas.py +3 -0
Dockerfile
CHANGED
|
@@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 17 |
ENV PATH="/root/.cargo/bin:${PATH}"
|
| 18 |
|
| 19 |
COPY ./rust_accel /build/rust_accel
|
| 20 |
-
RUN cd /build/rust_accel && maturin build --release --out /wheels
|
| 21 |
|
| 22 |
# =============================================================================
|
| 23 |
# Stage 2: Lean Production Runtime Image (Zero Rust Toolchain Bloat)
|
|
@@ -42,14 +42,15 @@ ENV PYTHONUNBUFFERED=1 \
|
|
| 42 |
PYTHONPATH=/code \
|
| 43 |
REDIS_URL=redis://127.0.0.1:6379/0 \
|
| 44 |
HF_HOME=/data/hf_cache \
|
|
|
|
| 45 |
HF_HUB_DISABLE_PROGRESS_BARS=1 \
|
| 46 |
TRANSFORMERS_VERBOSITY=error \
|
| 47 |
TRANSFORMERS_NO_ADVISORY_WARNINGS=1 \
|
| 48 |
TOKENIZERS_PARALLELISM=false
|
| 49 |
|
| 50 |
-
# Install compiled Rust PyO3 wheel from builder stage (~250 KB)
|
| 51 |
COPY --from=rust-builder /wheels /wheels
|
| 52 |
-
RUN pip install --no-cache-dir /wheels/*.whl && rm -rf /wheels
|
| 53 |
|
| 54 |
# Python deps
|
| 55 |
COPY ./requirements.txt /code/requirements.txt
|
|
|
|
| 17 |
ENV PATH="/root/.cargo/bin:${PATH}"
|
| 18 |
|
| 19 |
COPY ./rust_accel /build/rust_accel
|
| 20 |
+
RUN cd /build/rust_accel && maturin build --release -i python3 --out /wheels
|
| 21 |
|
| 22 |
# =============================================================================
|
| 23 |
# Stage 2: Lean Production Runtime Image (Zero Rust Toolchain Bloat)
|
|
|
|
| 42 |
PYTHONPATH=/code \
|
| 43 |
REDIS_URL=redis://127.0.0.1:6379/0 \
|
| 44 |
HF_HOME=/data/hf_cache \
|
| 45 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 \
|
| 46 |
HF_HUB_DISABLE_PROGRESS_BARS=1 \
|
| 47 |
TRANSFORMERS_VERBOSITY=error \
|
| 48 |
TRANSFORMERS_NO_ADVISORY_WARNINGS=1 \
|
| 49 |
TOKENIZERS_PARALLELISM=false
|
| 50 |
|
| 51 |
+
# Install compiled Rust PyO3 wheel from builder stage (~250 KB) + Rust hf_transfer
|
| 52 |
COPY --from=rust-builder /wheels /wheels
|
| 53 |
+
RUN pip install --no-cache-dir /wheels/*.whl hf_transfer && rm -rf /wheels
|
| 54 |
|
| 55 |
# Python deps
|
| 56 |
COPY ./requirements.txt /code/requirements.txt
|
app/main.py
CHANGED
|
@@ -562,6 +562,8 @@ async def health_check():
|
|
| 562 |
else:
|
| 563 |
status = "healthy"
|
| 564 |
|
|
|
|
|
|
|
| 565 |
return HealthResponse(
|
| 566 |
status=status,
|
| 567 |
db_type=get_db_type(),
|
|
@@ -580,6 +582,7 @@ async def health_check():
|
|
| 580 |
tft_reference_price_date=tft_reference_price_date,
|
| 581 |
price_bar_latest_date=price_bar_latest_date,
|
| 582 |
price_bar_staleness_days=price_bar_staleness_days,
|
|
|
|
| 583 |
)
|
| 584 |
|
| 585 |
|
|
|
|
| 562 |
else:
|
| 563 |
status = "healthy"
|
| 564 |
|
| 565 |
+
from app.accel import ACCEL_BACKEND
|
| 566 |
+
|
| 567 |
return HealthResponse(
|
| 568 |
status=status,
|
| 569 |
db_type=get_db_type(),
|
|
|
|
| 582 |
tft_reference_price_date=tft_reference_price_date,
|
| 583 |
price_bar_latest_date=price_bar_latest_date,
|
| 584 |
price_bar_staleness_days=price_bar_staleness_days,
|
| 585 |
+
accel_backend=ACCEL_BACKEND,
|
| 586 |
)
|
| 587 |
|
| 588 |
|
app/schemas.py
CHANGED
|
@@ -201,6 +201,9 @@ class HealthResponse(BaseModel):
|
|
| 201 |
price_bar_staleness_days: Optional[int] = Field(
|
| 202 |
None, description="Calendar days between today and the latest PriceBar"
|
| 203 |
)
|
|
|
|
|
|
|
|
|
|
| 204 |
|
| 205 |
class Config:
|
| 206 |
json_schema_extra = {
|
|
|
|
| 201 |
price_bar_staleness_days: Optional[int] = Field(
|
| 202 |
None, description="Calendar days between today and the latest PriceBar"
|
| 203 |
)
|
| 204 |
+
accel_backend: Optional[str] = Field(
|
| 205 |
+
None, description="Active native compute acceleration backend (rust_pyo3 or native_c_simd)"
|
| 206 |
+
)
|
| 207 |
|
| 208 |
class Config:
|
| 209 |
json_schema_extra = {
|