在Python中停止Lambda函数 [英] Stop a Lambda function in Python

查看:91
本文介绍了在Python中停止Lambda函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某个函数中,我想停止整个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆