Rudiger
Rudiger

Reputation: 6769

Stop a Lambda function in Python

Inside a certain function I want to stop the whole Lambda process but not trigger an error. I've tried looking at the context variable to stop it or just calling exit() but each time it's treated as an error which I don't want to track.

How can I end successfully a Lambda process in Python?

Upvotes: 11

Views: 26415

Answers (1)

Davos
Davos

Reputation: 5415

In AWS Lambda you define a handler function and in Python a function just needs to return in order to complete successfully, where return implies return None.

What you've done is correct, just have multiple return points in that handler function. You can always log messages for different reasons for the function completing if needed.

Upvotes: 15

Related Questions