cog icon indicating copy to clipboard operation
cog copied to clipboard

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

Open joehoover opened this issue 1 year ago • 3 comments

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.

joehoover avatar Dec 22 '23 16:12 joehoover

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

asingh9530 avatar Dec 28 '23 17:12 asingh9530

should I raise a PR to fix this ?

@asingh9530 yes please!

zeke avatar Jan 02 '24 23:01 zeke

@zeke missed notification, added PR for fix.

asingh9530 avatar Jan 05 '24 16:01 asingh9530