-
Notifications
You must be signed in to change notification settings - Fork 1
file_mount validation limits for python client #660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| # Measure size in bytes using UTF-8 encoding since payloads are JSON strings | ||
| size_bytes = len(content.encode("utf-8")) | ||
| if size_bytes > FILE_MOUNT_MAX_SIZE_BYTES: | ||
| raise ValueError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a good idea to catch all large files instead of just the first one encountered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great feedback! Making this change now. Thank you
|
|
||
| if total_size_bytes > FILE_MOUNT_TOTAL_MAX_SIZE_BYTES: | ||
| raise ValueError( | ||
| f"total file_mounts size exceeds maximum of {FILE_MOUNT_TOTAL_MAX_SIZE_BYTES} bytes. Use object_mounts instead." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we expect users to use file_mounts in combination with object_mounts? If so, it might be helpful to display what their total size is or how much they've exceeded the MAX_SIZE by, so they can make an informed partition of file_mounts vs object_mounts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the API needs to be flexible enough to support arbitrary combinations of object_mounts and file_mounts but the client-side should make it easy to do the right thing automatically (presumably by favoring object_mounts).
I think this change is worth making, but I wanted to provide more context as to why.
src/runloop_api_client/_constants.py
Outdated
| MAX_RETRY_DELAY = 60.0 | ||
|
|
||
| # Maximum allowed size (in bytes) for individual entries in `file_mounts` when creating Blueprints | ||
| FILE_MOUNT_MAX_SIZE_BYTES = 512 * 1024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep these limits static or adjust them based on Devbox resource allocation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This limit isn't a devbox limitation; it's a blueprint dockerfile length constraint. I think that each file_mount performs a text substitution inside the dockerfile, so the problem is that the dockerfile becomes too massive; not that the file_mounts exhaust resources for the devbox the dockerfile gets compiled on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a good idea to test that we don't reject file mounts when under or precisely at the limit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just client-side validations. There's no point being hyper-precise about these limits since they're really enforced on the server side anyway -- there's nothing to stop a caller ignoring our client & using our API endpoints directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense!
…f fast fail with exception
sid-rl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Adds a cap to individual and total file_mount size