I have 50 lambda functions. Now I wrote a script to invoke these 50 functions every 15 minutes, something like this:
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
I created a deployment package with boto3 package and the pickle file in it. When I execute this in lambda management console, 2 things I notice:
check functionsis printed twice in logs, event though there is just one single printThe logs show either 1 or 2 functions that are executed. It doesn't print all functions, which means those functions are never invoked.
This script however runs on my local machine in 24 seconds and all functions are executed perfectly. Can someone help me to run this script on AWS?
My pickle file:
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'}
The above are aws lambda functions itself which are to be invoked
