Hi, I got another question about kedro-boot. I wan...
# plugins-integrations
j
Hi, I got another question about kedro-boot. I want to use it to run fastapi, how can I manually select which pipeline it should use? In the example, you have to register manually your e.g., inference pipeline as "default", and you just use
from kedro_boot.app.fastapi.session import KedroFastApi
Is thera a way to overcome it? I know that
KedroBootFastApi
depends on
KedroBootSession
, but I guess it's not as simple as defining
session=KedroFastApi(KedroBootSession(pipeline="inference"))
@Takieddine Kadiri
👍 1
So that I can still run all pipelines with
kedro run
, and just specify subset of pipelines in the fastapi itself
t
Hi Julian, As you observed, there is one selected pipeline per
KedroBootSession
(the kedro project itself run in the context of one selected pipeline). In order to specify different subset of your pipeline in the fastapi, you can use pipeline namespace, they are mapped with fastapi
operation_id
so each endpoint could use a different pipeline.
👍 1
j
Great, thanks!
j
Hi @Takieddine Kadiri! I have a similar question for the AbstractKedroBootApp situation (Monte Carlo Example). How would you select a specific pipeline to run? Using a specific namespace did not yield the desired result. I can get what I want by using the CLI command:
kedro boot run -p my_custom_pipeline
where my_custom_pipeline is a modification of a namespaced pipeline of all my pipelines. How would I call this within the code, i.e. with
kedro_boot_session.run()
?
t
If you need to use multiple pipelines inside your app, you can compose a
__default__
or whatever pipeline containing your namespaced pipelines :
{‘__default__’: pipeline_namespace1 + pipeline_namespace2 + ..}
You can then select your desired pipeline namespace with
kedro_boot_session.run(namespace=‘pipeline_namespace1’)
You can’t select a registred pipeline through kedro boot session run, as the session is constructed using the currently selected pipeline (through cli as you mentioned). But you can filter which subset of pipeline you need to use in your app using pipeline namespaces.
j
Okay, thanks for this info! To be concrete I have a pipeline with the namespace prediction, consisting of 10 nodes. What I would like to run is a subset of that pipeline (from specific input to specific output) which only consists of e.g. 5 nodes within that pipeline. If I understand correctly that is not possible but I would have to create a new pipeline with a new namespace where only those nodes are part of.
t
You can either create a new pipeline with the new namespace or you can have both namespaces in the same default pipeline
j
Okay, thank you!