Jordan
06/16/2022, 1:13 PMAssetDefinitions.from_graph
with a graph from the @graph
decorator or directly using the GraphDefinition
class I don't have the same behaviour. In the first case, I get the job and the asset group in my repo while in the second case my repo is composed only of the job and there is no asset. I used this example for the GraphDefinition: https://docs.dagster.io/concepts/ops-jobs-graphs/graphs#using-yaml-graphdsl
build_assets_job(
"my_job",
assets=[
AssetsDefinition.from_graph(
graph_def = define_dep_dsl_graph(),
partitions_def = DailyPartitionsDefinition(start_date="2022-01-01")
)
]
)
claire
06/16/2022, 5:50 PMGraphDefinition
defined in the example doesn't have a defined output, and a graph must have a defined output in order to be converted to an asset. You can modify the GraphDefinition
to have the output_mappings
arg:
from dagster import (
...
OutputMapping,
)
from dagster.core.definitions.output import OutputPointer
def construct_graph_with_yaml(yaml_file, op_defs) -> GraphDefinition:
...
return GraphDefinition(
name=yaml_data["name"],
description=yaml_data.get("description"),
node_defs=op_defs,
dependencies=deps,
output_mappings=[OutputMapping(OutputDefinition(), OutputPointer("subtract", "result"))],
)
Jordan
06/16/2022, 6:29 PM