Skip to content

Instantly share code, notes, and snippets.

@klivan klivan/main.py Secret
Created Jan 25, 2019

Embed
What would you like to do?
import json
import boto3
client = boto3.client('lambda')
BATCH_SIZE = 100
def lambda_handler(event, context):
urls = []
for i in range(0, 10000):
urls.append('url_{}'.format(i))
chunks = [urls[i:i + BATCH_SIZE] for i in range(0, len(urls), BATCH_SIZE)]
for chunk in chunks:
response = client.invoke(
FunctionName='triggerer',
InvocationType='Event',
Payload=json.dumps({'urls': chunk})
)
return
import json
import boto3
client = boto3.client('lambda')
def lambda_handler(event, context):
for url in event.get('urls', []):
response = client.invoke(
FunctionName='testLambdaWorker',
InvocationType='Event',
Payload=json.dumps({'url': url})
)
return
import json
import time
def lambda_handler(event, context):
time.sleep(0.5)
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.