Comments (11)
I was thinking that it would be a settings entry for each function.
Although, to be honest, I think my longer term vision would be that non-APIGW lambda functions could simply be wrapped as decorators as a way to replace Celery, etc, so you could do something like
@zappa(event_source="ses:blah")
def mail(event):
return True
or for scheduled events:
@zappa(timing="0 0 0 * * *")
def defrag(event):
return True
and have these functions created and configured automatically with deploy/update.
But I've held off on implementing that since lambda scheduling can't be done via API/boto yet. Thoughts?
from zappa.
I started a fork to add the package and/or upload functionality. I got stuck where I needed to figure how how to do the settings. The settings file really needs to change so that one can define most of the environment settings on individual functions with an additional handler setting. How do you see this working? I am thinking something like:
{
"dev": { // The name of your environment
"app" : {
"s3_bucket": "lmbda", // The name of your S3 bucket
... // Various lambda attributes
"app_function": "your_module.app" // The python path to your WSGI application function.
},
"my_function" : {
"s3_bucket": "lmbda", // The name of your S3 bucket
... //Various Lambda attributes
"handler": "module.function" // The handler for the lambda function
}
}
}
I think it would be pretty easy to handle both the old-style and new-style. If there is an "app" key in the dictionary, load as new-style, if not load as old-style.
Your thoughts?
from zappa.
Hi ubiquitousthey - thanks for bringing this up.
I think that might be over-engineering it a bit. I don't think an environment would have a both an app_function and a handler - just one or the other, with app_function taking precedent over handler. Does that make sense, or is there a scenario I'm missing?
from zappa.
I have an system I am working on that will have a web component that I would develop with zappa/flask. It also will have a few lambda functions that get triggered by SES and a timer. I was thinking it would have a configuration like the one above.
In this case I was thinking one could issue:
zappa dev deploy
or
zappa dev deploy app
or
zappa dev deploy my_ses_handler
This could also be accomplished with an environment per function or app as well, and that could leave the format pretty much the same and simplify the changes to the code, but it would push toward environments that would result in command like:
zappa app-dev deploy
and
zappa my_ses_handler-dev deploy
which would result in some uglier function and apig names.
Maybe the the idea would be to have one settings file per app or function?
from zappa.
One zapp_settings file per function sounds reasonable.
The decorators sound interesting. I like being able to define the triggers in code. There might need to be a way to configure environment. One might have 2 SNS topics: one for testing and one for production. I suppose the precompile step could be used to load settings from a renamed json or py.
I think the lambda schedule is available now as a cloud watch event.
http://boto3.readthedocs.io/en/latest/reference/services/events.html?highlight=cloud%20watch%20event#CloudWatchEvents.Client.put_rule
You would have to call put_rule and put_target.
from zappa.
Ooo.. excellent find. Cool.
from zappa.
Keep-Warm using CloudWatch Events is now in Master.
from zappa.
Cool. I'll create a PR for the settings-per-function idea as that moves me forward. I'll look at the decorator idea after that.
from zappa.
You are actually already be able to specify a different settings file using the '-s' argument.
from zappa.
I think we should model this CLI similar to docker:
zappa build
zappa push
..etc
Each function can have its Zappafile settings
from zappa.
Thanks @michi88 for implementing this
from zappa.
Related Issues (20)
- Schedule tasks with `cron()` format need to follow AWS rules HOT 1
- struggling with GET request to / yielded a 502 response code
- Decorating a event function may cause unexpected errors
- AWS CodeBuild Error
- Zappa not compatible with Python3.8 HOT 1
- Zappa template object has no attribute add_description error, cfn_flip dependency HOT 4
- Zappa Deploy | Update error on "No such file or directory" Possible duplicate of https://github.com/Miserlou/Zappa/issues/1232 HOT 2
- AttributeError: 'Template' object has no attribute 'add_description' HOT 8
- I've found a bit more elegant solution to the GeoDjango problem. Good news: it doesn't rely on the configurable directory hackish-ness, but still (as of September 19th, 2019) relies on a separate fork of Zappa.
- Lambda functions with s3 event sources are publically accessible HOT 1
- [Question] Is there a way to set the API Gateway stage on AWS different from the 'stage name' in the config?
- Regarding Lambda Packages
- Zappa Update Dev raised an AccessDeniedError
- ImportError: cannot import name 'Flask' from 'flask' (unknown location) HOT 2
- Package size over limit
- zappa deploy issue using python 3.8 instead of python 3.7 HOT 2
- added support for Django websockets/channels/asgi HOT 1
- Cannot find libxmlsec1.so.1 in AWS Lambda python3.8 environment HOT 2
- keep_warm callbacks have no effect on warmup HOT 1
- Unable to deploy Zappa to AWS Lambda return 502 everytime HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zappa.