Skip to content

Commit

Permalink
Adjustments from reconstructing ALB PR.
Browse files Browse the repository at this point in the history
  • Loading branch information
youcandanch committed Mar 11, 2019
1 parent ffe9de0 commit 6929aed
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 122 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -87,3 +87,4 @@ zappa_settings.json
*.sublime-workspace

README.test.md
.vscode
28 changes: 14 additions & 14 deletions README.md
Expand Up @@ -580,16 +580,16 @@ Optionally you can add [SNS message filters](http://docs.aws.amazon.com/sns/late

For configuring Lex Bot's intent triggered events:
```javascript
"bot_events": [
"bot_events": [
{
"function": "lexbot.handlers.book_appointment.handler",
"event_source": {
"arn": "arn:aws:lex:us-east-1:01234123123:intent:TestLexEventNames:$LATEST", // optional. In future it will be used to configure the intent
"intent":"intentName", // name of the bot event configured
"invocation_source":"DialogCodeHook", // either FulfillmentCodeHook or DialogCodeHook
"intent":"intentName", // name of the bot event configured
"invocation_source":"DialogCodeHook", // either FulfillmentCodeHook or DialogCodeHook
}
}
]
]

```

Expand Down Expand Up @@ -654,14 +654,14 @@ Putting a try..except block on an asynchronous task like this:
@task
def make_pie():
try:
ingredients = get_ingredients()
pie = bake(ingredients)
deliver(pie)
ingredients = get_ingredients()
pie = bake(ingredients)
deliver(pie)

except Fault as error:
"""send an email"""
...
return Response('Web services down', status=503)
"""send an email"""
...
return Response('Web services down', status=503)
```

will cause an email to be sent twice for the same error. See [asynchronous retries at AWS](https://docs.aws.amazon.com/lambda/latest/dg/retries-on-errors.html). To work around this side-effect, and have the fault handler execute only once, change the return value to:
Expand All @@ -670,12 +670,12 @@ will cause an email to be sent twice for the same error. See [asynchronous retri
@task
def make_pie():
try:
"""code block"""
"""code block"""

except Fault as error:
"""send an email"""
...
return {} #or return True
"""send an email"""
...
return {} #or return True
```

### Task Sources
Expand Down
5 changes: 2 additions & 3 deletions test_settings.py
@@ -1,6 +1,6 @@
APP_MODULE = 'tests.test_app'
APP_FUNCTION = 'hello_world'
DJANGO_SETTINGS = None
DJANGO_SETTINGS = None
DEBUG = 'True'
LOG_LEVEL = 'DEBUG'
SCRIPT_NAME = 'hello_world'
Expand All @@ -11,7 +11,7 @@
REMOTE_ENV='s3://lmbda/test_env.json'
## test_env.json
#{
# "hello": "world"
# "hello": "world"
#}
#

Expand Down Expand Up @@ -65,4 +65,3 @@ def authorizer_event(event, content):

def command():
print("command")

@@ -0,0 +1,9 @@
{
"status_code": 201,
"data": {
"AliasArn": "arn:aws:lambda:us-east-1:12345:function:test_lmbda_function55:current-alb-version",
"Description": "Zappa Deployment",
"FunctionVersion": "1",
"Name": "current-alb-version"
}
}
@@ -0,0 +1,9 @@
{
"status_code": 201,
"data": {
"AliasArn": "arn:aws:lambda:us-east-1:12345:function:test_lmbda_function55:current-alb-version",
"Description": "Zappa Deployment",
"FunctionVersion": "1",
"Name": "current-alb-version"
}
}
@@ -0,0 +1,9 @@
{
"status_code": 201,
"data": {
"AliasArn": "arn:aws:lambda:us-east-1:12345:function:test_lmbda_function55:current-alb-version",
"Description": "Zappa Deployment",
"FunctionVersion": "1",
"Name": "current-alb-version"
}
}

0 comments on commit 6929aed

Please sign in to comment.