https://prefect.io logo
Title
j

José Duarte

09/15/2022, 4:36 PM
Hey all, does anyone know how can I retrieve an Infrastructure object from Orion? I haven’t seen it covered in the docs
c

Christopher Boyd

09/15/2022, 4:36 PM
What do you mean retrieve?
What are you trying to do ?
j

José Duarte

09/15/2022, 4:38 PM
@Christopher Boyd I’m trying to programmatically declare a deployment using a specific infrastructure
c

Christopher Boyd

09/15/2022, 4:39 PM
so you’re just trying to load an infrastructure block?
j

José Duarte

09/15/2022, 4:41 PM
Here, I have a deployment that should use the docker container infra block. That
infra
there is “hardcoded”, I would like to retrieve the available one on my orion server
deployment: Deployment = Deployment.build_from_flow(
        flow,
        name=deployment_name,
        output=output,  # type: ignore
        infrastructure=infra,
        path="/app",
        skip_upload=True,
    )
You would either need to know it, or retrieve your registered blocks
and override it
j

José Duarte

09/15/2022, 4:42 PM
Aight, but how do I retrieve the blocks? I havent found the API to do so
you can do it from cli using
prefect blocks ls
via python, there are a couple block methods in prefect.client for reading/writing/updating
j

José Duarte

09/15/2022, 4:45 PM
thank you!