Skip to content

Commit

Permalink
Enhanced code for exception handling
Browse files Browse the repository at this point in the history
- Modified README
- Added exception handling
- Modified Changelog
  • Loading branch information
satyamsoni-gsa committed Jun 14, 2022
1 parent ac1109f commit 0002ba8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

### [0.1.6] - 2022-06-14

### Changed

- Added exception handling
- Enhanced docs


### [0.1.5] - 2022-06-14

### Changed
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ the repository.

Simply download the `Terraform` code attached in the release and unzip it.

> <span style="color:red;font-size:large">Note:</span> Make sure your function execution role has required permission to invoke your `Lambda` function else concurrent call executions might fail.
```bash
wget https://github.com/satyamsoni2211/LambdaWarmerPy/releases/download/${release}/terraform_code.zip
unzip terraform_code.zip -d terraform_code/
Expand All @@ -105,6 +107,9 @@ TransactionCompsAPI:
Type: "AWS::Serverless::Function"
Properties:
FunctionName: fake-function
Policies:
- LambdaInvokePolicy:
FunctionName: "fake-function"
Events:
WarmerSchedule: # add this event to the same template
Type: Schedule
Expand All @@ -118,11 +123,16 @@ TransactionCompsAPI:
In case you want to include concurrent executions, you may add below to include concurrent invocations.
> <span style="color:red;font-size:large">Note:</span> Using concurrency would also require you to add sufficient permissions to the role to call `lambda:invokeFunction` action on the `Lambda` function. Below code snippet includes policy to grant action to the role.

```yaml
TransactionCompsAPI:
Type: "AWS::Serverless::Function"
Properties:
FunctionName: fake-function
Policies:
- LambdaInvokePolicy:
FunctionName: "fake-function"
Events:
WarmerSchedule: # add this event to the same template
Type: Schedule
Expand Down
2 changes: 1 addition & 1 deletion release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.5
0.1.6
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
long_description = fr.read()
setup(
name="py_lambda_warmer",
version="0.1.5",
version="0.1.6",
description="Warmer Utility for Lambda Function",
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
4 changes: 2 additions & 2 deletions warmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def call_function_concurrently(concurrent_calls: int, flag: str):
for f in as_completed(map_):
try:
print(f.result())
except:
pass
except Exception as e:
print(f"got exception while executing function: {e}")


def warmer(flag="warmer", _concurrency=1):
Expand Down

0 comments on commit 0002ba8

Please sign in to comment.