[英]AWS Lambda asynchronous function not working
我有50個lambda函數。 現在,我編寫了一個腳本,每15分鍾調用這50個函數,如下所示:
import boto3
import pickle
def Handler(event, context):
#read exams functions from pickle
with open('result.pickle', 'rb') as file:
all_functions = pickle.load(file)
functions = all_functions['func']
print('check functions')
for items in functions:
if 'FromDB' in items:
print(items)
lambda_client = boto3.client('lambda')
response = lambda_client.invoke(FunctionName = items, InvocationType = 'Event')
print(response)
else:
continue
我創建了一個包含boto3包和pickle文件的部署包。 當我在lambda管理控制台中執行此操作時,我注意到兩件事:
check functions
在日志中打印了兩次,即使只有一張打印,也會發生事件
日志顯示已執行的1個或2個功能。 它不會打印所有功能,這意味着永遠不會調用這些功能。
但是,該腳本會在24秒內在我的本地計算機上運行,並且所有功能都可以完美執行。 有人可以幫助我在AWS上運行此腳本嗎?
我的泡菜文件:
with open('result.pickle', 'rb') as file:
all_functions = pickle.load(file)
functions = all_functions['func']
print(functions)
{'myfunc_1', 'myfunc_2', 'myfunc_3', 'myfunc_4', 'myfunc_5'}
以上是aws lambda函數本身,將被調用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.