Kedro with FastAPI - improving performance of KedroSession.load_context
#2133
illia-shkroba
started this conversation in
Idea
Replies: 1 comment
-
Duplicate of #2134 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello.
I'm trying to build RestAPI with FastAPI that runs Kedro Pipeline under the hood and come up with this solution:
session.run("math")
runs a simple pipeline that calculates a variance for the input:[1, 2, 3]
.The solution seems to work as expected, but it takes nearly 2.1 seconds to finish a request:
I've noticed that
session.load_context()
takes about 1 second to finish. Also I've found thatload_context()
is used bysession.run()
:It seems that
load_context()
is called twice during the request:get_context()
.session.run()
.I've tried to cache the result of
session.load_context()
like this:And by doing that I've decreased the request processing time to 1.06 seconds.
Do you have any suggestions on how I can further optimize the
session.run()
? Should I try a different approach with a plainDataCatalog
/SequentialRunner
? Or maybe Kedro's implementation ofload_context()
should be modified to use some caching?Beta Was this translation helpful? Give feedback.
All reactions