File tree Expand file tree Collapse file tree
examples/fastapi-response-streaming-lmi Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ store-failure-output = true
113113test-threads = 1
114114
115115[profile .ci ]
116- inherits = " test"
116+ # inherits = "test"
117117# Print out output for failing tests as soon as they fail, and also at the end
118118# of the run (for easy scrollability).
119119failure-output = " immediate-final"
Original file line number Diff line number Diff line change 33import asyncio
44import uuid
55
6- logging .basicConfig (level = logging .INFO )
7- logger = logging .getLogger (__name__ )
8-
96app = FastAPI ()
107
118@app .get ("/health" )
@@ -21,8 +18,8 @@ async def streamer(request_id: str):
2118 await asyncio .sleep (0.05 )
2219
2320
24- @app .get ("/{path:path} " )
25- async def index (path : str , request : Request ):
21+ @app .get ("/" )
22+ async def index ():
2623 """Stream response - each concurrent request gets a unique ID."""
2724 request_id = str (uuid .uuid4 ())[:8 ]
2825 return StreamingResponse (streamer (request_id ), media_type = "text/plain" )
Original file line number Diff line number Diff line change @@ -40,13 +40,12 @@ Resources:
4040 AWS_LWA_INVOKE_MODE : response_stream
4141 PORT : 8000
4242 Layers :
43- # - !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:25
44- - arn:aws:lambda:us-west-2:048972532408:layer:LambdaAdapterLayerX86:8
43+ - !Sub arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:26
4544 CapacityProviderConfig :
4645 Arn : !GetAtt LMICapacityProvider.Arn
4746 PerExecutionEnvironmentMaxConcurrency : 64
4847 FunctionUrlConfig :
49- AuthType : AWS_IAM
48+ AuthType : NONE
5049 InvokeMode : RESPONSE_STREAM
5150
5251Outputs :
You can’t perform that action at this time.
0 commit comments