Skip to content

Commit ab0e676

Browse files
committed
cleaning up
1 parent f0af939 commit ab0e676

6 files changed

Lines changed: 15 additions & 16 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ A tool for distributing processes across AWS Lambda functions with built-in resu
33

44
## Usage
55
```python
6-
# Example lambda function
6+
# Example lambda function (should be deployed to AWS)
77
# filename: example_handler.py
88
# Lambda function name: example_lambda
9+
from time import sleep
10+
from random import randint
11+
912
from parallelagram.remote_handler import remote_handler
1013

1114

@@ -25,6 +28,8 @@ def execute(max_time: int):
2528
# Calling code to asynchronously invoke the lambda defined above and retrieve its results
2629

2730
from parallelagram.launchables import Lambdable, ResponseCollector
31+
32+
2833
def main():
2934
lambda_list = [Lambdable(func_path='example_handler.execute',
3035
remote_aws_lambda_func_name='example_lambda',

app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from aws_cdk import core
44

5-
from parallelagram.parallelagram_stack import LambdaStack
5+
from stack.stack import LambdaStack
66

77

88
app = core.App()

example_lambda/example_handler.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
from random import randint
22
from time import sleep
33

4+
from parallelagram.remote_handler import remote_handler
45

6+
7+
@remote_handler
58
def handler(event, context):
6-
sleep_time = randint(1, 10)
9+
pass
10+
11+
def execute(max_time: int):
12+
sleep_time = randint(1, max_time)
713
print(f'sleeping for {sleep_time} seconds')
814
sleep(sleep_time)
915
return {'message': f'slept for {sleep_time} seconds'}

parallelagram/remote_handler.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,6 @@ def remote_handler(func):
9191
9292
If a message key is not present in the event then the decorated function handler will be invoked with the raw
9393
event and context arguments as a handler usually would be.
94-
95-
Because zappa dynamically generates its handler function on deployment, it is currently not possible to use this
96-
wrapper on zappa-deployed functions. Users who deploy their lambdas via zappa should use the @task (original
97-
zappa wrapper) or @remote_runner function wrappers instead, which should both still play nice with the manager
98-
functionalities provided in remote_manager.
99-
100-
Example for a non-Zappa deployed function:
101-
102-
get_request_from_s3: bool = False,
103-
request_s3_bucket: str = '',
104-
request_s3_key: str = '',
105-
response_to_s3: str = ''
10694
"""
10795

10896
@wraps(func)

tests/unit/test_parallelagram_stack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55
from aws_cdk import core
6-
from stack.parallelagram_stack import LambdaStack
6+
from stack.stack import LambdaStack
77

88

99
def get_template():

0 commit comments

Comments
 (0)