Matthew Scanlon
10/22/2023, 4:25 AMprefect.deployments.Deployment
is this a bug?
async def load_from_yaml(cls, path: str):
data = yaml.safe_load(await anyio.Path(path).read_bytes())
# load blocks from server to ensure secret values are properly hydrated
if data.get("storage"):
block_doc_name = data["storage"].get("_block_document_name")
# if no doc name, this block is not stored on the server
if block_doc_name:
block_slug = data["storage"]["_block_type_slug"]
block = await Block.load(f"{block_slug}/{block_doc_name}")
data["storage"] = block
if data.get("infrastructure"):
block_doc_name = data["infrastructure"].get("_block_document_name")
# if no doc name, this block is not stored on the server
if block_doc_name:
block_slug = data["infrastructure"]["_block_type_slug"]
block = await Block.load(f"{block_slug}/{block_doc_name}")
data["infrastructure"] = block
return cls(**data)
It makes no sense to me while we would only want to return a class instance if we specify. infrastructure in the yaml fileSerina
10/24/2023, 1:04 PM