html io manager

This commit is contained in:
2025-07-29 11:30:17 +02:00
parent f785a7d3b1
commit 8aa943b0bf

View File

@@ -0,0 +1,20 @@
from shared.resources import BaseIOManager
from upath import UPath
import dagster as dg
class HtmlIOManager(BaseIOManager):
extension: str = ".html" # Automatically adds a .json extension
def dump_to_path(
self, context: dg.OutputContext, obj: object, path: "UPath"
) -> None:
"""This saves the output of an asset to a file path."""
with path.open("w") as fp:
fp.write(obj)
def load_from_path(self, context: dg.InputContext, path: "UPath") -> object:
"""This loads an input for a downstream asset from a file path."""
with path.open("r") as fp:
return fp.read()