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
Not clear on how to use sharp on sam-cli locally (cross-platform) #3473
Comments
Did you see #3207 (comment) ? |
I did. I tried it, and even though the error doesn't appear, it doesn't 'work' either. It shows no console logs, nor does it give me any success or failure. Just kinda of silently fails. Am I doing something wrong? Surely there are other people using an m1 Mac to develop lambda functions locally with Sam. Something just isn't clicking with me on this. Thank you for your response 😊 |
|
I should clarify (apologies): The function silently fails. It builds correctly and runs the function (or appears to) but there are no console logs or any return logs. It even shows the correct time that the function should be running (it's a pretty long OpenAI generation) Here is what my terminal shows:
|
I can also confirm -- I have upgraded Docker (just in case even though I'm not getting that issue) and it works 100% if I comment out any sharp import/usage. Otherwise, it just runs through - no logs or anything. |
Are you sure 128MB is enough memory for the task, as this log entry suggests the request maxed out. The use of |
The raw image is only 3mb and it's only processing one. I just figured 128 would be enough. It only holds a couple text fields and an image. |
When running CPU-bound tasks on Lambda, artificially limiting RAM is usually a false economy. https://sharp.pixelplumbing.com/install#aws-lambda
|
Here is the reason though. I have to make *two* requests to open ai, the
second depending on input from the first's output - so these functions can
take anywhere from 15-30 seconds to complete - and the image is the second
response - so we'd be up to thirty seconds in at that point.
Increasing the ram would almost exponentially increase the cost. It's not
computationaly-exhausting either. It's just waiting for output from their
api.
So I guess I should just strap a lambda event on the storage creation
trigger separately?
On Fri, Dec 2, 2022 at 10:04 AM Lovell Fuller ***@***.***> wrote:
When running CPU-bound tasks on Lambda, artificially limiting RAM is
usually a false economy.
https://sharp.pixelplumbing.com/install#aws-lambda
To get the best performance select the largest memory available. A 1536 MB
function provides ~12x more CPU time than a 128 MB function.
—
Reply to this email directly, view it on GitHub
<#3473 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABUHW7WDQRQQ5SVKKRPSDGTWLITZFANCNFSM6AAAAAASPEBLCA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
-Joel R Hager
|
Thanks, this is useful extra information. It definitely sounds like you should be maintaining two functions and therefore invocations, ensuring you separate I/O bound tasks from CPU bound tasks. |
For sure! I guess I didn't think a single 3mb photo would cripple a 128mb instance, and since I already had the image in a buffer it seemed acceptable to just do it before uploading to my bucket. I'll separate it out. Thanks! |
I hope this information helped. Please feel free to re-open with more details if further assistance is required. |
Question about an existing feature
What are you trying to achieve?
I can't figure out how to specify the correct architecture based on whether or not I'm running locally (m1 mac arm64) or AWS/SAM (Linux)
I can see where to specify the architecture in the YAML file, but I'm not sure how to specify which to use based on the environment it's being invoked from, or how to figure that out.
When you searched for similar issues, what did you find that might be related?
There is a BOATLOAD of differing opinions on globally installing sharp, saying that 29+ doesn't matter, using brew, using taps, etc. There's no real authority for what the most recent and successful methods are
The issues here in the repo
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question
Here is the error:
It's arch-dependent, so a repo won't help. A blank install of any node instance in SAM locally with sharp will produce this result (at least on my end)
Please provide sample image(s) that help explain this question
The text was updated successfully, but these errors were encountered: