https://dagster.io/ logo
Title
b

Balázs Dukai

10/26/2022, 4:00 PM
Hello, I'm struggling with loading a multi_asset into my repository. I get an error and I'm not able to solve it: `Invariant failed. Description: Invalid asset dependencies: {AssetKey(['ahn', 'md5_pdok_ahn3'])} specified in
internal_asset_deps
argument for multi-asset 'multi_laz_files_ahn3' on key 'laz_files_ahn3'. Each specified asset key must be associated with an input to the asset or produced by this asset. Valid keys: {AssetKey(['pdal_info_ahn3']), AssetKey(['laz_files_ahn3']), AssetKey(['md5_pdok_ahn3'])}` Here is my asset definition:
@multi_asset(
    required_resource_keys={"file_store", "pdal"},
    partitions_def=PartitionDefinitionAHN(ahn_version=3),
    outs={
        "laz_files_ahn3": Out(is_required=False),
        "pdal_info_ahn3": Out(is_required=False)
    },
    internal_asset_deps={
        "laz_files_ahn3": {AssetKey(["ahn", "md5_pdok_ahn3"])},
        "pdal_info_ahn3": set(),
    },
    can_subset=True
)
def multi_laz_files_ahn3(context, md5_pdok_ahn3):
    # some code
I load my assets from that file like:
ahn_assets = load_assets_from_package_module(
    package_module=ahn,
    key_prefix="ahn",
    group_name=SOURCE
)
Then create a job like this:
job_source_ahn = define_asset_job(
    name="source_ahn",
    description="Make sure that the available AHN 3,4 LAZ files are present on disk, "
                "and their metadata is recorded.",
    selection=AssetSelection.keys(["ahn", "pdal_info_ahn3"]) | AssetSelection.keys(["ahn", "laz_files_ahn3"]) | AssetSelection.keys(["ahn", "md5_pdok_ahn3"])
)
j

jamie

10/26/2022, 4:56 PM
I think you might need to specify your input asset as an
in
because it has a key prefix
@multi_asset(
   ins={"md5_pdok_ahn3": AssetIn(["ahn", "md5_pdok_ahn3"]}
   <everything else you have>
)
let me know if that doesn’t work and i’ll try to replicate
b

Balázs Dukai

10/26/2022, 5:01 PM
Huh, thanks, it does work with an
in
!