Skip to content

Commit fd34509

Browse files
committed
fix: split pip installs, add error logging, increase healthcheck start-period
1 parent f1c0a76 commit fd34509

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

spaces/imagenette-clip-hycoclip/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ WORKDIR $HOME/app
2121

2222
RUN pip install --upgrade pip
2323

24-
# Install latest releases from PyPI.
24+
# Install latest releases from PyPI (split for better build caching & logging).
2525
# For reproducible builds, pin versions here:
26-
# RUN pip install --upgrade hyperview==0.1.1 hyper-models==0.1.0
27-
RUN pip install --upgrade hyperview hyper-models
26+
# RUN pip install hyperview==0.1.1 hyper-models==0.1.0
27+
RUN pip install hyperview && python -c "import hyperview; print('hyperview', hyperview.__version__)"
28+
RUN pip install hyper-models && python -c "import hyper_models; print('hyper_models', hyper_models.__version__)"
2829

2930
COPY --chown=user demo.py ./demo.py
3031

@@ -41,7 +42,7 @@ ENV HOST=0.0.0.0 \
4142

4243
EXPOSE 7860
4344

44-
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
45+
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
4546
CMD curl -f http://localhost:7860/__hyperview__/health || exit 1
4647

4748
CMD ["python", "demo.py"]

spaces/imagenette-clip-hycoclip/demo.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@ def main() -> None:
121121

122122
if len(dataset) == 0 or not dataset.list_layouts():
123123
print("Preparing demo dataset...")
124-
_ensure_demo_ready(dataset)
124+
try:
125+
_ensure_demo_ready(dataset)
126+
except Exception as exc:
127+
import traceback
128+
traceback.print_exc()
129+
print(f"\nFATAL: demo setup failed: {type(exc).__name__}: {exc}", file=sys.stderr)
130+
sys.exit(1)
125131
else:
126132
print(
127133
f"Loaded cached dataset '{DATASET_NAME}' with "

0 commit comments

Comments
 (0)