在Python中停止Lambda函数 [英] Stop a Lambda function in Python
问题描述
在某个函数中,我想停止整个Lambda进程,但不触发错误.我尝试查看上下文变量来停止它,或者只是调用exit()
,但是每次将其视为我不想跟踪的错误时.
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.
如何在Python中成功结束Lambda进程?
How can I end successfully a Lambda process in Python?
推荐答案
在AWS Lambda中,您定义了handler
函数,而在Python中,该函数只需要return
即可成功完成,其中return
表示return None
.
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.
这篇关于在Python中停止Lambda函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!