replicate / cog

Containers for machine learning
https://cog.run
Apache License 2.0
7.87k stars 549 forks source link

Inform user if `cog.yaml` or `predict.py` are missing #1452

Open joehoover opened 9 months ago

joehoover commented 9 months ago

cog.command.openapi_schema should inform users if cog.yaml is missing.

Currently, cog.command.openapi_schema silently returns {} if cog.yaml is missing (see here).

This is undesirable in situations where cog.yaml is in fact missing, but the user thinks that it is present. In such cases, cog build will fail on openapi schema validation, but it won't be clear why.

This just happened to me!

For various questionable reasons, cog.yaml in my project root is a symlink and the target was accidentally excluded in my .dockerignore. This led to an interesting situation where cog run python -m cog.command.openapi_schema returned the correct schema, but cog build failed at schema validation because the schema returned empty.

A warning or just a note that my cog.yaml was missing would have saved me quite a bit of detective work.

asingh9530 commented 9 months ago

@joehoover this is a easy fix by adding a warning, should I raise a PR to fix this ?

zeke commented 8 months ago

should I raise a PR to fix this ?

@asingh9530 yes please!

asingh9530 commented 8 months ago

@zeke missed notification, added PR for fix.