这是烧瓶的光环框架库
halo-flask的Python项目详细描述
光环
库是一个基于python的库,它利用了Serverless技术和microservices architecture
光环提供以下功能:
- aws lambda&dynamodb的烧瓶开发
- correlation id across microservices
- structured json based logging
- sample debug log in production
- support for microservice transactions with the saga pattern
- using SSM Parameter Store over Lambda env variables
- Serverless Error Handling & trace id for end users
- Lambda timeout管理slow HTTP responses
- ootb support for Idempotent service invocations (md5)
如果要构建运行在aws lambda(django或flask)上的python web应用程序,请使用此库来管理api事务:
sagax = load_saga("test", jsonx, schema)
payloads = {"BookHotel": {"abc": "def"}, "BookFlight": {"abc": "def"}, "BookRental": {"abc": "def"},
"CancelHotel": {"abc": "def"}, "CancelFlight": {"abc": "def"}, "CancelRental": {"abc": "def"}}
apis = {"BookHotel": self.create_api1, "BookFlight": self.create_api2, "BookRental": self.create_api3,
"CancelHotel": self.create_api4, "CancelFlight": self.create_api5, "CancelRental": self.create_api6}
try:
self.context = Util.get_lambda_context(request)
ret = sagax.execute(self.req_context, payloads, apis)
return {"saga": "good"}, 200
except SagaRollBack as e:
return {"saga": "bad"}, 500
许可证
这个项目是根据麻省理工学院的许可证授权的